From 8da09b74213b90ac3640c1bc1accc29b730f182d Mon Sep 17 00:00:00 2001 From: Niclas Hofmann Date: Fri, 19 Jan 2024 12:41:50 +0100 Subject: [PATCH] zig: fix wrong cmake-flags This fixes #269. Values for `CMAKE_INSTALL_RPATH`, `CMAKE_PREFIX_PATH` and `LLD_INCLUDE_DIRS` were wrong or unnecessary. Alse use Release mode instead of Debug. --- zig-0.11.0-1.build.sh | 54 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 zig-0.11.0-1.build.sh 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