Merge nucleic/humble-fern-egret-60xo into dev

This commit is contained in:
2026-07-28 20:19:42 -07:00
parent b439f8e0ff
commit 200825c1e0
+39 -11
View File
@@ -33,6 +33,12 @@
.PARAMETER Test .PARAMETER Test
Run the leg's tests instead of just building it. Run the leg's tests instead of just building it.
.PARAMETER VcpkgRoot
An existing vcpkg checkout to use. Otherwise the script looks at %VCPKG_INSTALLATION_ROOT%,
the %LOCALAPPDATA%\vcpkg\vcpkg.path.txt breadcrumb, %LOCALAPPDATA%\Programs\vcpkg,
%USERPROFILE%\vcpkg and C:\vcpkg, and clones one into %LOCALAPPDATA%\Programs\vcpkg if none
of those hold a vcpkg.exe.
.PARAMETER Persist .PARAMETER Persist
Also save CPATH to your *user* environment, so future shells and editors resolve Also save CPATH to your *user* environment, so future shells and editors resolve
sqlite3.h without going through this script. sqlite3.h without going through this script.
@@ -70,22 +76,44 @@ function Initialize-SQLite {
$script:Triplet = "$arch-windows-static-md" $script:Triplet = "$arch-windows-static-md"
} }
$root = $VcpkgRoot # `%LOCALAPPDATA%\vcpkg` is NOT a candidate install root, and must never be a clone target:
if (-not $root) { $root = $env:VCPKG_INSTALLATION_ROOT } # that path is vcpkg's own per-user DATA directory (registries, downloads, and the
if (-not $root -or -not (Test-Path (Join-Path $root 'vcpkg.exe'))) { # `vcpkg.path.txt` breadcrumb naming the real root), so it exists — non-empty, no `.git` —
$root = Join-Path $env:LOCALAPPDATA 'vcpkg' # on any machine where vcpkg has merely *run* once. Cloning into it fails with "destination
} # path already exists and is not an empty directory". We only ever read it, for that
# breadcrumb; a clone of our own goes to the conventional per-user install location.
$breadcrumb = Join-Path $env:LOCALAPPDATA 'vcpkg\vcpkg.path.txt'
$known = @(
$VcpkgRoot
$env:VCPKG_INSTALLATION_ROOT
$(if (Test-Path $breadcrumb) { (Get-Content $breadcrumb -Raw).Trim() })
(Join-Path $env:LOCALAPPDATA 'Programs\vcpkg')
(Join-Path $env:USERPROFILE 'vcpkg')
'C:\vcpkg'
)
$root = $known | Where-Object { $_ -and (Test-Path (Join-Path $_ 'vcpkg.exe')) } | Select-Object -First 1
if (-not (Test-Path (Join-Path $root '.git'))) { if (-not $root) {
Write-Step "Cloning vcpkg to $root (one time)" # Nothing usable found. Clone into the per-user install location — unless the caller
git clone --depth 1 https://github.com/microsoft/vcpkg $root | Out-Host # named a root, in which case honour it (they may be pointing at a fresh directory).
if ($LASTEXITCODE -ne 0) { throw "vcpkg clone failed" } $root = if ($VcpkgRoot) { $VcpkgRoot } else { Join-Path $env:LOCALAPPDATA 'Programs\vcpkg' }
} if (-not (Test-Path (Join-Path $root '.git'))) {
if (-not (Test-Path (Join-Path $root 'vcpkg.exe'))) { # `git clone` refuses a non-empty destination, and the resulting error says nothing
# about what to do — so diagnose it here, where the remedy is known.
if ((Test-Path $root) -and (Get-ChildItem $root -Force | Select-Object -First 1)) {
throw ("$root exists, is not empty, and holds neither vcpkg.exe nor a git " +
"checkout. Point the script at your vcpkg with -VcpkgRoot <path>, or " +
"remove that directory.")
}
Write-Step "Cloning vcpkg to $root (one time)"
git clone --depth 1 https://github.com/microsoft/vcpkg $root | Out-Host
if ($LASTEXITCODE -ne 0) { throw "vcpkg clone failed" }
}
Write-Step 'Bootstrapping vcpkg (one time)' Write-Step 'Bootstrapping vcpkg (one time)'
& (Join-Path $root 'bootstrap-vcpkg.bat') -disableMetrics | Out-Host & (Join-Path $root 'bootstrap-vcpkg.bat') -disableMetrics | Out-Host
if ($LASTEXITCODE -ne 0) { throw "vcpkg bootstrap failed" } if ($LASTEXITCODE -ne 0) { throw "vcpkg bootstrap failed" }
} }
Write-Note "vcpkg root: $root"
$prefix = Join-Path $root "installed\$Triplet" $prefix = Join-Path $root "installed\$Triplet"
if (-not (Test-Path (Join-Path $prefix 'include\sqlite3.h'))) { if (-not (Test-Path (Join-Path $prefix 'include\sqlite3.h'))) {