aarch64-macos-release.sh (2022B) - Raw
1 #!/bin/sh 2 3 set -x 4 set -e 5 6 # Script assumes the presence of the following: 7 # s3cmd 8 9 ZIGDIR="$PWD" 10 TARGET="$ARCH-macos-none" 11 MCPU="baseline" 12 CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.15.0-dev.233+7c85dc460" 13 PREFIX="$HOME/$CACHE_BASENAME" 14 ZIG="$PREFIX/bin/zig" 15 16 if [ ! -d "$PREFIX" ]; then 17 cd $HOME 18 curl -L -O "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz" 19 tar xf "$CACHE_BASENAME.tar.xz" 20 fi 21 22 cd $ZIGDIR 23 24 # Make the `zig version` number consistent. 25 # This will affect the cmake command below. 26 git fetch --unshallow || true 27 git fetch --tags 28 29 # Override the cache directories because they won't actually help other CI runs 30 # which will be testing alternate versions of zig, and ultimately would just 31 # fill up space on the hard drive for no reason. 32 export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" 33 export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" 34 35 mkdir build-release 36 cd build-release 37 38 PATH="$HOME/local/bin:$PATH" cmake .. \ 39 -DCMAKE_INSTALL_PREFIX="stage3-release" \ 40 -DCMAKE_PREFIX_PATH="$PREFIX" \ 41 -DCMAKE_BUILD_TYPE=Release \ 42 -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \ 43 -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \ 44 -DZIG_TARGET_TRIPLE="$TARGET" \ 45 -DZIG_TARGET_MCPU="$MCPU" \ 46 -DZIG_STATIC=ON \ 47 -DZIG_NO_LIB=ON \ 48 -GNinja 49 50 $HOME/local/bin/ninja install 51 52 stage3-release/bin/zig build test docs \ 53 --zig-lib-dir "$PWD/../lib" \ 54 -Denable-macos-sdk \ 55 -Dstatic-llvm \ 56 -Dskip-non-native \ 57 --search-prefix "$PREFIX" 58 59 # Ensure that stage3 and stage4 are byte-for-byte identical. 60 stage3-release/bin/zig build \ 61 --prefix stage4-release \ 62 -Denable-llvm \ 63 -Dno-lib \ 64 -Doptimize=ReleaseFast \ 65 -Dstrip \ 66 -Dtarget=$TARGET \ 67 -Duse-zig-libcxx \ 68 -Dversion-string="$(stage3-release/bin/zig version)" 69 70 # diff returns an error code if the files differ. 71 echo "If the following command fails, it means nondeterminism has been" 72 echo "introduced, making stage3 and stage4 no longer byte-for-byte identical." 73 diff stage3-release/bin/zig stage4-release/bin/zig