authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-02 14:58:15-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-02 17:03:11-07:00
log05cd8936c885d2b538091eb814724472c73ec8b8
tree1e8c31188f041dc68309efd9993b1e401f4acde9
parent16c5cbab0c414852bf8b911ed6efdf4ceeac9600

ci: drone: use zig-bootstrap tarball instead of system toolchain


3 files changed, 50 insertions(+), 9 deletions(-)

ci/drone/drone.yml+5-5
......@@ -7,28 +7,28 @@ platform:
77
88steps:
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+44-3
......@@ -2,8 +2,30 @@
22
33. ./ci/drone/linux_script_base
44
5apk update
6apk add samurai
5PREFIX="/deps/local"
6ZIG="$PREFIX/bin/zig"
7TARGET="$TRIPLEARCH-linux-musl"
8MCPU="baseline"
9
10export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
11export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
12
13# The `CMAKE_AR` parameter will consider any spaces to
14# be part of the executable path rather than CLI args, so we have
15# to create wrapper scripts for `zig ar` and zig ranlib`.
16
17cat <<'ENDFILE' >$PREFIX/bin/ar
18#!/bin/sh
19/deps/local/bin/zig ar $@
20ENDFILE
21
22cat <<'ENDFILE' >$PREFIX/bin/ranlib
23#!/bin/sh
24/deps/local/bin/zig ranlib $@
25ENDFILE
26
27chmod +x $PREFIX/bin/ar
28chmod +x $PREFIX/bin/ranlib
729
830# Make the `zig version` number consistent.
931# This will affect the cmake command below.
......@@ -13,6 +35,25 @@ git fetch --tags
1335
1436mkdir build
1537cd build
16cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR" -DZIG_STATIC=ON -DCMAKE_PREFIX_PATH=/deps/local -GNinja
38cmake .. \
39 -DCMAKE_INSTALL_PREFIX="$DISTDIR" \
40 -DCMAKE_PREFIX_PATH="$PREFIX" \
41 -DCMAKE_BUILD_TYPE=Release \
42 -DCMAKE_AR="$PREFIX/bin/ar" \
43 -DCMAKE_RANLIB="$PREFIX/bin/ranlib" \
44 -DZIG_TARGET_TRIPLE="$TARGET" \
45 -DZIG_TARGET_MCPU="$MCPU" \
46 -DZIG_STATIC=ON \
47 -GNinja
48
49# Now CMake will use Zig as the C/C++ compiler. We reset the environment variables
50# so that installation and testing do not get affected by them.
51unset CC
52unset CXX
53samu install
1754
55# Here we rebuild Zig but this time using the Zig binary we just now produced to
56# build zig1.o rather than relying on the one built with stage0. See
57# https://github.com/ziglang/zig/issues/6830 for more details.
58cmake .. -DZIG_EXECUTABLE="$DISTDIR/bin/zig"
1859samu install
ci/drone/linux_script_finalize+1-1
......@@ -7,7 +7,7 @@ if [ -n "$DRONE_PULL_REQUEST" ]; then
77fi
88
99apk update
10apk add py3-pip xz perl-utils jq curl samurai
10apk add py3-pip perl-utils jq curl
1111pip3 install s3cmd
1212
1313cd build