authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-11 00:29:40-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-19 16:45:15-07:00
log5b486b1851ce3ee930236653fc0f8b0ec3eef5e6
tree5afced6e929e10d015b5557a9800023b3943fc94
parenta8f86291d2c108fbc70de175660742a737b78823

CI: use zig build to produce release artifact

For both macOS and FreeBSD.

2 files changed, 40 insertions(+), 37 deletions(-)

ci/azure/macos_script+10-17
......@@ -34,13 +34,11 @@ git fetch --tags
3434mkdir build
3535cd build
3636cmake .. \
37 -DCMAKE_INSTALL_PREFIX="$(pwd)/stage2" \
3837 -DCMAKE_PREFIX_PATH="$PREFIX" \
3938 -DCMAKE_BUILD_TYPE=Release \
4039 -DZIG_TARGET_TRIPLE="$TARGET" \
4140 -DZIG_TARGET_MCPU="$MCPU" \
42 -DZIG_STATIC=ON \
43 -DZIG_OMIT_STAGE2=ON
41 -DZIG_STATIC=ON
4442
4543# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
4644# so that installation and testing do not get affected by them.
......@@ -49,13 +47,8 @@ unset CXX
4947
5048make $JOBS install
5149
52# Here we rebuild zig but this time using the Zig binary we just now produced to
53# build zig1.o rather than relying on the one built with stage0. See
54# https://github.com/ziglang/zig/issues/6830 for more details.
55cmake .. -DZIG_EXECUTABLE="$(pwd)/stage2/bin/zig"
56make $JOBS install
57
58stage2/bin/zig build -p release \
50stage2/bin/zig build \
51 --prefix stage3-release \
5952 --search-prefix "$PREFIX" \
6053 -Dstatic-llvm \
6154 -Drelease \
......@@ -63,21 +56,21 @@ stage2/bin/zig build -p release \
6356 -Dtarget="$TARGET" \
6457 -Denable-stage1
6558
66release/bin/zig build test docs \
59stage3-release/bin/zig build test docs \
6760 -Denable-macos-sdk \
6861 -Dstatic-llvm \
6962 --search-prefix "$PREFIX"
7063
7164if [ "${BUILD_REASON}" != "PullRequest" ]; then
72 mv ../LICENSE release/
73 mv ../zig-cache/langref.html release/
74 mv release/bin/zig release/
75 rmdir release/bin
65 mv ../LICENSE stage3-release/
66 mv ../zig-cache/langref.html stage3-release/
67 mv stage3-release/bin/zig stage3-release/
68 rmdir stage3-release/bin
7669
77 VERSION=$(release/zig version)
70 VERSION=$(stage3-release/zig version)
7871 DIRNAME="zig-macos-$ARCH-$VERSION"
7972 TARBALL="$DIRNAME.tar.xz"
80 mv release "$DIRNAME"
73 mv stage3-release "$DIRNAME"
8174 tar cfJ "$TARBALL" "$DIRNAME"
8275
8376 mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
ci/srht/freebsd_script+30-20
......@@ -7,7 +7,9 @@ sudo pkg update -fq
77sudo pkg install -y cmake py39-s3cmd wget curl jq samurai
88
99ZIGDIR="$(pwd)"
10CACHE_BASENAME="zig+llvm+lld+clang-x86_64-freebsd-gnu-0.10.0-dev.3524+74673b7f6"
10TARGET="x86_64-freebsd-gnu"
11MCPU="baseline"
12CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.3524+74673b7f6"
1113PREFIX="$HOME/$CACHE_BASENAME"
1214
1315cd $HOME
......@@ -30,38 +32,46 @@ export TERM=dumb
3032mkdir build
3133cd build
3234cmake .. \
33 -DCMAKE_BUILD_TYPE=Release \
34 -DCMAKE_PREFIX_PATH=$PREFIX \
35 "-DCMAKE_INSTALL_PREFIX=$(pwd)/release" \
36 -DZIG_STATIC=ON \
37 -DZIG_TARGET_TRIPLE=x86_64-freebsd-gnu \
38 -GNinja
35 -DCMAKE_BUILD_TYPE=Release \
36 -DCMAKE_PREFIX_PATH=$PREFIX \
37 -DZIG_TARGET_TRIPLE="$TARGET" \
38 -DZIG_TARGET_MCPU="$MCPU" \
39 -DZIG_STATIC=ON \
40 -GNinja
3941samu install
4042
41# Here we rebuild zig but this time using the Zig binary we just now produced to
42# build zig1.o rather than relying on the one built with stage0. This makes it
43# a stage3 build rather than a stage2 build.
44cmake .. -DZIG_EXECUTABLE="$PREFIX/bin/zig"
45samu install
43# TODO: eliminate this workaround. Without this, zig does not end up passing
44# -isystem /usr/include when building libc++, resulting in #include <sys/endian.h>
45# "file not found" errors.
46stage2/bin/zig libc >libc.txt
4647
47# Here we skip some tests to save time.
48release/bin/zig build test docs \
48ZIG_LIBC=libc.txt stage2/bin/zig build \
49 --prefix stage3-release \
4950 --search-prefix "$PREFIX" \
5051 -Dstatic-llvm \
52 -Drelease \
53 -Dstrip \
54 -Dtarget="$TARGET" \
55 -Denable-stage1
56
57# Here we skip some tests to save time.
58stage3-release/bin/zig build test docs \
59 -Dstatic-llvm \
60 --search-prefix "$PREFIX" \
5161 -Dskip-stage1 \
5262 -Dskip-non-native
5363
5464if [ -f ~/.s3cfg ]; then
55 mv ../LICENSE release/
56 mv ../zig-cache/langref.html release/
57 mv release/bin/zig release/
58 rmdir release/bin
65 mv ../LICENSE stage3-release/
66 mv ../zig-cache/langref.html stage3-release/
67 mv stage3-release/bin/zig stage3-release/
68 rmdir stage3-release/bin
5969
6070 GITBRANCH=$(basename $GITHUB_REF)
61 VERSION=$(release/zig version)
71 VERSION=$(stage3-release/zig version)
6272 DIRNAME="zig-freebsd-x86_64-$VERSION"
6373 TARBALL="$DIRNAME.tar.xz"
64 mv release "$DIRNAME"
74 mv stage3-release "$DIRNAME"
6575 tar cfJ "$TARBALL" "$DIRNAME"
6676
6777 s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/