2021-11-08 09:08:29 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. ./ci/zinc/linux_base.sh
|
|
|
|
|
2022-07-14 00:47:55 +01:00
|
|
|
OLD_ZIG="$DEPS_LOCAL/bin/zig"
|
2022-02-17 23:16:33 +00:00
|
|
|
TARGET="${ARCH}-linux-musl"
|
|
|
|
MCPU="baseline"
|
|
|
|
|
|
|
|
# Make the `zig version` number consistent.
|
|
|
|
# This will affect the cmake command below.
|
|
|
|
git config core.abbrev 9
|
|
|
|
|
2022-07-14 00:47:55 +01:00
|
|
|
echo "building debug zig with zig version $($OLD_ZIG version)"
|
2022-02-17 23:16:33 +00:00
|
|
|
|
2022-07-14 00:47:55 +01:00
|
|
|
export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU"
|
|
|
|
export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU"
|
2022-02-17 23:16:33 +00:00
|
|
|
|
|
|
|
mkdir _debug
|
|
|
|
cd _debug
|
|
|
|
cmake .. \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="$DEBUG_STAGING" \
|
|
|
|
-DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \
|
|
|
|
-DCMAKE_BUILD_TYPE=Debug \
|
|
|
|
-DZIG_TARGET_TRIPLE="$TARGET" \
|
|
|
|
-DZIG_TARGET_MCPU="$MCPU" \
|
|
|
|
-DZIG_STATIC=ON \
|
|
|
|
-GNinja
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
ninja install
|
|
|
|
|
2022-07-14 00:47:55 +01:00
|
|
|
STAGE1_ZIG="$DEBUG_STAGING/bin/zig"
|
2022-02-17 23:16:33 +00:00
|
|
|
|
|
|
|
# Here we rebuild zig but this time using the Zig binary we just now produced to
|
|
|
|
# build zig1.o rather than relying on the one built with stage0. See
|
|
|
|
# https://github.com/ziglang/zig/issues/6830 for more details.
|
2022-07-14 00:47:55 +01:00
|
|
|
cmake .. -DZIG_EXECUTABLE="$STAGE1_ZIG"
|
2022-02-17 23:16:33 +00:00
|
|
|
ninja install
|
|
|
|
|
|
|
|
cd $WORKSPACE
|
|
|
|
|
2022-07-14 00:47:55 +01:00
|
|
|
echo "Looking for non-conforming code formatting..."
|
|
|
|
echo "Formatting errors can be fixed by running 'zig fmt' on the files printed here."
|
|
|
|
$STAGE1_ZIG fmt --check . --exclude test/cases/
|
2021-11-08 09:08:29 +00:00
|
|
|
|
2022-07-14 00:47:55 +01:00
|
|
|
$STAGE1_ZIG build -p stage2 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
|
2022-04-22 04:28:36 +01:00
|
|
|
stage2/bin/zig build -p stage3 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
|
2022-07-14 00:47:55 +01:00
|
|
|
stage3/bin/zig build # test building self-hosted without LLVM
|
|
|
|
stage3/bin/zig build -Dtarget=arm-linux-musleabihf # test building self-hosted for 32-bit arm
|
|
|
|
|
2022-07-27 22:48:03 +01:00
|
|
|
stage3/bin/zig build test-compiler-rt -fqemu -fwasmtime -Denable-llvm
|
|
|
|
stage3/bin/zig build test-behavior -fqemu -fwasmtime -Denable-llvm
|
|
|
|
stage3/bin/zig build test-std -fqemu -fwasmtime -Denable-llvm
|
|
|
|
stage3/bin/zig build test-universal-libc -fqemu -fwasmtime -Denable-llvm
|
|
|
|
stage3/bin/zig build test-compare-output -fqemu -fwasmtime -Denable-llvm
|
|
|
|
stage3/bin/zig build test-asm-link -fqemu -fwasmtime -Denable-llvm
|
|
|
|
stage3/bin/zig build test-fmt -fqemu -fwasmtime -Denable-llvm
|
|
|
|
stage3/bin/zig build test-translate-c -fqemu -fwasmtime -Denable-llvm
|
|
|
|
stage3/bin/zig build test-run-translated-c -fqemu -fwasmtime -Denable-llvm
|
|
|
|
stage3/bin/zig build test-standalone -fqemu -fwasmtime -Denable-llvm
|
|
|
|
stage3/bin/zig build test-cli -fqemu -fwasmtime -Denable-llvm
|
2022-07-29 05:42:07 +01:00
|
|
|
stage3/bin/zig build test-cases -fqemu -fwasmtime -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
|
2022-07-27 22:48:03 +01:00
|
|
|
stage3/bin/zig build test-link -fqemu -fwasmtime -Denable-llvm
|
2022-07-14 00:47:55 +01:00
|
|
|
|
|
|
|
$STAGE1_ZIG build test-stack-traces -fqemu -fwasmtime
|
|
|
|
$STAGE1_ZIG build docs -fqemu -fwasmtime
|
2021-11-08 09:08:29 +00:00
|
|
|
|
|
|
|
# Produce the experimental std lib documentation.
|
2022-02-17 23:16:33 +00:00
|
|
|
mkdir -p "$RELEASE_STAGING/docs/std"
|
2022-07-24 22:05:25 +01:00
|
|
|
stage3/bin/zig test lib/std/std.zig \
|
2021-11-08 09:08:29 +00:00
|
|
|
--zig-lib-dir lib \
|
|
|
|
-femit-docs=$RELEASE_STAGING/docs/std \
|
|
|
|
-fno-emit-bin
|
|
|
|
|
|
|
|
# Look for HTML errors.
|
|
|
|
tidy --drop-empty-elements no -qe zig-cache/langref.html
|
|
|
|
|
2022-02-17 23:16:33 +00:00
|
|
|
# Build release zig.
|
2022-07-21 01:10:51 +01:00
|
|
|
stage3/bin/zig build \
|
2022-02-18 00:20:29 +00:00
|
|
|
--prefix "$RELEASE_STAGING" \
|
2022-02-17 23:16:33 +00:00
|
|
|
--search-prefix "$DEPS_LOCAL" \
|
2022-04-16 11:41:33 +01:00
|
|
|
-Dstatic-llvm \
|
2022-02-17 23:16:33 +00:00
|
|
|
-Drelease \
|
|
|
|
-Dstrip \
|
|
|
|
-Dtarget="$TARGET" \
|
|
|
|
-Dstage1
|
|
|
|
|
2021-11-08 09:08:29 +00:00
|
|
|
# Explicit exit helps show last command duration.
|
|
|
|
exit
|