mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
CI: use zig build to produce release artifact
For both macOS and FreeBSD.
This commit is contained in:
parent
a8f86291d2
commit
5b486b1851
@ -34,13 +34,11 @@ git fetch --tags
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="$(pwd)/stage2" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_OMIT_STAGE2=ON
|
||||
-DZIG_STATIC=ON
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
@ -49,13 +47,8 @@ unset CXX
|
||||
|
||||
make $JOBS install
|
||||
|
||||
# Here we rebuild zig but this time using the Zig binary we just now produced to
|
||||
# build zig1.o rather than relying on the one built with stage0. See
|
||||
# https://github.com/ziglang/zig/issues/6830 for more details.
|
||||
cmake .. -DZIG_EXECUTABLE="$(pwd)/stage2/bin/zig"
|
||||
make $JOBS install
|
||||
|
||||
stage2/bin/zig build -p release \
|
||||
stage2/bin/zig build \
|
||||
--prefix stage3-release \
|
||||
--search-prefix "$PREFIX" \
|
||||
-Dstatic-llvm \
|
||||
-Drelease \
|
||||
@ -63,21 +56,21 @@ stage2/bin/zig build -p release \
|
||||
-Dtarget="$TARGET" \
|
||||
-Denable-stage1
|
||||
|
||||
release/bin/zig build test docs \
|
||||
stage3-release/bin/zig build test docs \
|
||||
-Denable-macos-sdk \
|
||||
-Dstatic-llvm \
|
||||
--search-prefix "$PREFIX"
|
||||
|
||||
if [ "${BUILD_REASON}" != "PullRequest" ]; then
|
||||
mv ../LICENSE release/
|
||||
mv ../zig-cache/langref.html release/
|
||||
mv release/bin/zig release/
|
||||
rmdir release/bin
|
||||
mv ../LICENSE stage3-release/
|
||||
mv ../zig-cache/langref.html stage3-release/
|
||||
mv stage3-release/bin/zig stage3-release/
|
||||
rmdir stage3-release/bin
|
||||
|
||||
VERSION=$(release/zig version)
|
||||
VERSION=$(stage3-release/zig version)
|
||||
DIRNAME="zig-macos-$ARCH-$VERSION"
|
||||
TARBALL="$DIRNAME.tar.xz"
|
||||
mv release "$DIRNAME"
|
||||
mv stage3-release "$DIRNAME"
|
||||
tar cfJ "$TARBALL" "$DIRNAME"
|
||||
|
||||
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
|
||||
|
||||
@ -7,7 +7,9 @@ sudo pkg update -fq
|
||||
sudo pkg install -y cmake py39-s3cmd wget curl jq samurai
|
||||
|
||||
ZIGDIR="$(pwd)"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-x86_64-freebsd-gnu-0.10.0-dev.3524+74673b7f6"
|
||||
TARGET="x86_64-freebsd-gnu"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.3524+74673b7f6"
|
||||
PREFIX="$HOME/$CACHE_BASENAME"
|
||||
|
||||
cd $HOME
|
||||
@ -30,38 +32,46 @@ export TERM=dumb
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH=$PREFIX \
|
||||
"-DCMAKE_INSTALL_PREFIX=$(pwd)/release" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_TARGET_TRIPLE=x86_64-freebsd-gnu \
|
||||
-GNinja
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH=$PREFIX \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-GNinja
|
||||
samu install
|
||||
|
||||
# Here we rebuild zig but this time using the Zig binary we just now produced to
|
||||
# build zig1.o rather than relying on the one built with stage0. This makes it
|
||||
# a stage3 build rather than a stage2 build.
|
||||
cmake .. -DZIG_EXECUTABLE="$PREFIX/bin/zig"
|
||||
samu install
|
||||
# TODO: eliminate this workaround. Without this, zig does not end up passing
|
||||
# -isystem /usr/include when building libc++, resulting in #include <sys/endian.h>
|
||||
# "file not found" errors.
|
||||
stage2/bin/zig libc >libc.txt
|
||||
|
||||
# Here we skip some tests to save time.
|
||||
release/bin/zig build test docs \
|
||||
ZIG_LIBC=libc.txt stage2/bin/zig build \
|
||||
--prefix stage3-release \
|
||||
--search-prefix "$PREFIX" \
|
||||
-Dstatic-llvm \
|
||||
-Drelease \
|
||||
-Dstrip \
|
||||
-Dtarget="$TARGET" \
|
||||
-Denable-stage1
|
||||
|
||||
# Here we skip some tests to save time.
|
||||
stage3-release/bin/zig build test docs \
|
||||
-Dstatic-llvm \
|
||||
--search-prefix "$PREFIX" \
|
||||
-Dskip-stage1 \
|
||||
-Dskip-non-native
|
||||
|
||||
if [ -f ~/.s3cfg ]; then
|
||||
mv ../LICENSE release/
|
||||
mv ../zig-cache/langref.html release/
|
||||
mv release/bin/zig release/
|
||||
rmdir release/bin
|
||||
mv ../LICENSE stage3-release/
|
||||
mv ../zig-cache/langref.html stage3-release/
|
||||
mv stage3-release/bin/zig stage3-release/
|
||||
rmdir stage3-release/bin
|
||||
|
||||
GITBRANCH=$(basename $GITHUB_REF)
|
||||
VERSION=$(release/zig version)
|
||||
VERSION=$(stage3-release/zig version)
|
||||
DIRNAME="zig-freebsd-x86_64-$VERSION"
|
||||
TARBALL="$DIRNAME.tar.xz"
|
||||
mv release "$DIRNAME"
|
||||
mv stage3-release "$DIRNAME"
|
||||
tar cfJ "$TARBALL" "$DIRNAME"
|
||||
|
||||
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user