2021-11-08 04:08:29 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
2022-11-22 14:13:58 -07:00
|
|
|
# Requires cmake ninja-build
|
|
|
|
|
|
2022-08-25 18:12:35 -07:00
|
|
|
set -x
|
|
|
|
|
set -e
|
2021-11-08 04:08:29 -05:00
|
|
|
|
2022-08-25 18:12:35 -07:00
|
|
|
ARCH="$(uname -m)"
|
2022-11-22 14:13:58 -07:00
|
|
|
TARGET="$ARCH-linux-musl"
|
|
|
|
|
MCPU="baseline"
|
2025-08-28 05:44:16 +02:00
|
|
|
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
|
2022-11-22 14:13:58 -07:00
|
|
|
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
|
|
|
|
ZIG="$PREFIX/bin/zig"
|
2022-11-21 20:15:22 -07:00
|
|
|
|
2024-10-17 23:17:19 +02:00
|
|
|
export PATH="$HOME/local/bin:$PATH"
|
2022-11-21 20:15:22 -07:00
|
|
|
|
2022-11-22 14:13:58 -07:00
|
|
|
# Make the `zig version` number consistent.
|
|
|
|
|
# This will affect the cmake command below.
|
|
|
|
|
git fetch --unshallow || true
|
|
|
|
|
git fetch --tags
|
2022-11-21 20:15:22 -07:00
|
|
|
|
2022-12-04 15:45:15 -07:00
|
|
|
# Override the cache directories because they won't actually help other CI runs
|
|
|
|
|
# which will be testing alternate versions of zig, and ultimately would just
|
|
|
|
|
# fill up space on the hard drive for no reason.
|
2024-04-13 23:12:52 -04:00
|
|
|
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
|
|
|
|
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
2022-12-04 15:45:15 -07:00
|
|
|
|
2025-01-28 20:39:31 +01:00
|
|
|
mkdir build-debug
|
|
|
|
|
cd build-debug
|
|
|
|
|
|
|
|
|
|
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
|
|
|
|
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
|
|
|
|
|
2022-11-22 14:13:58 -07:00
|
|
|
cmake .. \
|
|
|
|
|
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
|
|
|
|
|
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
|
|
|
|
-DCMAKE_BUILD_TYPE=Debug \
|
|
|
|
|
-DZIG_TARGET_TRIPLE="$TARGET" \
|
|
|
|
|
-DZIG_TARGET_MCPU="$MCPU" \
|
|
|
|
|
-DZIG_STATIC=ON \
|
2023-07-21 20:29:42 -07:00
|
|
|
-DZIG_NO_LIB=ON \
|
2022-11-22 14:13:58 -07:00
|
|
|
-GNinja
|
2022-08-25 18:12:35 -07:00
|
|
|
|
2022-11-22 14:13:58 -07:00
|
|
|
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
|
|
|
|
# so that installation and testing do not get affected by them.
|
|
|
|
|
unset CC
|
|
|
|
|
unset CXX
|
2022-02-17 16:16:33 -07:00
|
|
|
|
2022-11-22 14:13:58 -07:00
|
|
|
ninja install
|
2022-02-17 16:16:33 -07:00
|
|
|
|
2024-10-17 23:17:19 +02:00
|
|
|
# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
|
2022-11-29 17:17:25 -07:00
|
|
|
stage3-debug/bin/zig build test docs \
|
2025-05-24 11:35:30 -07:00
|
|
|
--maxrss 44918199637 \
|
2022-08-09 02:58:39 -07:00
|
|
|
-Dstatic-llvm \
|
2025-05-05 22:08:50 +02:00
|
|
|
-Dskip-non-native \
|
2022-08-09 02:58:39 -07:00
|
|
|
-Dtarget=native-native-musl \
|
2022-11-22 14:13:58 -07:00
|
|
|
--search-prefix "$PREFIX" \
|
2024-06-16 20:03:14 -07:00
|
|
|
--zig-lib-dir "$PWD/../lib" \
|
2024-10-12 06:27:30 +02:00
|
|
|
-Denable-superhtml
|
2025-03-27 00:21:17 +01:00
|
|
|
|
|
|
|
|
stage3-debug/bin/zig build \
|
|
|
|
|
--prefix stage4-debug \
|
|
|
|
|
-Denable-llvm \
|
|
|
|
|
-Dno-lib \
|
|
|
|
|
-Dtarget=$TARGET \
|
|
|
|
|
-Duse-zig-libcxx \
|
|
|
|
|
-Dversion-string="$(stage3-debug/bin/zig version)"
|
|
|
|
|
|
|
|
|
|
stage4-debug/bin/zig test ../test/behavior.zig
|