Skip to content

Instantly share code, notes, and snippets.

@daurnimator
Last active April 9, 2019 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daurnimator/165fe1dd5252c5edc2ed0d16a1567b47 to your computer and use it in GitHub Desktop.
Save daurnimator/165fe1dd5252c5edc2ed0d16a1567b47 to your computer and use it in GitHub Desktop.
zig 0.4.0 PKGBUILD
# Maintainer: Daurnimator <daurnimator@archlinux.org>
# Contributor: Marc Tiehuis <marctiehuis@gmail.com>
pkgname=zig
pkgver=0.4.0
pkgrel=1
pkgdesc='a programming language prioritizing robustness, optimality, and maintainability'
arch=('x86_64')
url='https://ziglang.org/'
license=('MIT')
depends=('clang' 'llvm-libs' 'lld')
makedepends=('cmake' 'llvm')
source=("https://ziglang.org/download/$pkgver/zig-$pkgver.tar.xz"
'force_dynamic_llvm.patch'
'no_stage2_artifacts.patch')
sha256sums=('fec1f3f6b359a3d942e0a7f9157b3b30cde83927627a0e1ea95c54de3c526cfc'
'986ffeb8f53c4b1651dcf8d252e5a5ffe85243b2dccc211c4ca972522eabd015'
'487546991703485d688413546ad36f334019c51c5a4a20f7ab750a521cb03f9b')
prepare() {
cd "$srcdir/$pkgname-$pkgver"
patch -Np1 -i "$srcdir/force_dynamic_llvm.patch"
patch -Np1 -i "$srcdir/no_stage2_artifacts.patch"
}
build() {
cd "$srcdir/$pkgname-$pkgver"
mkdir -p build
cd build
# The zig CMakeLists uses build type Debug if not set
# override it back to None so makepkg env vars are respected
# Zig vendors LLD as a workaround for an upstream bug when targetting OSX
# - https://github.com/ziglang/zig/issues/662
# - https://bugs.llvm.org/show_bug.cgi?id=32254
# - http://lists.llvm.org/pipermail/llvm-dev/2017-August/116904.html
cmake \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_INSTALL_PREFIX=/usr \
-DZIG_FORCE_EXTERNAL_LLD=ON \
..
make
}
check() {
cd "$srcdir/$pkgname-$pkgver/build"
# test suite requires zig to be installed first
# https://github.com/ziglang/zig/issues/2221
# For now, just check the version subcommand works
./zig version
}
package() {
cd "$srcdir/$pkgname-$pkgver"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
make -C build DESTDIR="$pkgdir" install
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment