2019-10-24 11:09:09 -07:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -x
|
|
|
|
set -e
|
|
|
|
|
|
|
|
TRIPLEARCH="$0"
|
|
|
|
TRIPLEOS="$1"
|
|
|
|
TRIPLEABI="$2"
|
|
|
|
BUILDDIR="$(pwd)"
|
|
|
|
DISTDIR="$(pwd)/dist"
|
|
|
|
|
|
|
|
apk update
|
|
|
|
apk add gcc g++ cmake make libc-dev binutils libstdc++ py3-pip clang-static llvm9-static xz llvm9-dev clang-dev zlib-static libxml2-dev
|
|
|
|
pip3 install s3cmd
|
|
|
|
|
|
|
|
mkdir build
|
|
|
|
cd build
|
2019-10-24 11:36:15 -07:00
|
|
|
cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR"
|
2019-10-24 11:09:09 -07:00
|
|
|
|
|
|
|
make -j$(nproc) install
|
|
|
|
./zig build test
|
|
|
|
|
|
|
|
if [ -n "$DRONE_PULL_REQUEST" ]; then
|
|
|
|
mv ../LICENSE "$DISTDIR/"
|
|
|
|
mv ../zig-cache/langref.html "$DISTDIR/"
|
|
|
|
mv "$DISTDIR/bin/zig" "$DISTDIR/"
|
|
|
|
rmdir "$DISTDIR/bin"
|
|
|
|
|
|
|
|
GITBRANCH="$DRONE_BRANCH"
|
|
|
|
VERSION=$("$DISTDIR/zig" version)
|
|
|
|
DIRNAME="zig-$TRIPLEOS-$TRIPLEARCH-$VERSION"
|
|
|
|
TARBALL="$DIRNAME.tar.xz"
|
|
|
|
mv "$DISTDIR" "$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="$TRIPLEARCH-$TRIPLEOS-$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/$TRIPLEARCH-$TRIPLEOS-$VERSION.json"
|
|
|
|
fi
|