@@ -7,7 +7,9 @@ sudo pkg update -fq
77sudo pkg install -y cmake py39-s3cmd wget curl jq samurai
88
99ZIGDIR=" $( pwd) "
10- CACHE_BASENAME=" zig+llvm+lld+clang-x86_64-freebsd-gnu-0.10.0-dev.3524+74673b7f6"
10+ TARGET=" x86_64-freebsd-gnu"
11+ MCPU=" baseline"
12+ CACHE_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.
44- cmake .. -DZIG_EXECUTABLE=" $PREFIX /bin/zig"
45- samu 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.
46+ stage2/bin/zig libc > libc.txt
4647
47- # Here we skip some tests to save time.
48- release/bin/zig build test docs \
48+ ZIG_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.
58+ stage3-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/
0 commit comments