x86_64-linux-release.sh (3213B) - Raw
1 #!/bin/sh 2 3 # Requires cmake ninja-build 4 5 set -x 6 set -e 7 8 ARCH="$(uname -m)" 9 TARGET="$ARCH-linux-musl" 10 MCPU="baseline" 11 CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.15.0-dev.233+7c85dc460" 12 PREFIX="$HOME/deps/$CACHE_BASENAME" 13 ZIG="$PREFIX/bin/zig" 14 15 export PATH="$HOME/deps/wasmtime-v29.0.0-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-10.0.2/bin:$HOME/local/bin:$PATH" 16 17 # Make the `zig version` number consistent. 18 # This will affect the cmake command below. 19 git fetch --unshallow || true 20 git fetch --tags 21 22 # Override the cache directories because they won't actually help other CI runs 23 # which will be testing alternate versions of zig, and ultimately would just 24 # fill up space on the hard drive for no reason. 25 export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" 26 export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" 27 28 # Test building from source without LLVM. 29 cc -o bootstrap bootstrap.c 30 ./bootstrap 31 ./zig2 build -Dno-lib 32 ./zig-out/bin/zig test test/behavior.zig 33 34 mkdir build-release 35 cd build-release 36 37 export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" 38 export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" 39 40 cmake .. \ 41 -DCMAKE_INSTALL_PREFIX="stage3-release" \ 42 -DCMAKE_PREFIX_PATH="$PREFIX" \ 43 -DCMAKE_BUILD_TYPE=Release \ 44 -DZIG_TARGET_TRIPLE="$TARGET" \ 45 -DZIG_TARGET_MCPU="$MCPU" \ 46 -DZIG_STATIC=ON \ 47 -DZIG_NO_LIB=ON \ 48 -GNinja 49 50 # Now cmake will use zig as the C/C++ compiler. We reset the environment variables 51 # so that installation and testing do not get affected by them. 52 unset CC 53 unset CXX 54 55 ninja install 56 57 # simultaneously test building self-hosted without LLVM and with 32-bit arm 58 stage3-release/bin/zig build \ 59 -Dtarget=arm-linux-musleabihf \ 60 -Dno-lib 61 62 stage3-release/bin/zig build test docs \ 63 --maxrss 21000000000 \ 64 -Dlldb=$HOME/deps/lldb-zig/Release-e0a42bb34/bin/lldb \ 65 -fqemu \ 66 -fwasmtime \ 67 -Dstatic-llvm \ 68 -Dtarget=native-native-musl \ 69 --search-prefix "$PREFIX" \ 70 --zig-lib-dir "$PWD/../lib" \ 71 -Denable-superhtml 72 73 # Ensure that stage3 and stage4 are byte-for-byte identical. 74 stage3-release/bin/zig build \ 75 --prefix stage4-release \ 76 -Denable-llvm \ 77 -Dno-lib \ 78 -Doptimize=ReleaseFast \ 79 -Dstrip \ 80 -Dtarget=$TARGET \ 81 -Duse-zig-libcxx \ 82 -Dversion-string="$(stage3-release/bin/zig version)" 83 84 # diff returns an error code if the files differ. 85 echo "If the following command fails, it means nondeterminism has been" 86 echo "introduced, making stage3 and stage4 no longer byte-for-byte identical." 87 diff stage3-release/bin/zig stage4-release/bin/zig 88 89 # Ensure that updating the wasm binary from this commit will result in a viable build. 90 stage3-release/bin/zig build update-zig1 91 92 mkdir ../build-new 93 cd ../build-new 94 95 export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" 96 export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" 97 98 cmake .. \ 99 -DCMAKE_PREFIX_PATH="$PREFIX" \ 100 -DCMAKE_BUILD_TYPE=Release \ 101 -DZIG_TARGET_TRIPLE="$TARGET" \ 102 -DZIG_TARGET_MCPU="$MCPU" \ 103 -DZIG_STATIC=ON \ 104 -DZIG_NO_LIB=ON \ 105 -GNinja 106 107 unset CC 108 unset CXX 109 110 ninja install 111 112 stage3/bin/zig test ../test/behavior.zig 113 stage3/bin/zig build -p stage4 \ 114 -Dstatic-llvm \ 115 -Dtarget=native-native-musl \ 116 -Dno-lib \ 117 --search-prefix "$PREFIX" \ 118 --zig-lib-dir "$PWD/../lib" 119 stage4/bin/zig test ../test/behavior.zig