From 1a1e0c245f208487dbec1ffda11c4ca0912e1610 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Thu, 11 May 2023 09:22:13 +0200 Subject: [PATCH] contrib: make the Xcode archive configurable for MacOS builds --- contrib/reproducible/docker/docker-build.sh | 11 +++++++---- contrib/reproducible/docker/macos_cmd.sh | 10 ++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/contrib/reproducible/docker/docker-build.sh b/contrib/reproducible/docker/docker-build.sh index 6c86dc5b..6a47f2c3 100755 --- a/contrib/reproducible/docker/docker-build.sh +++ b/contrib/reproducible/docker/docker-build.sh @@ -5,6 +5,8 @@ set -ex TARGET_DIR="${TARGET_DIR:-"$PWD/deter_build_target"}" XCODE_PATH="${XCODE_PATH:-"$PWD/Xcode_12.2.xip"}" +XCODE_FILENAME="$(basename $XCODE_PATH)" +XCODE_SHASUM="28d352f8c14a43d9b8a082ac6338dc173cb153f964c6e8fb6ba389e5be528bd0" # Build (only) the Liana GUI on Windows. docker build . -t liana_cross_win -f contrib/reproducible/docker/windows.Dockerfile @@ -22,14 +24,14 @@ docker run --rm -ti \ # Sanity check the given MacOS SDK is the expected one. -if ! $(echo "28d352f8c14a43d9b8a082ac6338dc173cb153f964c6e8fb6ba389e5be528bd0 $(basename $XCODE_PATH)" | sha256sum -c --status); then - echo "No or invalid Xcode SDK found. Need an Xcode_12.2.xip. You can configure the path using \$XCODE_PATH."; +if ! $(echo "$XCODE_SHASUM $(basename $XCODE_PATH)" | sha256sum -c --status); then + echo "No or invalid Xcode SDK found. Need an Xcode_X.Y.xip archive whose hash is $XCODE_SHASUM. You can configure the path using \$XCODE_PATH."; exit 1; fi # Build both the Liana daemon and GUI on MacOS. docker build . -t liana_cross_mac -f contrib/reproducible/docker/macos.Dockerfile -docker run --rm -ti \ +docker run -ti \ -v "$TARGET_DIR":/liana/target \ -v "$TARGET_DIR/gui":/liana/gui/target \ -v "$PWD/contrib/reproducible/docker":/liana/docker \ @@ -43,7 +45,8 @@ docker run --rm -ti \ -v "$PWD/gui/ui/Cargo.lock":/liana/gui/ui/Cargo.lock \ -v "$PWD/gui/ui/src":/liana/gui/ui/src \ -v "$PWD/gui/ui/static":/liana/gui/ui/static \ - -v "$XCODE_PATH":/liana/Xcode_12.2.xip \ + -v "$XCODE_PATH":"/liana/$XCODE_FILENAME" \ + -e XCODE_PATH="/liana/$XCODE_FILENAME" \ liana_cross_mac set +ex diff --git a/contrib/reproducible/docker/macos_cmd.sh b/contrib/reproducible/docker/macos_cmd.sh index d5935a11..e35fa7ec 100755 --- a/contrib/reproducible/docker/macos_cmd.sh +++ b/contrib/reproducible/docker/macos_cmd.sh @@ -6,8 +6,10 @@ set -xe -# Build the SDK and the toolchain using osxcross. It is expected to be located at /liana/Xcode_12.2.xip. -# It's not part of the image to be able to share the Xcode_12.2.xip instead of copying it in the Docker context +test -f "$XCODE_PATH" || exit 1 + +# Build the SDK and the toolchain using osxcross. It is expected to be located at $XCODE_PATH +# It's not part of the image to be able to share the $XCODE_PATH instead of copying it in the Docker context # and then to the image. git clone https://github.com/darosior/osxcross -b dependencies_pinning cd osxcross @@ -15,8 +17,8 @@ git checkout 50e86ebca7d14372febd0af8cd098705049161b9 DARLING_DMG_REVISION=241238313a47d3cf6427ac5a75b7a0311a3a4cb4 \ P7ZIP_REVISION=2f60a51ac3aa2507d36df3c4f58f71a3716b1357 \ PBZX_REVISION=2a4d7c3300c826d918def713a24d25c237c8ed53 \ - XAR_REVISION=c2111a9a9cabc50d2b9c604aff41a481ae3f1989 ./tools/gen_sdk_package_pbzx.sh ../Xcode_12.2.xip -mv MacOSX11.0.sdk.tar.xz tarballs/ + XAR_REVISION=c2111a9a9cabc50d2b9c604aff41a481ae3f1989 ./tools/gen_sdk_package_pbzx.sh "$XCODE_PATH" +mv MacOSX* tarballs/ DARLING_DMG_REVISION=241238313a47d3cf6427ac5a75b7a0311a3a4cb4 \ P7ZIP_REVISION=2f60a51ac3aa2507d36df3c4f58f71a3716b1357 \ PBZX_REVISION=2a4d7c3300c826d918def713a24d25c237c8ed53 \