void-packages/srcpkgs/crystal-bin/template

50 lines
2.5 KiB
Bash

# Template file for 'crystal-bin'
pkgname=crystal-bin
version=0.24.0
_binary_revision=2
revision=1
only_for_archs="i686 x86_64"
depends="gc gc-devel libatomic_ops pcre pcre-devel libevent libevent-devel llvm"
short_desc="The Crystal Programming Language - precompiled binaries"
maintainer="lvmbdv <ata.kuyumcu@protonmail.com>"
license="Apache-2.0"
homepage="https://crystal-lang.org/"
distfiles="https://github.com/crystal-lang/crystal/releases/download/0.24.0/crystal-${version}-${_binary_revision}-linux-${XBPS_TARGET_MACHINE}.tar.gz"
#conflicts="crystal"
nopie=yes
case "$XBPS_TARGET_MACHINE" in
i686)
checksum=206be40ae6bb486cf24745f377475f0e311c84b215119372e9ca13768201a460
;;
x86_64)
checksum=9cfdb67885aafb9781c678f20df4275c87365ebe0e9411e17dcb6f84e38e7498
;;
esac
do_extract() {
tar xfz ${XBPS_SRCDISTDIR}/${pkgname}-${version}/crystal-${version}-${_binary_revision}-linux-${XBPS_TARGET_MACHINE}.tar.gz --strip-components=1 -C ${wrksrc}
}
post_extract() {
# Check for libtls to determine if libssl is coming from LibreSSL, as suggested by Vaelatern
sed -i 's/OPENSSL_102 = .*/OPENSSL_102 = {{ `command -v pkg-config > \/dev\/null \&\& pkg-config --atleast-version=1.0.2 libssl \&\& pkg-config --exists libtls || printf succ`.stringify == "succ" }}/' ${wrksrc}/src/openssl/lib_ssl.cr
sed -i 's/OPENSSL_102 = .*/OPENSSL_102 = {{ `command -v pkg-config > \/dev\/null \&\& pkg-config --atleast-version=1.0.2 libcrypto \&\& pkg-config --exists libtls || printf succ`.stringify == "succ" }}/' ${wrksrc}/src/openssl/lib_crypto.cr
sed -i 's/OPENSSL_110 = .*/OPENSSL_110 = {{ `command -v pkg-config > \/dev\/null \&\& pkg-config --atleast-version=1.1.0 libssl \&\& pkg-config --exists libtls || printf succ`.stringify == "succ" }}/' ${wrksrc}/src/openssl/lib_ssl.cr
sed -i 's/OPENSSL_110 = .*/OPENSSL_110 = {{ `command -v pkg-config > \/dev\/null \&\& pkg-config --atleast-version=1.1.0 libcrypto \&\& pkg-config --exists libtls || printf succ`.stringify == "succ" }}/' ${wrksrc}/src/openssl/lib_crypto.cr
}
do_install() {
vmkdir /usr/bin
vmkdir /usr/lib/crystal
vmkdir /usr/share/doc/crystal
vmkdir /usr/share/bash-completion/completions/crystal
vmkdir /usr/share/zsh/site-functions/_crystal
vcopy etc/completion.bash /usr/share/bash-completion/completions/crystal
vcopy etc/completion.zsh /usr/share/zsh/site-functions/_crystal
vcopy samples /usr/share/doc/crystal
install -m 755 ${FILESDIR}/crystal ${DESTDIR}/usr/bin
vcopy src/* /usr/lib/crystal
vbin embedded/bin/crystal crystal-bin
}