zig/ci/srht/freebsd_script

85 lines
2.3 KiB
Plaintext
Raw Normal View History

2019-03-19 03:37:48 +00:00
#!/bin/sh
2019-03-19 03:44:29 +00:00
set -x
set -e
2020-03-05 23:00:10 +00:00
sudo pkg update -fq
2021-05-02 20:03:13 +01:00
sudo pkg install -y cmake py38-s3cmd wget curl jq samurai
2019-03-19 03:37:48 +00:00
ZIGDIR="$(pwd)"
2022-02-16 02:37:00 +00:00
CACHE_BASENAME="zig+llvm+lld+clang-x86_64-freebsd-gnu-0.9.1"
2019-03-19 03:37:48 +00:00
PREFIX="$HOME/$CACHE_BASENAME"
cd $HOME
2020-03-22 19:14:46 +00:00
wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
2019-03-19 03:37:48 +00:00
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
2020-09-29 20:10:38 +01:00
# 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
2019-03-19 03:37:48 +00:00
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
2021-04-15 06:59:17 +01:00
samu install
2019-03-19 04:38:24 +00:00
# TODO ld.lld: error: undefined symbol: main
# >>> referenced by crt1_c.c:75 (/usr/src/lib/csu/amd64/crt1_c.c:75)
# >>> /usr/lib/crt1.o:(_start)
#release/bin/zig test ../test/behavior.zig -fno-stage1 -fLLVM -I ../test
# Here we skip some tests to save time.
release/bin/zig build test -Dskip-stage1 -Dskip-non-native
2019-03-19 03:37:48 +00:00
if [ -f ~/.s3cfg ]; then
mv ../LICENSE release/
mv ../zig-cache/langref.html release/
2019-03-19 03:37:48 +00:00
mv release/bin/zig release/
rmdir release/bin
2019-03-21 03:19:18 +00:00
GITBRANCH=$(basename $GITHUB_REF)
2019-03-19 03:37:48 +00:00
VERSION=$(release/zig version)
DIRNAME="zig-freebsd-x86_64-$VERSION"
TARBALL="$DIRNAME.tar.xz"
mv release "$DIRNAME"
tar cfJ "$TARBALL" "$DIRNAME"
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
2019-03-19 03:37:48 +00:00
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
2019-11-03 19:55:09 +00:00
# avoid leaking oauth token
set +x
OAUTH_TOKEN="$(cat ~/.oauth_token)"
cd "$ZIGDIR"
./ci/srht/on_master_success "$VERSION" "$OAUTH_TOKEN"
fi
2019-03-19 03:37:48 +00:00
fi