mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 02:11:58 +08:00
Simplify insertion of vcpkg-tool release (#32677)
This commit is contained in:
parent
01793b4fca
commit
151c42c5f4
@ -45,7 +45,10 @@ while (!($vcpkgRootDir -eq "") -and !(Test-Path "$vcpkgRootDir\.vcpkg-root"))
|
||||
|
||||
Write-Verbose "Examining $vcpkgRootDir for .vcpkg-root - Found"
|
||||
|
||||
$versionDate = '2023-07-19'
|
||||
# Read the vcpkg-tool config file to determine what release to download
|
||||
$Config = ConvertFrom-StringData (Get-Content "$PSScriptRoot\vcpkg-tool-metadata.txt" -Raw)
|
||||
$versionDate = $Config.VCPKG_TOOL_RELEASE_TAG
|
||||
|
||||
if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64' -or $env:PROCESSOR_IDENTIFIER -match "ARMv[8,9] \(64-bit\)") {
|
||||
& "$scriptsDir/tls12-download-arm64.exe" github.com "/microsoft/vcpkg-tool/releases/download/$versionDate/vcpkg-arm64.exe" "$vcpkgRootDir\vcpkg.exe"
|
||||
} else {
|
||||
@ -60,6 +63,8 @@ if ($LASTEXITCODE -ne 0)
|
||||
throw
|
||||
}
|
||||
|
||||
& "$vcpkgRootDir\vcpkg.exe" version
|
||||
|
||||
if ($disableMetrics)
|
||||
{
|
||||
Set-Content -Value "" -Path "$vcpkgRootDir\vcpkg.disable-metrics" -Force
|
||||
|
@ -118,36 +118,6 @@ if [ "$vcpkgUseSystem" = "ON" ]; then
|
||||
vcpkgCheckRepoTool gcc
|
||||
fi
|
||||
|
||||
# Determine what we are going to do to bootstrap:
|
||||
# MacOS -> Download vcpkg-macos
|
||||
# Linux
|
||||
# useMuslC -> download vcpkg-muslc
|
||||
# amd64 -> download vcpkg-glibc
|
||||
# Otherwise
|
||||
# Download and build from source
|
||||
|
||||
# Choose the vcpkg binary to download
|
||||
vcpkgDownloadTool="ON"
|
||||
vcpkgToolReleaseTag="2023-07-19"
|
||||
if [ "$UNAME" = "Darwin" ]; then
|
||||
echo "Downloading vcpkg-macos..."
|
||||
vcpkgToolReleaseSha="57a39cf5ba4cea55847995fe748f569c9908c84e9edeab0a8c7a8e80d5bed6e981149172aabbdb1cf458deef74e883fc5b8c9781f6a59b723f8618c6045c2391"
|
||||
vcpkgToolName="vcpkg-macos"
|
||||
elif [ "$vcpkgUseMuslC" = "ON" ]; then
|
||||
echo "Downloading vcpkg-muslc..."
|
||||
vcpkgToolReleaseSha="a24c2f06bf4129892e5ae1dafbec692cbdd5483aae101b2a98632a5cc63ac95458943714b1a22072962fcbcb83d08ef37efa65f4b4cf2311b9e7d541c98276ea"
|
||||
vcpkgToolName="vcpkg-muslc"
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
echo "Downloading vcpkg-glibc..."
|
||||
vcpkgToolReleaseSha="2338c759b14257f0167202886080bc872a6ea2578b27b034d2432b209e99d81e8d37f4a1ce215e5d4875648a89ff5bc9bfb560b824c87163572233262d5581c5"
|
||||
vcpkgToolName="vcpkg-glibc"
|
||||
else
|
||||
echo "Unable to determine a binary release of vcpkg; attempting to build from source."
|
||||
vcpkgDownloadTool="OFF"
|
||||
vcpkgToolReleaseSha="9381e91e457c2efc69cbaad1354b06bb540689e95f86f5c883cfbd6f5f05b5511a92c349b4d0d090a09b4a31197327c559737fb84375a4c23d4cb92049ecf73c"
|
||||
fi
|
||||
|
||||
# Do the download or build.
|
||||
vcpkgCheckEqualFileHash()
|
||||
{
|
||||
url=$1; filePath=$2; expectedHash=$3
|
||||
@ -193,8 +163,39 @@ vcpkgExtractTar()
|
||||
mv "$toPath.partial" "$toPath"
|
||||
}
|
||||
|
||||
# Determine what we are going to do to bootstrap:
|
||||
# MacOS -> Download vcpkg-macos
|
||||
# Linux
|
||||
# useMuslC -> download vcpkg-muslc
|
||||
# amd64 -> download vcpkg-glibc
|
||||
# Otherwise
|
||||
# Download and build from source
|
||||
|
||||
# Read the vcpkg-tool config file to determine what release to download
|
||||
. "$vcpkgRootDir/scripts/vcpkg-tool-metadata.txt"
|
||||
|
||||
vcpkgDownloadTool="ON"
|
||||
if [ "$UNAME" = "Darwin" ]; then
|
||||
echo "Downloading vcpkg-macos..."
|
||||
vcpkgToolReleaseSha=$VCPKG_MACOS_SHA
|
||||
vcpkgToolName="vcpkg-macos"
|
||||
elif [ "$vcpkgUseMuslC" = "ON" ]; then
|
||||
echo "Downloading vcpkg-muslc..."
|
||||
vcpkgToolReleaseSha=$VCPKG_MUSLC_SHA
|
||||
vcpkgToolName="vcpkg-muslc"
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
echo "Downloading vcpkg-glibc..."
|
||||
vcpkgToolReleaseSha=$VCPKG_GLIBC_SHA
|
||||
vcpkgToolName="vcpkg-glibc"
|
||||
else
|
||||
echo "Unable to determine a binary release of vcpkg; attempting to build from source."
|
||||
vcpkgDownloadTool="OFF"
|
||||
vcpkgToolReleaseSha=$VCPKG_TOOL_SOURCE_SHA
|
||||
fi
|
||||
|
||||
# Do the download or build.
|
||||
if [ "$vcpkgDownloadTool" = "ON" ]; then
|
||||
vcpkgDownloadFile "https://github.com/microsoft/vcpkg-tool/releases/download/$vcpkgToolReleaseTag/$vcpkgToolName" "$vcpkgRootDir/vcpkg" $vcpkgToolReleaseSha
|
||||
vcpkgDownloadFile "https://github.com/microsoft/vcpkg-tool/releases/download/$VCPKG_TOOL_RELEASE_TAG/$vcpkgToolName" "$vcpkgRootDir/vcpkg" $vcpkgToolReleaseSha
|
||||
else
|
||||
if [ "x$CXX" = "x" ]; then
|
||||
if which g++-12 >/dev/null 2>&1; then
|
||||
@ -217,13 +218,13 @@ else
|
||||
# If we can't find g++, allow CMake to do the look-up
|
||||
fi
|
||||
|
||||
vcpkgToolReleaseTarball="$vcpkgToolReleaseTag.tar.gz"
|
||||
vcpkgToolReleaseTarball="$VCPKG_TOOL_RELEASE_TAG.tar.gz"
|
||||
vcpkgToolUrl="https://github.com/microsoft/vcpkg-tool/archive/$vcpkgToolReleaseTarball"
|
||||
baseBuildDir="$vcpkgRootDir/buildtrees/_vcpkg"
|
||||
buildDir="$baseBuildDir/build"
|
||||
tarballPath="$downloadsDir/$vcpkgToolReleaseTarball"
|
||||
srcBaseDir="$baseBuildDir/src"
|
||||
srcDir="$srcBaseDir/vcpkg-tool-$vcpkgToolReleaseTag"
|
||||
srcDir="$srcBaseDir/vcpkg-tool-$VCPKG_TOOL_RELEASE_TAG"
|
||||
|
||||
if [ -e "$tarballPath" ]; then
|
||||
vcpkgCheckEqualFileHash "$vcpkgToolUrl" "$tarballPath" "$vcpkgToolReleaseSha"
|
||||
@ -249,6 +250,8 @@ else
|
||||
cp "$buildDir/vcpkg" "$vcpkgRootDir/"
|
||||
fi
|
||||
|
||||
"$vcpkgRootDir/vcpkg" version
|
||||
|
||||
# Apply the disable-metrics marker file.
|
||||
if [ "$vcpkgDisableMetrics" = "ON" ]; then
|
||||
touch "$vcpkgRootDir/vcpkg.disable-metrics"
|
||||
|
5
scripts/vcpkg-tool-metadata.txt
Normal file
5
scripts/vcpkg-tool-metadata.txt
Normal file
@ -0,0 +1,5 @@
|
||||
VCPKG_TOOL_RELEASE_TAG=2023-07-19
|
||||
VCPKG_MACOS_SHA=57a39cf5ba4cea55847995fe748f569c9908c84e9edeab0a8c7a8e80d5bed6e981149172aabbdb1cf458deef74e883fc5b8c9781f6a59b723f8618c6045c2391
|
||||
VCPKG_MUSLC_SHA=a24c2f06bf4129892e5ae1dafbec692cbdd5483aae101b2a98632a5cc63ac95458943714b1a22072962fcbcb83d08ef37efa65f4b4cf2311b9e7d541c98276ea
|
||||
VCPKG_GLIBC_SHA=2338c759b14257f0167202886080bc872a6ea2578b27b034d2432b209e99d81e8d37f4a1ce215e5d4875648a89ff5bc9bfb560b824c87163572233262d5581c5
|
||||
VCPKG_TOOL_SOURCE_SHA=9381e91e457c2efc69cbaad1354b06bb540689e95f86f5c883cfbd6f5f05b5511a92c349b4d0d090a09b4a31197327c559737fb84375a4c23d4cb92049ecf73c
|
Loading…
x
Reference in New Issue
Block a user