master
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8TARGET="x86_64-linux-musl"
9MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
11PREFIX="$HOME/deps/$CACHE_BASENAME"
12ZIG="$PREFIX/bin/zig"
13
14export PATH="$HOME/deps/wasmtime-v38.0.3-x86_64-linux:$HOME/deps/qemu-linux-x86_64-10.1.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.
19export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
20export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
21
22mkdir build-debug-llvm
23cd build-debug-llvm
24
25export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
26export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
27
28cmake .. \
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.
41unset CC
42unset CXX
43
44ninja install
45
46# simultaneously test building self-hosted without LLVM and with 32-bit arm
47stage3-debug/bin/zig build \
48 -Dtarget=arm-linux-musleabihf \
49 -Dno-lib
50
51stage3-debug/bin/zig build test docs \
52 --maxrss 21000000000 \
53 -Dlldb=$HOME/deps/lldb-zig/Debug-e0a42bb34/bin/lldb \
54 -fqemu \
55 -fwasmtime \
56 -Dstatic-llvm \
57 -Dskip-freebsd \
58 -Dskip-netbsd \
59 -Dskip-windows \
60 -Dskip-darwin \
61 -Dtarget=native-native-musl \
62 --search-prefix "$PREFIX" \
63 --zig-lib-dir "$PWD/../lib" \
64 -Denable-superhtml \
65 --test-timeout 12m