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