aports/community/zig/APKBUILD
2025-03-12 22:06:14 +00:00

79 lines
2.4 KiB
Plaintext

# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Milan P. Stanić <mps@arvanta.net>
# Maintainer: lauren n. liberda <lauren@selfisekai.rocks>
pkgname=zig
pkgver=0.14.0
pkgrel=0
pkgdesc="General-purpose programming language designed for robustness, optimality, and maintainability"
url="https://ziglang.org/"
# arm*, loongarch64, ppc64le, riscv64: we don't build all LLVM targets, but zig requires all.
# previously arm*, x86: fails to build (allocation failed)
# previously ppc64le,riscv64: builds but the test command crashes
# s390x: blocked by lld-dev
arch="x86_64 aarch64"
license="MIT"
install="$pkgname.pre-upgrade"
_llvmver=19
# will need switch to lld$_llvmver-dev later
makedepends="
clang$_llvmver-dev
cmake
libxml2-dev
lld-dev
llvm$_llvmver-dev
samurai
zlib-dev
"
provides="zig-dev=$pkgver-r$pkgrel"
subpackages="$pkgname-doc"
source="https://ziglang.org/download/$pkgver/zig-$pkgver.tar.xz
0001-Compile-Pass-absolute-zig-lib-dir-to-child-processes.patch
0002-Revert-compiler-integrate-ZON-with-the-ZIR-caching-s.patch
"
build() {
local crossopts=
if [ "$CBUILD" != "$CHOST" ]; then
crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
fi
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_PREFIX_PATH=/usr \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DZIG_VERSION="$pkgver" \
-DZIG_SHARED_LLVM=ON \
-DZIG_TARGET_MCPU=baseline \
-DCLANG_INCLUDE_DIRS=/usr/lib/llvm$_llvmver/include \
$crossopts
cmake --build build
./build/stage3/bin/zig build docs \
-Dversion-string="$pkgver"
}
check() {
./build/stage3/bin/zig build test \
-Dcpu=baseline \
-Dskip-debug \
-Dskip-release-safe \
-Dskip-release-small \
-Dskip-non-native \
-Dskip-translate-c
}
package() {
DESTDIR="$pkgdir" cmake --install build
mkdir -p "$pkgdir/usr/share/doc/"
cp -r zig-out/doc "$pkgdir/usr/share/doc/$pkgname"
}
sha512sums="
046462526ec16d56e8dcead8f8b680e99101090766c443f512f308c25860e8416f6fb2be15d4a387baa94f63a6fea6255374874c1ccf19144facbc02226a503b zig-0.14.0.tar.xz
9597678a4026da5b56732b952848e3e9a67183430ac101c59b66c517ae0d06e082b30a5a52c0b155f64955243d0267dba6ce44e0882b264b9efedde4a9ec61f1 0001-Compile-Pass-absolute-zig-lib-dir-to-child-processes.patch
d224e71c35124e5d782aef338e456626f31221037a6867fd4567d018734dfd93e6c9a97bc073e3f7b48b13f16a63608bfe96be3401d75fa553d5124b66d6640d 0002-Revert-compiler-integrate-ZON-with-the-ZIR-caching-s.patch
"