| 1 | #!/bin/sh |
| 2 | |
| 3 | # Requires cmake ninja-build |
| 4 | |
| 5 | set -x |
| 6 | set -e |
| 7 | |
| 8 | TARGET="x86_64-linux-musl" |
| 9 | MCPU="baseline" |
| 10 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523" |
| 11 | PREFIX="$HOME/deps/$CACHE_BASENAME" |
| 12 | ZIG="$PREFIX/bin/zig" |
| 13 | |
| 14 | export PATH="$HOME/deps/wasmtime-v46.0.1-x86_64-linux:$HOME/deps/qemu-linux-x86_64-11.1.1/bin:$HOME/local/bin:$PATH" |
| 15 | |
| 16 | # Override the cache directories because they won't actually help other CI runs |
| 17 | # which will be testing alternate versions of zig, and ultimately would just |
| 18 | # fill up space on the hard drive for no reason. |
| 19 | export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" |
| 20 | export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" |
| 21 | |
| 22 | mkdir build-debug-llvm |
| 23 | cd build-debug-llvm |
| 24 | |
| 25 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" |
| 26 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" |
| 27 | |
| 28 | cmake .. \ |
| 29 | -DCMAKE_INSTALL_PREFIX="stage3-debug" \ |
| 30 | -DCMAKE_PREFIX_PATH="$PREFIX" \ |
| 31 | -DCMAKE_BUILD_TYPE=Debug \ |
| 32 | -DZIG_TARGET_TRIPLE="$TARGET" \ |
| 33 | -DZIG_TARGET_MCPU="$MCPU" \ |
| 34 | -DZIG_STATIC=ON \ |
| 35 | -DZIG_NO_LIB=ON \ |
| 36 | -DZIG_EXTRA_BUILD_ARGS="-Duse-llvm=true" \ |
| 37 | -GNinja |
| 38 | |
| 39 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables |
| 40 | # so that installation and testing do not get affected by them. |
| 41 | unset CC |
| 42 | unset CXX |
| 43 | |
| 44 | ninja install |
| 45 | |
| 46 | # Must be done after zig cc is finished. |
| 47 | export ZIG_LIB_DIR="$PWD/../lib" |
| 48 | |
| 49 | # simultaneously test building self-hosted without LLVM and with 32-bit arm |
| 50 | stage3-debug/bin/zig build \ |
| 51 | -Dtarget=arm-linux-musleabihf \ |
| 52 | -Dno-lib |
| 53 | |
| 54 | stage3-debug/bin/zig build test docs \ |
| 55 | --maxrss ${ZSF_MAX_RSS:-0} \ |
| 56 | -Dlldb=$HOME/deps/lldb-zig/Debug-aad646607a/bin/lldb \ |
| 57 | -Dlibc-test-path=$HOME/deps/libc-test-b95fe84 \ |
| 58 | -fqemu \ |
| 59 | --libc-runtimes $HOME/deps/glibc-2.43-musl-1.2.5 \ |
| 60 | -fwasmtime \ |
| 61 | -Dstatic-llvm \ |
| 62 | -Dskip-freebsd \ |
| 63 | -Dskip-netbsd \ |
| 64 | -Dskip-openbsd \ |
| 65 | -Dskip-windows \ |
| 66 | -Dskip-darwin \ |
| 67 | -Dtarget=native-native-musl \ |
| 68 | --search-prefix "$PREFIX" \ |
| 69 | -Denable-superhtml \ |
| 70 | --test-timeout 12m |
| 71 | |
| 72 | stage3-debug/bin/zig build \ |
| 73 | --prefix stage4-debug \ |
| 74 | -Duse-llvm \ |
| 75 | -Denable-llvm \ |
| 76 | -Dno-lib \ |
| 77 | -Dtarget=$TARGET \ |
| 78 | -Duse-zig-libcxx \ |
| 79 | -Dversion-string="$(stage3-debug/bin/zig version)" |
| 80 | |
| 81 | stage4-debug/bin/zig test ../test/behavior.zig |