# Contributor: Jakub Jirutka # Contributor: Milan P. Stanić # Maintainer: Jakub Jirutka pkgname=crystal pkgver=0.32.1 pkgrel=0 _bootver=0.31.1 _llvmver=8 pkgdesc="The Crystal Programming Language" url="https://crystal-lang.org/" arch="x86_64" # aarch64 disabled, details in #11017 license="Apache-2.0" depends="gc-dev libatomic_ops libevent-dev libevent-static gcc gmp-dev pcre-dev" checkdepends="openssl-dev libxml2-dev readline-dev tzdata yaml-dev zlib-dev" makedepends="llvm$_llvmver-dev llvm$_llvmver-static zlib-static" subpackages="$pkgname-doc $pkgname-bash-completion:bashcomp:noarch $pkgname-zsh-completion:zshcomp:noarch " source="$pkgname-$pkgver.tar.gz::https://github.com/crystal-lang/$pkgname/archive/$pkgver.tar.gz https://dev.alpinelinux.org/archive/crystal/crystal-$_bootver-x86_64-alpine-linux-musl.tar.gz fix-spec-std-kernel-spec.cr.patch fix-std-xml-spec.cr.patch fix-version-string.patch fix-std-http-cookie-exp.patch fix-spec-colorize.patch " builddir="$srcdir/$pkgname-$pkgver" _coredir="/usr/lib/$pkgname/core" _shardsdir="/usr/lib/$pkgname/shards" export CRYSTAL_CONFIG_VERSION="$pkgver" export CRYSTAL_CACHE_DIR="$srcdir/.cache" # Build static crystal binary and upload it to dev.a.o, so it can be used # for building crystal next time (needed for bootstrapping). # NOTE: After https://github.com/crystal-lang/crystal/issues/5689 is fixed, # we can also use prebuilt binary from upstream if needed. snapshot() { local binary="$builddir/.build/crystal" local tarname="$pkgname-$pkgver-$CTARGET" if [ ! -f "$binary" ] || ! file "$binary" | grep -qw 'statically linked'; then msg "Building statically linked crystal..." BUILD_STATIC=1 abuild clean deps unpack prepare build fi cd "$srcdir" strip "$builddir"/.build/crystal install -D -m 755 "$builddir"/.build/crystal "$tarname"/bin/crystal tar -czf "$tarname.tar.gz" "$tarname" msg "Uploading $tarname.tar.gz to dev.alpinelinux.org" scp "$tarname.tar.gz" dev.alpinelinux.org:/archive/$pkgname/ APKBUILD="../APKBUILD" abuild undeps } prepare() { default_prepare cat > Makefile.local <<-EOF progress = 1 threads = ${JOBS:-2} verbose = 1 FLAGS = --verbose --target $CTARGET ${BUILD_STATIC:+"--link-flags=-no-pie"} LLVM_CONFIG = /usr/lib/llvm$_llvmver/bin/llvm-config EOF } build() { make crystal \ CRYSTAL_CONFIG_PATH="lib:$_shardsdir:$_coredir" \ PATH="$srcdir/$pkgname-$_bootver-$CBUILD/bin:$PATH" \ LLVM_CONFIG="llvm$_llvmver-config" \ release=1 \ static=${BUILD_STATIC:-} } check() { make spec LLVM_CONFIG="llvm$_llvmver-config" PATH=".build:$PATH" \ SPEC_FLAGS="--no-color --verbose" } package() { install -D -m 755 .build/crystal "$pkgdir"/usr/bin/crystal install -D -m 644 man/crystal.1 "$pkgdir"/usr/share/man/man1/crystal.1 mkdir -p "$pkgdir$_coredir" "$pkgdir$_shardsdir" cp -r src/* "$pkgdir$_coredir"/ cd "$pkgdir$_coredir" rm ext/sigfault.* llvm/ext/llvm_ext.o } bashcomp() { pkgdesc="Bash completions for $pkgname" depends="" install_if="$pkgname=$pkgver-r$pkgrel bash-completion" cd "$builddir" install -D -m 644 etc/completion.bash \ "$subpkgdir"/usr/share/bash-completion/completions/$pkgname } zshcomp() { pkgdesc="ZSH completions for $pkgname" depends="" install_if="$pkgname=$pkgver-r$pkgrel zsh" cd "$builddir" install -D -m 644 etc/completion.zsh \ "$subpkgdir"/usr/share/zsh/site-functions/_$pkgname } sha512sums="d83575f4c7953054824f13516cdc04bd7576bf7165754d96a9f4970e2a6cbf779b4db6806d3eeac465ed0c223c203ef95fc3bda70d1ef9f7c96ec96cd076283d crystal-0.32.1.tar.gz 2fc7384bc58a04c559ab38a8b284ce9e7475c57a03b59928c6d884fb79cc620f930b83268f82dfa7f107477eac5befbcc8081b2f41b2214172d1f320e7495f37 crystal-0.31.1-x86_64-alpine-linux-musl.tar.gz ee1d81b40a9b15b2abfecbc61a1ef830700cc5613f9d2626722e8393633ed5d40329ac1fc2813b08b66c689876d3bd8a9f949a22beeda572ea3d4753f58417a8 fix-spec-std-kernel-spec.cr.patch dabfb0ca7859785dd1ed75f5eaea7a7c25b09a61d7c9c81f4cbac4ece7dc475d531ce9fd6d1002db9ec5d7067051ea34fd77ab590c2c733034f430c89229cfa9 fix-std-xml-spec.cr.patch 1bb7d649841a7b0f66fdebbb75647ef8958ce7fb3437f0a6303ad21750af79becdcad87ddcf9353d48d466495a6c5837171b571a46412fd746c741296a67ad93 fix-version-string.patch 4fd246be702982a012c3092e1742a5b80566b6d43888f9c09b25c27efcb56f5417a77234b5d36ebdcf89c5ad3a0571ca717ab26ed833c05497a4bf12328fcf17 fix-std-http-cookie-exp.patch 2a52f81c36c85f138fa7f59483fe417e7fc01bc38b1d4061b37487a2d17c2a698b89813b51c43c6fc6bb65b1b0aa8f108427f85e86fe59fe97a3e6e075cdac54 fix-spec-colorize.patch"