start producing freebsd binaries

This commit is contained in:
Andrew Kelley 2019-03-18 23:37:48 -04:00
parent fca83876d8
commit 0c6e687436
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
2 changed files with 56 additions and 37 deletions

View File

@ -1,43 +1,10 @@
image: freebsd/latest
packages:
- cmake
- ninja
- llvm70
- py27-s3cmd
secrets:
- 6c60aaee-92e7-4e7d-812c-114817689b4d
sources:
- https://github.com/ziglang/zig
tasks:
- build: |
cd zig && mkdir build && cd build
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release
ninja install
- test: |
cd zig/build
bin/zig test ../test/stage1/behavior.zig
bin/zig test ../std/special/compiler_rt.zig
bin/zig test ../test/stage1/behavior.zig --library c
bin/zig test ../std/special/compiler_rt.zig --library c
bin/zig test ../test/stage1/behavior.zig --release-fast
bin/zig test ../std/special/compiler_rt.zig --release-fast
bin/zig test ../test/stage1/behavior.zig --release-fast --library c
bin/zig test ../std/special/compiler_rt.zig --release-fast --library c
bin/zig test ../test/stage1/behavior.zig --release-small --library c
bin/zig test ../std/special/compiler_rt.zig --release-small --library c
bin/zig test ../test/stage1/behavior.zig --release-small
bin/zig test ../std/special/compiler_rt.zig --release-small
bin/zig test ../test/stage1/behavior.zig --release-safe
bin/zig test ../std/special/compiler_rt.zig --release-safe
bin/zig test ../test/stage1/behavior.zig --release-safe --library c
bin/zig test ../std/special/compiler_rt.zig --release-safe --library c
# TODO enable all tests
#bin/zig build --build-file ../build.zig test
# TODO integrate with the download page updater and make a
# static build available to download for FreeBSD.
# This will require setting up a cache of LLVM/Clang built
# statically.
- build: cd zig && ./ci/srht/freebsd_script

52
ci/srht/freebsd_script Executable file
View File

@ -0,0 +1,52 @@
#!/bin/sh
ZIGDIR="$(pwd)"
CACHE_BASENAME="llvm+clang-8.0.0-freebsd-x86_64-release"
PREFIX="$HOME/$CACHE_BASENAME"
TMPDIR="$HOME/tmpz"
JOBS="-j$(sysctl -n hw.ncpu)"
rm -rf $PREFIX
rm -rf $TMPDIR
mkdir $TMPDIR
cd $HOME
wget -nv "https://ziglang.org/builds/$CACHE_BASENAME.tar.xz"
tar xf "$CACHE_BASENAME.tar.xz"
cd $ZIGDIR
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$(pwd)/release -DZIG_STATIC=ON
make $JOBS install
# TODO test everything. I just made it short to test the part after this
release/bin/zig build --build-file ../build.zig test-behavior -Dskip-release
if [ -f ~/.s3cfg ]; then
mv ../LICENSE release/
mv ../zig-cache/langref.html release/
mv release/bin/zig release/
rmdir release/bin
GITBRANCH=$(git rev-parse --abbrev-ref HEAD)
VERSION=$(release/zig version)
DIRNAME="zig-freebsd-x86_64-$VERSION"
TARBALL="$DIRNAME.tar.xz"
mv release "$DIRNAME"
tar cfJ "$TARBALL" "$DIRNAME"
s3cmd put -P "$TARBALL" s3://ziglang.org/builds/
touch empty
s3cmd put -P empty s3://ziglang.org/builds/zig-freebsd-x86_64-$GITBRANCH.tar.xz --add-header="Cache-Control: max-age=0, must-revalidate" --add-header="x-amz-website-redirect-location:/builds/$TARBALL"
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 "$JSONFILE" s3://ziglang.org/builds/$JSONFILE
fi