Skip to content

Commit bcc464d

Browse files
committed
ci: drone: use zig-bootstrap tarball instead of system toolchain
1 parent 16c5cba commit bcc464d

File tree

3 files changed

+35
-9
lines changed

3 files changed

+35
-9
lines changed

ci/drone/drone.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ platform:
77

88
steps:
99
- name: build
10-
image: ziglang/static-base:llvm12-aarch64-3
10+
image: ziglang/static-base:llvm12-aarch64-5
1111
commands:
1212
- ./ci/drone/linux_script_build
1313

1414
- name: test-1
1515
depends_on:
1616
- build
17-
image: ziglang/static-base:llvm12-aarch64-3
17+
image: ziglang/static-base:llvm12-aarch64-5
1818
commands:
1919
- ./ci/drone/linux_script_test 1
2020

2121
- name: test-2
2222
depends_on:
2323
- build
24-
image: ziglang/static-base:llvm12-aarch64-3
24+
image: ziglang/static-base:llvm12-aarch64-5
2525
commands:
2626
- ./ci/drone/linux_script_test 2
2727

2828
- name: test-3
2929
depends_on:
3030
- build
31-
image: ziglang/static-base:llvm12-aarch64-3
31+
image: ziglang/static-base:llvm12-aarch64-5
3232
commands:
3333
- ./ci/drone/linux_script_test 3
3434

@@ -38,7 +38,7 @@ steps:
3838
- test-1
3939
- test-2
4040
- test-3
41-
image: ziglang/static-base:llvm12-aarch64-3
41+
image: ziglang/static-base:llvm12-aarch64-5
4242
environment:
4343
SRHT_OAUTH_TOKEN:
4444
from_secret: SRHT_OAUTH_TOKEN

ci/drone/linux_script_build

+29-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22

33
. ./ci/drone/linux_script_base
44

5-
apk update
6-
apk add samurai
5+
PREFIX="/deps/local"
6+
ZIG="$PREFIX/bin/zig"
7+
TARGET="$TRIPLEARCH-linux-musl"
8+
MCPU="baseline"
9+
10+
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
11+
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
12+
export AR="$ZIG ar"
13+
export RANLIB="$ZIG ranlib"
714

815
# Make the `zig version` number consistent.
916
# This will affect the cmake command below.
@@ -13,6 +20,25 @@ git fetch --tags
1320

1421
mkdir build
1522
cd build
16-
cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR" -DZIG_STATIC=ON -DCMAKE_PREFIX_PATH=/deps/local -GNinja
23+
cmake .. \
24+
-DCMAKE_INSTALL_PREFIX="$DISTDIR" \
25+
-DCMAKE_PREFIX_PATH="$PREFIX" \
26+
-DCMAKE_BUILD_TYPE=Release \
27+
-DZIG_TARGET_TRIPLE="$TARGET" \
28+
-DZIG_TARGET_MCPU="$MCPU" \
29+
-DZIG_STATIC=ON \
30+
-DCMAKE_CROSSCOMPILING=True \
31+
-DCMAKE_SYSTEM_NAME=Linux \
32+
-GNinja
33+
34+
# Now CMake will use Zig as the C/C++ compiler. We reset the environment variables
35+
# so that installation and testing do not get affected by them.
36+
unset CC
37+
unset CXX
38+
samu install
1739

40+
# Here we rebuild Zig but this time using the Zig binary we just now produced to
41+
# build zig1.o rather than relying on the one built with stage0. See
42+
# https://github.com/ziglang/zig/issues/6830 for more details.
43+
cmake .. -DZIG_EXECUTABLE="$DISTDIR/bin/zig"
1844
samu install

ci/drone/linux_script_finalize

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if [ -n "$DRONE_PULL_REQUEST" ]; then
77
fi
88

99
apk update
10-
apk add py3-pip xz perl-utils jq curl samurai
10+
apk add py3-pip perl-utils jq curl
1111
pip3 install s3cmd
1212

1313
cd build

0 commit comments

Comments
 (0)