diff --git a/zig-0.11.0-1.build.sh b/zig-0.11.0-1.build.sh new file mode 100755 index 0000000..b631864 --- /dev/null +++ b/zig-0.11.0-1.build.sh @@ -0,0 +1,54 @@ +#! /bin/bash + +PKG=zig +VERSION=0.11.0 +LLVM_VERSION=16.0.1-0 +BUILD=1 + +PREFIX=/pkg/$PKG-$VERSION-$BUILD +if [ -n "$TESTING" ]; then PREFIX=/dev/shm/$PKG-$VERSION-$BUILD ; fi + +set -xe +umask 022 + +BUILD_TMPDIR=/dev/shm/$PKG-$VERSION-$BUILD.build.tmp +test -d $BUILD_TMPDIR && ( chmod -R u+rwx $BUILD_TMPDIR || true ; rm -rf $BUILD_TMPDIR ) +mkdir -p $BUILD_TMPDIR/home +export TMPDIR=$BUILD_TMPDIR +export HOME=$BUILD_TMPDIR/home + +exec $PREFIX/profile <<-EOF + PATH=$PREFIX/bin:\$PATH + if [ -d $PREFIX/.compatlibs ]; then export LD_LIBRARY_PATH=$PREFIX/.compatlibs\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} ; fi +EOF +. $PREFIX/profile + +export MAKEFLAGS="-j $(nproc)" + +BUILDDIR=$PREFIX/build + +mkdir -p $BUILDDIR +cd $BUILDDIR + +test -e zig-${VERSION}.tar.xz || wget https://ziglang.org/download/${VERSION}/zig-${VERSION}.tar.xz +test -d zig-${VERSION} || tar xvf zig-${VERSION}.tar.xz +cd zig-${VERSION} + +mkdir -p build +cd build + +. /pkg/llvm-${LLVM_VERSION}/profile +cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DZIG_PIE=ON \ + -DZIG_STATIC_LLVM=ON \ + .. + +make +make install + +exit