2021-11-08 09:08:29 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. ./ci/zinc/linux_base.sh
|
|
|
|
|
2022-02-17 23:16:33 +00:00
|
|
|
ZIG="$DEPS_LOCAL/bin/zig"
|
|
|
|
TARGET="${ARCH}-linux-musl"
|
|
|
|
MCPU="baseline"
|
|
|
|
|
|
|
|
# Make the `zig version` number consistent.
|
|
|
|
# This will affect the cmake command below.
|
|
|
|
git config core.abbrev 9
|
|
|
|
|
|
|
|
echo "BUILD debug zig with zig:$($ZIG version)"
|
|
|
|
|
|
|
|
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
|
|
|
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
ZIG="$DEBUG_STAGING/bin/zig"
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
cmake .. -DZIG_EXECUTABLE="$ZIG"
|
|
|
|
ninja install
|
|
|
|
|
|
|
|
cd $WORKSPACE
|
|
|
|
|
|
|
|
# Look for non-conforming code formatting.
|
|
|
|
# Formatting errors can be fixed by running `zig fmt` on the files printed here.
|
2022-05-04 22:51:16 +01:00
|
|
|
$ZIG fmt --check . --exclude test/cases/
|
2021-11-08 09:08:29 +00:00
|
|
|
|
2022-02-17 22:26:26 +00:00
|
|
|
# Build stage2 standalone so that we can test stage2 against stage2 compiler-rt.
|
2022-04-22 04:28:36 +01:00
|
|
|
$ZIG build -p stage2 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
|
2022-04-16 11:41:33 +01:00
|
|
|
|
|
|
|
# Ensure that stage2 can build itself.
|
2022-04-22 04:28:36 +01:00
|
|
|
stage2/bin/zig build -p stage3 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
|
|
|
|
stage2/bin/zig build # test building self-hosted without LLVM
|
|
|
|
stage2/bin/zig build -Dtarget=arm-linux-musleabihf # test building self-hosted for 32-bit arm
|
|
|
|
|
|
|
|
# Here we use stage2 instead of stage3 because of two bugs remaining:
|
|
|
|
# * https://github.com/ziglang/zig/issues/11367 (and corresponding workaround in compiler source)
|
|
|
|
# * https://github.com/ziglang/zig/pull/11492#issuecomment-1112871321
|
|
|
|
stage2/bin/zig build test-behavior -fqemu -fwasmtime
|
2022-06-11 09:02:33 +01:00
|
|
|
stage2/bin/zig test lib/std/std.zig --zig-lib-dir lib
|
2022-04-22 04:28:36 +01:00
|
|
|
|
|
|
|
$ZIG build test-behavior -fqemu -fwasmtime -Domit-stage2
|
2021-12-02 22:42:59 +00:00
|
|
|
$ZIG build test-compiler-rt -fqemu -fwasmtime
|
|
|
|
$ZIG build test-std -fqemu -fwasmtime
|
2022-05-07 03:22:40 +01:00
|
|
|
$ZIG build test-universal-libc -fqemu -fwasmtime
|
2021-12-02 22:42:59 +00:00
|
|
|
$ZIG build test-compare-output -fqemu -fwasmtime
|
|
|
|
$ZIG build test-standalone -fqemu -fwasmtime
|
|
|
|
$ZIG build test-stack-traces -fqemu -fwasmtime
|
|
|
|
$ZIG build test-cli -fqemu -fwasmtime
|
|
|
|
$ZIG build test-asm-link -fqemu -fwasmtime
|
|
|
|
$ZIG build test-translate-c -fqemu -fwasmtime
|
|
|
|
$ZIG build test-run-translated-c -fqemu -fwasmtime
|
|
|
|
$ZIG build docs -fqemu -fwasmtime
|
|
|
|
$ZIG build test-fmt -fqemu -fwasmtime
|
2022-05-13 08:00:20 +01:00
|
|
|
$ZIG build test-cases -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"
|
2021-11-08 09:08:29 +00:00
|
|
|
$ZIG test lib/std/std.zig \
|
|
|
|
--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-02-18 00:20:29 +00:00
|
|
|
$ZIG build \
|
|
|
|
--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
|