aports/community/zig/APKBUILD
2025-05-24 01:01:10 +00:00

73 lines
1.9 KiB
Text

# 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.1
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
makedepends="
clang$_llvmver-dev
cmake
libxml2-dev
lld$_llvmver-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
"
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="
b2b96f241216a46503af95a1175c967ac869391cc87fcb42db2c29d9d513e7ab19c4f4ced2c078481c36aea95f412f3162a8b319aa86b5e2462af567554e8216 zig-0.14.1.tar.xz
"