112 lines
4.8 KiB
Bash
112 lines
4.8 KiB
Bash
# Template file for 'crystal'
|
|
pkgname=crystal
|
|
version=0.26.0
|
|
revision=1
|
|
_shardsversion=0.8.1
|
|
_bootstrapversion=0.26.0
|
|
_bootstraprevision=1
|
|
hostmakedepends="git llvm"
|
|
makedepends="gc-devel libatomic_ops pcre-devel libevent-devel libyaml-devel
|
|
libxml2-devel"
|
|
depends="gc-devel libatomic_ops pcre-devel libevent-devel libyaml-devel
|
|
libxml2-devel gmp-devel libressl-devel llvm gcc pkg-config"
|
|
checkdepends="readline-devel libyaml-devel gmp-devel libressl-devel"
|
|
short_desc="The Crystal Programming Language"
|
|
maintainer="lvmbdv <ata.kuyumcu@protonmail.com>"
|
|
license="Apache-2.0"
|
|
homepage="https://crystal-lang.org/"
|
|
distfiles="
|
|
https://github.com/crystal-lang/crystal/archive/${version}.tar.gz
|
|
https://github.com/crystal-lang/shards/archive/v${_shardsversion}.tar.gz"
|
|
checksum="e98cf1403d5182fce888a120cda61918c329244765eaa265a17038bbfb217ba3
|
|
75c74ab6acf2d5c59f61a7efd3bbc3c4b1d65217f910340cb818ebf5233207a5"
|
|
nocross="FIXME: someone needs to sort out the llvm --cxxflags for cross building"
|
|
_crystalflags="--release --no-debug --progress"
|
|
|
|
build_options="binary_bootstrap"
|
|
build_options_default="binary_bootstrap"
|
|
desc_option_binary_bootstrap="Bootstrap using precompiled binaries"
|
|
|
|
if [ "$build_option_binary_bootstrap" ]; then
|
|
case "$XBPS_MACHINE" in
|
|
x86_64)
|
|
distfiles+=" https://github.com/crystal-lang/crystal/releases/download/${_bootstrapversion}/crystal-${_bootstrapversion}-${_bootstraprevision}-linux-x86_64.tar.gz"
|
|
checksum+=" 856c6fe8b5104ea9bc9aeaf64e21bacb9082c7edc3ee4e27ad3c462f40b06af5"
|
|
;;
|
|
i686)
|
|
distfiles+=" https://github.com/crystal-lang/crystal/releases/download/${_bootstrapversion}/crystal-${_bootstrapversion}-${_bootstraprevision}-linux-i686.tar.gz"
|
|
checksum+=" 2c822deabd2c5ab2151b8545f8c9b67bfa50515f33bb0b7ebdfcec4c83bbfac5"
|
|
;;
|
|
*)
|
|
broken="cannot be built on $XBPS_MACHINE"
|
|
;;
|
|
esac
|
|
else
|
|
hostmakedepends+=" crystal"
|
|
fi
|
|
|
|
do_extract() {
|
|
mkdir -p ${wrksrc}/{shards,$(vopt_if binary_bootstrap bootstrap)}
|
|
|
|
tar xfz ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${version}.tar.gz --strip-components=1 -C ${wrksrc}
|
|
tar xfz ${XBPS_SRCDISTDIR}/${pkgname}-${version}/v${_shardsversion}.tar.gz --strip-components=1 -C ${wrksrc}/shards
|
|
if [ "$build_option_binary_bootstrap" ]; then
|
|
tar xf ${XBPS_SRCDISTDIR}/${pkgname}-${version}/crystal-${_bootstrapversion}-${_bootstraprevision}-linux-${XBPS_TARGET_MACHINE}.tar.gz \
|
|
--strip-components=1 -C ${wrksrc}/bootstrap
|
|
fi
|
|
}
|
|
|
|
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_build() {
|
|
if [ -z ${disable_parallel_build} ] && [ -n ${XBPS_MAKEJOBS} ]; then
|
|
_crystalflags="${_crystalflags} --threads ${makejobs:2:4}"
|
|
fi
|
|
make ${makejobs} release=1 FLAGS="${_crystalflags}" \
|
|
CRYSTAL_CONFIG_PATH="lib:/usr/lib/crystal" \
|
|
CRYSTAL_CONFIG_VERSION="${version}" \
|
|
CRYSTAL_CACHE_DIR="/tmp/crystal" \
|
|
$(vopt_if binary_bootstrap PATH="${wrksrc}/bootstrap/bin:$PATH")
|
|
make ${makejobs} docs CRYSTAL_CACHE_DIR="/tmp/crystal"
|
|
|
|
cd shards
|
|
${wrksrc}/bin/crystal build ${_crystalflags} -o bin/shards src/shards.cr
|
|
}
|
|
|
|
do_check() {
|
|
make ${makejobs} spec \
|
|
CRYSTAL_CONFIG_VERSION="${version}" \
|
|
CRYSTAL_CACHE_DIR="/tmp/crystal" \
|
|
PATH=".build:$PATH"
|
|
|
|
cd shards
|
|
make test CRYSTAL_BIN="${wrksrc}/bin/crystal"
|
|
}
|
|
|
|
do_install() {
|
|
vmkdir /usr/bin
|
|
vmkdir /usr/lib/crystal
|
|
vmkdir /usr/share/doc/crystal
|
|
vmkdir /usr/share/doc/crystal/api
|
|
vmkdir /usr/share/bash-completion/completions/crystal
|
|
vmkdir /usr/share/zsh/site-functions/_crystal
|
|
vmkdir /usr/share/licenses/shards
|
|
|
|
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
|
|
vcopy docs/* /usr/share/doc/crystal/api
|
|
vcopy src/* /usr/lib/crystal
|
|
vbin .build/crystal crystal
|
|
vlicense LICENSE
|
|
vman man/crystal.1
|
|
vbin shards/bin/shards
|
|
cp shards/LICENSE ${DESTDIR}/usr/share/licenses/shards
|
|
}
|