Skip to content

Commit

Permalink
Fix fetching fmt from Terapin, including containers (#421)
Browse files Browse the repository at this point in the history
* Use the tarball to get fmt and wire up consistently to Terrapin.

* Fix alpine?

* Fix Windows.
  • Loading branch information
BillyONeal authored Mar 8, 2022
1 parent 0224b8d commit 85dc3d9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 60 deletions.
62 changes: 5 additions & 57 deletions azure-pipelines/signing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ variables:
- group: vcpkg-dependency-source-blobs
- name: FMT_TARBALL_URL
value: "$(fmt-tarball-url)"
- name: FMT_TARBALL_SHA
value: "$(fmt-tarball-sha)"
- name: FMT_TARBALL_DIRNAME
value: "$(fmt-tarball-dirname)"
# If the user didn't override the signing type, then only real-sign on main.
- ${{ if ne(parameters.SignTypeOverride, 'default') }}:
- name: SignType
Expand Down Expand Up @@ -189,22 +185,12 @@ jobs:
VCPKG_CE_SHA: $[ dependencies.arch_independent.outputs['shas.VCPKG_CE_SHA'] ]
VCPKG_BASE_VERSION: $[ dependencies.arch_independent.outputs['versions.VCPKG_BASE_VERSION'] ]
steps:
- task: CmdLine@2
displayName: "Download fmt library"
inputs:
failOnStderr: true
workingDirectory: "$(Build.BinariesDirectory)"
script: |
curl -sSL "$FMT_TARBALL_URL" --output ./fmtlib.tar.gz
printf "$FMT_TARBALL_SHA *./fmtlib.tar.gz\n" >checksum
shasum -c ./checksum -a 512 || exit 1
tar -xf ./fmtlib.tar.gz
- task: CmdLine@2
displayName: "Build vcpkg with CMake"
inputs:
failOnStderr: true
script: |
cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -DVCPKG_EMBED_GIT_SHA=ON -DVCPKG_OFFICIAL_BUILD=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DFETCHCONTENT_FULLY_DISCONNECTED=ON "-DFETCHCONTENT_SOURCE_DIR_FMT=$(Build.BinariesDirectory)/$FMT_TARBALL_DIRNAME" -DVCPKG_BASE_VERSION=$VCPKG_BASE_VERSION -DVCPKG_STANDALONE_BUNDLE_SHA=$VCPKG_STANDALONE_BUNDLE_SHA -DVCPKG_CE_SHA=$VCPKG_CE_SHA -B "$(Build.BinariesDirectory)/build"
cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -DVCPKG_EMBED_GIT_SHA=ON -DVCPKG_OFFICIAL_BUILD=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" "-DVCPKG_FMT_URL=$FMT_TARBALL_URL" -DVCPKG_BASE_VERSION=$VCPKG_BASE_VERSION -DVCPKG_STANDALONE_BUNDLE_SHA=$VCPKG_STANDALONE_BUNDLE_SHA -DVCPKG_CE_SHA=$VCPKG_CE_SHA -B "$(Build.BinariesDirectory)/build"
make -j 8 -C "$(Build.BinariesDirectory)/build"
zip -j "$(Build.ArtifactStagingDirectory)/vcpkg-macos.zip" "$(Build.BinariesDirectory)/build/vcpkg"
- task: PublishBuildArtifacts@1
Expand All @@ -223,23 +209,12 @@ jobs:
VCPKG_CE_SHA: $[ dependencies.arch_independent.outputs['shas.VCPKG_CE_SHA'] ]
VCPKG_BASE_VERSION: $[ dependencies.arch_independent.outputs['versions.VCPKG_BASE_VERSION'] ]
steps:
- task: CmdLine@2
displayName: "Download fmt library"
inputs:
failOnStderr: true
workingDirectory: "$(Build.BinariesDirectory)"
script: |
curl -sSL "$FMT_TARBALL_URL" --output "./fmtlib.tar.gz"
printf "$FMT_TARBALL_SHA *./fmtlib.tar.gz\n" >checksum
# shasum doesn't exist on rhel
sha512sum -c ./checksum || exit 1
tar -xf ./fmtlib.tar.gz
- task: CmdLine@2
displayName: "Build vcpkg with CMake"
inputs:
failOnStderr: true
script: |
scl enable devtoolset-9 'cmake3 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -DVCPKG_EMBED_GIT_SHA=ON -DVCPKG_OFFICIAL_BUILD=ON -DCMAKE_CXX_FLAGS="-static-libgcc -static-libstdc++" -DFETCHCONTENT_FULLY_DISCONNECTED=ON "-DFETCHCONTENT_SOURCE_DIR_FMT=$(Build.BinariesDirectory)/$FMT_TARBALL_DIRNAME" -DVCPKG_BASE_VERSION=$VCPKG_BASE_VERSION -DVCPKG_STANDALONE_BUNDLE_SHA=$VCPKG_STANDALONE_BUNDLE_SHA -DVCPKG_CE_SHA=$VCPKG_CE_SHA -B "$(Build.BinariesDirectory)/build"'
scl enable devtoolset-9 'cmake3 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -DVCPKG_EMBED_GIT_SHA=ON -DVCPKG_OFFICIAL_BUILD=ON -DCMAKE_CXX_FLAGS="-static-libgcc -static-libstdc++" "-DVCPKG_FMT_URL=$FMT_TARBALL_URL" -DVCPKG_BASE_VERSION=$VCPKG_BASE_VERSION -DVCPKG_STANDALONE_BUNDLE_SHA=$VCPKG_STANDALONE_BUNDLE_SHA -DVCPKG_CE_SHA=$VCPKG_CE_SHA -B "$(Build.BinariesDirectory)/build"'
make -j 4 -C "$(Build.BinariesDirectory)/build"
mv "$(Build.BinariesDirectory)/build/vcpkg" "$(Build.ArtifactStagingDirectory)/vcpkg-glibc"
- task: PublishBuildArtifacts@1
Expand All @@ -258,23 +233,12 @@ jobs:
VCPKG_CE_SHA: $[ dependencies.arch_independent.outputs['shas.VCPKG_CE_SHA'] ]
VCPKG_BASE_VERSION: $[ dependencies.arch_independent.outputs['versions.VCPKG_BASE_VERSION'] ]
steps:
- task: CmdLine@2
displayName: "Download fmt library"
inputs:
failOnStderr: true
workingDirectory: "$(Build.BinariesDirectory)"
script: |
curl -sSL "$FMT_TARBALL_URL" --output "./fmtlib.tar.gz"
printf "$FMT_TARBALL_SHA *./fmtlib.tar.gz\n" >checksum
shasum -c ./checksum -a 512 || exit 1
tar -xf ./fmtlib.tar.gz
- task: CmdLine@2
displayName: "Build vcpkg in Alpine"
inputs:
failOnStderr: true
script: |
mv "$(Build.BinariesDirectory)/$FMT_TARBALL_DIRNAME" external-fmtlib
docker build -t vcpkg-muslc-image -f azure-pipelines/vcpkg-alpine/Dockerfile .
docker build --build-arg "VCPKG_FMT_URL=$FMT_TARBALL_URL" -t vcpkg-muslc-image -f azure-pipelines/vcpkg-alpine/Dockerfile .
docker create -ti --name vcpkg-muslc-container vcpkg-muslc-image sh
docker cp vcpkg-muslc-container:/build/vcpkg "$(Build.ArtifactStagingDirectory)/vcpkg-muslc"
docker container rm vcpkg-muslc-container
Expand All @@ -298,30 +262,14 @@ jobs:
VCPKG_CE_SHA: $[ dependencies.arch_independent.outputs['shas.VCPKG_CE_SHA'] ]
VCPKG_BASE_VERSION: $[ dependencies.arch_independent.outputs['versions.VCPKG_BASE_VERSION'] ]
steps:
- task: PowerShell@2
displayName: "Download fmt library"
inputs:
targetType: 'inline'
pwsh: true
failOnStderr: true
workingDirectory: "$(Build.BinariesDirectory)"
script: |
curl.exe -sSL "$env:FMT_TARBALL_URL" --output ./fmtlib.tar.gz
$hash = (Get-FileHash -Algorithm SHA512 -Path ./fmtlib.tar.gz).Hash
if ($hash -ne "$env:FMT_TARBALL_SHA") {
throw "Unexpected hash for fmtlib download;
expected: $env:FMT_TARBALL_SHA
found : $hash"
}
tar.exe -xf ./fmtlib.tar.gz
- task: CmdLine@2
displayName: "Build vcpkg x86 with CMake"
inputs:
failOnStderr: true
script: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x86 -host_arch=x86
cmake.exe --version
cmake.exe -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -DVCPKG_BUILD_TLS12_DOWNLOADER=ON -DVCPKG_EMBED_GIT_SHA=ON -DVCPKG_OFFICIAL_BUILD=ON -DFETCHCONTENT_FULLY_DISCONNECTED=ON "-DFETCHCONTENT_SOURCE_DIR_FMT=$(Build.BinariesDirectory)\%FMT_TARBALL_DIRNAME%" -DVCPKG_BASE_VERSION=%VCPKG_BASE_VERSION% -DVCPKG_STANDALONE_BUNDLE_SHA=%VCPKG_STANDALONE_BUNDLE_SHA% -DVCPKG_CE_SHA=%VCPKG_CE_SHA% -B "$(Build.BinariesDirectory)\x86"
cmake.exe -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -DVCPKG_BUILD_TLS12_DOWNLOADER=ON -DVCPKG_EMBED_GIT_SHA=ON -DVCPKG_OFFICIAL_BUILD=ON "-DVCPKG_FMT_URL=%FMT_TARBALL_URL%" -DVCPKG_BASE_VERSION=%VCPKG_BASE_VERSION% -DVCPKG_STANDALONE_BUNDLE_SHA=%VCPKG_STANDALONE_BUNDLE_SHA% -DVCPKG_CE_SHA=%VCPKG_CE_SHA% -B "$(Build.BinariesDirectory)\x86"
ninja.exe -C "$(Build.BinariesDirectory)\x86"
- task: CmdLine@2
displayName: "Build vcpkg arm64 with CMake"
Expand All @@ -330,7 +278,7 @@ jobs:
script: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=arm64 -host_arch=x86
cmake.exe --version
cmake.exe -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -DVCPKG_BUILD_TLS12_DOWNLOADER=ON -DVCPKG_EMBED_GIT_SHA=ON -DVCPKG_OFFICIAL_BUILD=ON -DVCPKG_PDB_SUFFIX="-arm64" -DFETCHCONTENT_FULLY_DISCONNECTED=ON "-DFETCHCONTENT_SOURCE_DIR_FMT=$(Build.BinariesDirectory)\%FMT_TARBALL_DIRNAME%" -DVCPKG_BASE_VERSION=%VCPKG_BASE_VERSION% -DVCPKG_STANDALONE_BUNDLE_SHA=%VCPKG_STANDALONE_BUNDLE_SHA% -DVCPKG_CE_SHA=%VCPKG_CE_SHA% -B "$(Build.BinariesDirectory)\arm64"
cmake.exe -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -DVCPKG_BUILD_TLS12_DOWNLOADER=ON -DVCPKG_EMBED_GIT_SHA=ON -DVCPKG_OFFICIAL_BUILD=ON -DVCPKG_PDB_SUFFIX="-arm64" "-DVCPKG_FMT_URL=%FMT_TARBALL_URL%" -DVCPKG_BASE_VERSION=%VCPKG_BASE_VERSION% -DVCPKG_STANDALONE_BUNDLE_SHA=%VCPKG_STANDALONE_BUNDLE_SHA% -DVCPKG_CE_SHA=%VCPKG_CE_SHA% -B "$(Build.BinariesDirectory)\arm64"
ninja.exe -C "$(Build.BinariesDirectory)\arm64"
- task: MicroBuildSigningPlugin@3
displayName: Install MicroBuild Signing
Expand Down
4 changes: 3 additions & 1 deletion azure-pipelines/vcpkg-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ RUN apk add alpine-sdk cmake ninja git curl tar gzip zip

COPY . /source

RUN cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -DVCPKG_EMBED_GIT_SHA=OFF -DCMAKE_CXX_FLAGS="-static -s -static-libgcc -static-libstdc++" -DFETCHCONTENT_FULLY_DISCONNECTED=ON -DFETCHCONTENT_SOURCE_DIR_FMT=/source/external-fmtlib -S /source -B /build
ARG VCPKG_FMT_URL

RUN cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -DVCPKG_EMBED_GIT_SHA=OFF -DCMAKE_CXX_FLAGS="-static -s -static-libgcc -static-libstdc++" "-DVCPKG_FMT_URL=$VCPKG_FMT_URL" -S /source -B /build

RUN ninja -C build
5 changes: 3 additions & 2 deletions cmake/Findfmt.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
option(VCPKG_DEPENDENCY_EXTERNAL_FMT "Use an external version of the fmt library" OFF)
set(VCPKG_FMT_URL "https://github.com/fmtlib/fmt/archive/refs/tags/8.1.1.tar.gz" CACHE STRING "URL to the fmt release tarball to use.")

include(FetchContent)
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt
GIT_TAG b6f4ceaed0a0a24ccf575fab6c56dd50ccf6f1a9 # 8.1.1
URL "${VCPKG_FMT_URL}"
URL_HASH SHA512=794a47d7cb352a2a9f2c050a60a46b002e4157e5ad23e15a5afc668e852b1e1847aeee3cda79e266c789ff79310d792060c94976ceef6352e322d60b94e23189
)

if(NOT fmt_FIND_REQUIRED)
Expand Down

0 comments on commit 85dc3d9

Please sign in to comment.