authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-21 07:43:18+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-22 01:37:32+02:00
log3675074c7c2fe45f312e3246efda2632315eb9c3
treeb7ce01df15c531ef18cb702c09fc51e0b129f76a
parentb3432c2796979c4a0e137153414df61282b5626a
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

ci: add x86_64-freebsd scripts


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

ci/x86_64-freebsd-debug.sh created+71
......@@ -0,0 +1,71 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8ARCH="x86_64"
9TARGET="$ARCH-freebsd-none"
10MCPU="baseline"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.312+164c598cd"
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
52stage3-debug/bin/zig build test docs \
53 --maxrss 32212254720 \
54 -Dstatic-llvm \
55 -Dskip-linux \
56 -Dskip-netbsd \
57 -Dskip-windows \
58 -Dskip-macos \
59 -Dtarget=native-native-none \
60 --search-prefix "$PREFIX" \
61 --zig-lib-dir "$PWD/../lib"
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/x86_64-freebsd-release.sh created+77
......@@ -0,0 +1,77 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8ARCH="x86_64"
9TARGET="$ARCH-freebsd-none"
10MCPU="baseline"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.312+164c598cd"
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
52stage3-release/bin/zig build test docs \
53 --maxrss 32212254720 \
54 -Dstatic-llvm \
55 -Dskip-linux \
56 -Dskip-netbsd \
57 -Dskip-windows \
58 -Dskip-macos \
59 -Dtarget=native-native-none \
60 --search-prefix "$PREFIX" \
61 --zig-lib-dir "$PWD/../lib"
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