mirror of
https://github.com/ziglang/zig.git
synced 2025-12-15 10:43:08 +00:00
The main reason to update the CI tarballs is f79824f946995a050c261ee96a08e31ccf00a112 which fixes an issue that caused the CI to fail on all targets.
101 lines
2.7 KiB
Bash
Executable File
101 lines
2.7 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -x
|
|
set -e
|
|
|
|
sudo pkg update -fq
|
|
sudo pkg install -y cmake py39-s3cmd wget curl jq samurai
|
|
|
|
ZIGDIR="$(pwd)"
|
|
TARGET="x86_64-freebsd-gnu"
|
|
MCPU="baseline"
|
|
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.61+9be8396b7"
|
|
PREFIX="$HOME/$CACHE_BASENAME"
|
|
|
|
cd $HOME
|
|
wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
|
|
tar xf "$CACHE_BASENAME.tar.xz"
|
|
|
|
cd $ZIGDIR
|
|
|
|
# Make the `zig version` number consistent.
|
|
# This will affect the cmake command below.
|
|
git config core.abbrev 9
|
|
git fetch --unshallow || true
|
|
git fetch --tags
|
|
|
|
# SourceHut reports that it is a terminal that supports escape codes, but it
|
|
# is a filthy liar. Here we tell Zig to not try to send any terminal escape
|
|
# codes to show progress.
|
|
export TERM=dumb
|
|
|
|
mkdir build
|
|
cd build
|
|
|
|
|
|
cmake .. \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_PREFIX_PATH=$PREFIX \
|
|
-DZIG_TARGET_TRIPLE="$TARGET" \
|
|
-DZIG_TARGET_MCPU="$MCPU" \
|
|
-DZIG_STATIC=ON \
|
|
-GNinja
|
|
|
|
# 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.
|
|
echo "include_dir=/usr/include" >>libc.txt
|
|
echo "sys_include_dir=/usr/include" >>libc.txt
|
|
echo "crt_dir=/usr/lib" >>libc.txt
|
|
echo "msvc_lib_dir=" >>libc.txt
|
|
echo "kernel32_lib_dir=" >>libc.txt
|
|
echo "gcc_dir=" >>libc.txt
|
|
ZIG_LIBC_TXT="$(pwd)/libc.txt"
|
|
|
|
ZIG_LIBC="$ZIG_LIBC_TXT" samu install
|
|
|
|
# Here we skip some tests to save time.
|
|
stage3/bin/zig build test docs \
|
|
--zig-lib-dir "$(pwd)/../lib" \
|
|
-Dstatic-llvm \
|
|
--search-prefix "$PREFIX" \
|
|
-Dskip-stage1 \
|
|
-Dskip-non-native
|
|
|
|
if [ -f ~/.s3cfg ]; then
|
|
mv ../LICENSE stage3/
|
|
mv ../zig-cache/langref.html stage3/
|
|
mv stage3/bin/zig stage3/
|
|
rmdir stage3/bin
|
|
|
|
GITBRANCH=$(basename $GITHUB_REF)
|
|
VERSION=$(stage3/zig version)
|
|
DIRNAME="zig-freebsd-x86_64-$VERSION"
|
|
TARBALL="$DIRNAME.tar.xz"
|
|
mv stage3 "$DIRNAME"
|
|
tar cfJ "$TARBALL" "$DIRNAME"
|
|
|
|
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
|
|
|
|
SHASUM=$(shasum -a 256 $TARBALL | cut '-d ' -f1)
|
|
BYTESIZE=$(wc -c < $TARBALL)
|
|
|
|
JSONFILE="freebsd-$GITBRANCH.json"
|
|
touch $JSONFILE
|
|
echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
|
|
echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
|
|
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
|
|
|
|
s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
|
|
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/x86_64-freebsd-$VERSION.json"
|
|
|
|
if [ "$GITBRANCH" = "master" ]; then
|
|
# avoid leaking oauth token
|
|
set +x
|
|
|
|
OAUTH_TOKEN="$(cat ~/.oauth_token)"
|
|
cd "$ZIGDIR"
|
|
./ci/srht/on_master_success "$VERSION" "$OAUTH_TOKEN"
|
|
fi
|
|
fi
|