archrelease: copy trunk to community-any
[ArchLinux/community.git] / zig / trunk / PKGBUILD
blob5817ab4fbdab80c9ba632a574ca3bcb96689ada8
1 # Maintainer: Daurnimator <daurnimator@archlinux.org>
2 # Contributor: Marc Tiehuis <marctiehuis@gmail.com>
4 pkgname=zig
5 pkgver=0.10.1
6 pkgrel=3
7 pkgdesc='a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software'
8 arch=('x86_64')
9 url='https://ziglang.org/'
10 license=('MIT')
11 options=('!lto')
12 depends=('clang' 'lld' 'llvm-libs')
13 makedepends=('cmake' 'llvm')
14 checkdepends=('lib32-glibc')
15 source=("https://ziglang.org/download/$pkgver/zig-$pkgver.tar.xz")
16 sha256sums=('69459bc804333df077d441ef052ffa143d53012b655a51f04cfef1414c04168c')
18 build() {
19     cd "$pkgname-$pkgver"
21     local cmake_vars=(
22         CMAKE_INSTALL_PREFIX=/usr
24         # The zig CMakeLists uses build type Debug if not set
25         # override it back to None so makepkg env vars are respected
26         CMAKE_BUILD_TYPE=None
28         ZIG_SHARED_LLVM=ON
30         ZIG_TARGET_MCPU=baseline
31     )
32     cmake -B build "${cmake_vars[@]/#/-D}" .
33     cmake --build build
36 check() {
37     cd "$pkgname-$pkgver"
38     # ugly workaround until test target is provided
39     # https://github.com/ziglang/zig/issues/14240
40     DESTDIR="./testinstall" cmake --install build
41     ./testinstall/usr/bin/zig build test -Dconfig_h=build/config.h \
42       -Dstatic-llvm=false \
43       -Denable-llvm=true \
44       -Dskip-non-native=true
47 package() {
48     cd "$pkgname-$pkgver"
50     install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
52     DESTDIR="$pkgdir" cmake --install build