authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-16 14:23:09+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-18 12:42:24+02:00
logc26c5a3c1b9dc55e157374cc5fab11fe28d53ecf
treec30f26b3242ee00701eacc40d3fabbf9d0822511
parent4aa35160ebeb86aad3431791d57f9bd53c9079f8
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

ci: add loongarch64-linux scripts


2 files changed, 148 insertions(+), 0 deletions(-)

ci/loongarch64-linux-debug.sh created+71
...@@ -0,0 +1,71 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8ARCH="$(uname -m)"
9TARGET="$ARCH-linux-musl"
10MCPU="baseline"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.157+7fdd60df1"
12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"
14
15# Make the `zig version` number consistent.
16# This will affect the cmake command below.
17git fetch --unshallow || true
18git fetch --tags
19
20# Override the cache directories because they won't actually help other CI runs
21# which will be testing alternate versions of zig, and ultimately would just
22# fill up space on the hard drive for no reason.
23export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
24export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
25
26mkdir build-debug
27cd build-debug
28
29export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
30export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
31
32cmake .. \
33 -DCMAKE_INSTALL_PREFIX="stage3-debug" \
34 -DCMAKE_PREFIX_PATH="$PREFIX" \
35 -DCMAKE_BUILD_TYPE=Debug \
36 -DZIG_TARGET_TRIPLE="$TARGET" \
37 -DZIG_TARGET_MCPU="$MCPU" \
38 -DZIG_STATIC=ON \
39 -DZIG_NO_LIB=ON \
40 -GNinja \
41 -DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
42 -DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
43# https://github.com/ziglang/zig/issues/22213
44
45# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
46# so that installation and testing do not get affected by them.
47unset CC
48unset CXX
49
50ninja install
51
52# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
53stage3-debug/bin/zig build test \
54 --maxrss 60129542144 \
55 -Dstatic-llvm \
56 -Dskip-non-native \
57 -Dtarget=native-native-musl \
58 --search-prefix "$PREFIX" \
59 --zig-lib-dir "$PWD/../lib" \
60 -Dno-langref \
61 -Dskip-translate-c
62
63stage3-debug/bin/zig build \
64 --prefix stage4-debug \
65 -Denable-llvm \
66 -Dno-lib \
67 -Dtarget=$TARGET \
68 -Duse-zig-libcxx \
69 -Dversion-string="$(stage3-debug/bin/zig version)"
70
71stage4-debug/bin/zig test ../test/behavior.zig
ci/loongarch64-linux-release.sh created+77
...@@ -0,0 +1,77 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8ARCH="$(uname -m)"
9TARGET="$ARCH-linux-musl"
10MCPU="baseline"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.157+7fdd60df1"
12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"
14
15# Make the `zig version` number consistent.
16# This will affect the cmake command below.
17git fetch --unshallow || true
18git fetch --tags
19
20# Override the cache directories because they won't actually help other CI runs
21# which will be testing alternate versions of zig, and ultimately would just
22# fill up space on the hard drive for no reason.
23export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
24export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
25
26mkdir build-release
27cd build-release
28
29export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
30export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
31
32cmake .. \
33 -DCMAKE_INSTALL_PREFIX="stage3-release" \
34 -DCMAKE_PREFIX_PATH="$PREFIX" \
35 -DCMAKE_BUILD_TYPE=Release \
36 -DZIG_TARGET_TRIPLE="$TARGET" \
37 -DZIG_TARGET_MCPU="$MCPU" \
38 -DZIG_STATIC=ON \
39 -DZIG_NO_LIB=ON \
40 -GNinja \
41 -DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
42 -DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
43# https://github.com/ziglang/zig/issues/22213
44
45# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
46# so that installation and testing do not get affected by them.
47unset CC
48unset CXX
49
50ninja install
51
52# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
53stage3-release/bin/zig build test \
54 --maxrss 60129542144 \
55 -Dstatic-llvm \
56 -Dskip-non-native \
57 -Dtarget=native-native-musl \
58 --search-prefix "$PREFIX" \
59 --zig-lib-dir "$PWD/../lib" \
60 -Dno-langref \
61 -Dskip-translate-c
62
63# Ensure that stage3 and stage4 are byte-for-byte identical.
64stage3-release/bin/zig build \
65 --prefix stage4-release \
66 -Denable-llvm \
67 -Dno-lib \
68 -Doptimize=ReleaseFast \
69 -Dstrip \
70 -Dtarget=$TARGET \
71 -Duse-zig-libcxx \
72 -Dversion-string="$(stage3-release/bin/zig version)"
73
74# diff returns an error code if the files differ.
75echo "If the following command fails, it means nondeterminism has been"
76echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
77diff stage3-release/bin/zig stage4-release/bin/zig