aports/testing/zig/APKBUILD
2023-04-28 23:20:54 +02:00

77 lines
2.0 KiB
Plaintext

# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Milan P. Stanić <mps@arvanta.net>
# Maintainer: psykose <alice@ayaya.dev>
pkgname=zig
pkgver=0.10.1
pkgrel=4
pkgdesc="General-purpose programming language designed for robustness, optimality, and maintainability"
url="https://ziglang.org/"
# arm*, x86: fails to build (allocation failed)
# ppc64le,riscv64: builds but the test command crashes
# s390x: blocked by lld-dev
arch="x86_64 aarch64"
license="MIT"
install="$pkgname.pre-upgrade"
_llvmver=15
makedepends="
clang$_llvmver-dev
cmake
libxml2-dev
lld15-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
llvmconfig.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
# XXX: Workaround for missing zig binary in the build dir.
DESTDIR="build/.dest" cmake --install build
cd build
./.dest/usr/bin/zig build docs
}
check() {
./build/.dest/usr/bin/zig build test \
-Dcpu=baseline \
-Drelease \
-Dskip-debug \
-Dskip-release-safe \
-Dskip-release-small \
-Dskip-non-native \
-Dskip-libc
}
package() {
DESTDIR="$pkgdir" cmake --install build
install -Dm644 zig-cache/langref.html \
"$pkgdir"/usr/share/doc/$pkgname/langref.html
}
sha512sums="
d443adf61556bc95470537c6b0371a0ac99d19a06b15635cf1e5055ae7849039680c9006105e06e1bd6ba0fc12da14c54c1d28ac597c7dee17ee3a5cd9cf79f8 zig-0.10.1.tar.xz
61e08b8c0059df3c4a9465ae59a762fe972a1e628c6e015c9919e0c39154e704ae45e365fc697da562ef17f17f15d704ecf92da6ab5d402b69f3b86861c2edcf llvmconfig.patch
"