2017-12-16 21:41:07 +01:00
|
|
|
# Template file for 'crystal'
|
|
|
|
pkgname=crystal
|
2018-07-17 20:14:35 +02:00
|
|
|
version=0.25.1
|
|
|
|
revision=1
|
|
|
|
_shardsversion=0.8.1
|
|
|
|
_bootstrapversion=0.25.1
|
|
|
|
_bootstraprevision=1
|
2018-03-08 12:42:47 +01:00
|
|
|
hostmakedepends="git llvm"
|
2018-01-16 20:40:10 +01:00
|
|
|
makedepends="gc-devel libatomic_ops pcre-devel libevent-devel libyaml-devel
|
|
|
|
libxml2-devel"
|
2017-12-16 21:41:07 +01:00
|
|
|
depends="gc-devel libatomic_ops pcre-devel libevent-devel libyaml-devel
|
2018-03-08 12:42:47 +01:00
|
|
|
libxml2-devel gmp-devel libressl-devel llvm gcc pkg-config"
|
2017-12-16 21:41:07 +01:00
|
|
|
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/"
|
2018-01-18 14:49:29 +01:00
|
|
|
distfiles="
|
2018-07-17 20:14:35 +02:00
|
|
|
https://github.com/crystal-lang/crystal/archive/${version}.tar.gz
|
2018-01-18 14:49:29 +01:00
|
|
|
https://github.com/crystal-lang/shards/archive/v${_shardsversion}.tar.gz"
|
2018-07-17 20:14:35 +02:00
|
|
|
checksum="9b5a7bd2de67ab36cc5430133228a1e656a431fc7d928a37a61109bd8da77fc6
|
|
|
|
75c74ab6acf2d5c59f61a7efd3bbc3c4b1d65217f910340cb818ebf5233207a5"
|
2017-12-22 18:45:17 +01:00
|
|
|
nocross="FIXME: someone needs to sort out the llvm --cxxflags for cross building"
|
2017-12-24 23:29:06 +01:00
|
|
|
_crystalflags="--release --no-debug --progress"
|
2017-12-16 21:41:07 +01:00
|
|
|
|
2018-01-16 20:40:10 +01:00
|
|
|
build_options="binary_bootstrap"
|
|
|
|
build_options_default="binary_bootstrap"
|
2018-03-08 12:42:47 +01:00
|
|
|
desc_option_binary_bootstrap="Bootstrap using precompiled binaries"
|
2018-01-16 20:40:10 +01:00
|
|
|
|
2018-01-18 14:49:29 +01:00
|
|
|
if [ "$build_option_binary_bootstrap" ]; then
|
2018-03-08 12:42:47 +01:00
|
|
|
case "$XBPS_MACHINE" in
|
2018-01-18 14:49:29 +01:00
|
|
|
x86_64)
|
2018-07-17 20:14:35 +02:00
|
|
|
distfiles+=" https://github.com/crystal-lang/crystal/releases/download/${_bootstrapversion}/crystal-${_bootstrapversion}-${_bootstraprevision}-linux-x86_64.tar.gz"
|
|
|
|
checksum+=" 943ea77a976e80d2b3558ef525d2c9fa7fc3d41d6b5799923e378408d75e557e"
|
2018-01-18 14:49:29 +01:00
|
|
|
;;
|
|
|
|
i686)
|
2018-08-03 11:34:07 +02:00
|
|
|
distfiles+=" https://github.com/crystal-lang/crystal/releases/download/${_bootstrapversion}/crystal-${_bootstrapversion}-${_bootstraprevision}-linux-i686.tar.gz"
|
2018-07-17 20:14:35 +02:00
|
|
|
checksum+=" ff0e38021cb20ad7cea3aaba78350a4ae22c4dc48563ba482aa3a87eb07e1044"
|
2018-01-18 14:49:29 +01:00
|
|
|
;;
|
2018-03-08 12:42:47 +01:00
|
|
|
*)
|
|
|
|
broken="cannot be built on $XBPS_MACHINE"
|
2018-01-18 14:49:29 +01:00
|
|
|
;;
|
|
|
|
esac
|
2018-03-08 12:42:47 +01:00
|
|
|
else
|
|
|
|
hostmakedepends+=" crystal"
|
2018-01-18 14:49:29 +01:00
|
|
|
fi
|
|
|
|
|
2018-01-16 20:40:10 +01:00
|
|
|
do_extract() {
|
|
|
|
mkdir -p ${wrksrc}/{shards,$(vopt_if binary_bootstrap bootstrap)}
|
|
|
|
|
2018-07-17 20:14:35 +02:00
|
|
|
tar xfz ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${version}.tar.gz --strip-components=1 -C ${wrksrc}
|
2018-01-16 20:40:10 +01:00
|
|
|
tar xfz ${XBPS_SRCDISTDIR}/${pkgname}-${version}/v${_shardsversion}.tar.gz --strip-components=1 -C ${wrksrc}/shards
|
2018-01-18 14:49:29 +01:00
|
|
|
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
|
2018-01-16 20:40:10 +01:00
|
|
|
}
|
|
|
|
|
2017-12-16 21:41:07 +01:00
|
|
|
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() {
|
2017-12-24 23:29:06 +01:00
|
|
|
if [ -z ${disable_parallel_build} ] && [ -n ${XBPS_MAKEJOBS} ]; then
|
|
|
|
_crystalflags="${_crystalflags} --threads ${makejobs:2:4}"
|
|
|
|
fi
|
|
|
|
make ${makejobs} release=1 FLAGS="${_crystalflags}" \
|
2017-12-16 21:41:07 +01:00
|
|
|
CRYSTAL_CONFIG_PATH="lib:/usr/lib/crystal" \
|
|
|
|
CRYSTAL_CONFIG_VERSION="${version}" \
|
2018-01-16 20:40:10 +01:00
|
|
|
CRYSTAL_CACHE_DIR="/tmp/crystal" \
|
|
|
|
$(vopt_if binary_bootstrap PATH="${wrksrc}/bootstrap/bin:$PATH")
|
2017-12-24 23:29:06 +01:00
|
|
|
make ${makejobs} docs CRYSTAL_CACHE_DIR="/tmp/crystal"
|
|
|
|
|
2018-01-16 20:40:10 +01:00
|
|
|
cd shards
|
2017-12-24 23:29:06 +01:00
|
|
|
${wrksrc}/bin/crystal build ${_crystalflags} -o bin/shards src/shards.cr
|
2017-12-16 21:41:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
do_check() {
|
|
|
|
make ${makejobs} spec \
|
|
|
|
CRYSTAL_CONFIG_VERSION="${version}" \
|
|
|
|
CRYSTAL_CACHE_DIR="/tmp/crystal" \
|
|
|
|
PATH=".build:$PATH"
|
2017-12-24 23:29:06 +01:00
|
|
|
|
2018-01-16 20:40:10 +01:00
|
|
|
cd shards
|
2017-12-24 23:29:06 +01:00
|
|
|
make test CRYSTAL_BIN="${wrksrc}/bin/crystal"
|
2017-12-16 21:41:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2017-12-24 23:29:06 +01:00
|
|
|
vmkdir /usr/share/licenses/shards
|
2017-12-16 21:41:07 +01:00
|
|
|
|
|
|
|
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
|
2018-01-16 20:40:10 +01:00
|
|
|
vbin shards/bin/shards
|
|
|
|
cp shards/LICENSE ${DESTDIR}/usr/share/licenses/shards
|
2017-12-16 21:41:07 +01:00
|
|
|
}
|