mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-06-08 13:30:09 +02:00
132 lines
3.8 KiB
Text
132 lines
3.8 KiB
Text
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
|
|
# Contributor: Milan P. Stanić <mps@arvanta.net>
|
|
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
|
|
pkgname=crystal
|
|
pkgver=1.16.3
|
|
pkgrel=0
|
|
_bootver=1.15.1
|
|
_llvmver=20
|
|
pkgdesc="The Crystal Programming Language"
|
|
url="https://crystal-lang.org/"
|
|
arch="x86_64 aarch64"
|
|
license="Apache-2.0"
|
|
depends="
|
|
gc-dev
|
|
gcc
|
|
gmp-dev
|
|
libatomic_ops
|
|
musl-dev
|
|
pcre2-dev
|
|
"
|
|
checkdepends="
|
|
openssl-dev
|
|
tzdata
|
|
yaml-dev
|
|
zlib-dev
|
|
"
|
|
makedepends="
|
|
libxml2-dev
|
|
llvm$_llvmver-dev
|
|
"
|
|
[ "${BUILD_STATIC:-0}" -eq 1 ] && makedepends="$makedepends
|
|
gc-static
|
|
libxml2-static
|
|
llvm$_llvmver-static
|
|
pcre2-static
|
|
zlib-static
|
|
zstd-static
|
|
"
|
|
subpackages="$pkgname-doc
|
|
$pkgname-bash-completion
|
|
$pkgname-zsh-completion
|
|
"
|
|
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
|
|
https://dev.alpinelinux.org/archive/crystal/crystal-$_bootver-aarch64-alpine-linux-musl.tar.gz
|
|
"
|
|
|
|
_coredir="/usr/lib/$pkgname/core"
|
|
_shardsdir="/usr/lib/$pkgname/shards"
|
|
|
|
export CRYSTAL_CONFIG_VERSION="$pkgver"
|
|
export CRYSTAL_CACHE_DIR="$srcdir/.cache"
|
|
export LLVM_CONFIG="/usr/lib/llvm$_llvmver/bin/llvm-config"
|
|
|
|
# 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 deps clean 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
|
|
|
|
# FIXME: These specs fail with invalid memory access.
|
|
rm spec/compiler/compiler_spec.cr
|
|
|
|
cat > Makefile.local <<-EOF
|
|
progress = 1
|
|
threads = ${JOBS:-2}
|
|
verbose = 1
|
|
FLAGS = --verbose --target $CTARGET ${BUILD_STATIC:+"--link-flags=-no-pie"}
|
|
LLVM_CONFIG = $LLVM_CONFIG
|
|
EOF
|
|
}
|
|
|
|
build() {
|
|
make crystal \
|
|
CRYSTAL_CONFIG_BUILD_COMMIT= \
|
|
CRYSTAL_CONFIG_PATH="lib:$_shardsdir:$_coredir" \
|
|
PATH="$srcdir/$pkgname-$_bootver-$CBUILD/bin:$PATH" \
|
|
release=1 \
|
|
static=${BUILD_STATIC:-} \
|
|
interpreter=1
|
|
}
|
|
|
|
check() {
|
|
make std_spec threads=1 SPEC_FLAGS='--no-color --verbose'
|
|
|
|
find samples -name '*.cr' -print0 | xargs -0 -tn 1 ./bin/crystal build --no-codegen
|
|
|
|
# Takes ~1 hour on x86_64, ~1.5 hour on aarch64.
|
|
#make compiler_spec threads=1 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"/
|
|
|
|
install -D -m 644 etc/completion.bash \
|
|
"$pkgdir"/usr/share/bash-completion/completions/$pkgname
|
|
install -D -m 644 etc/completion.zsh \
|
|
"$pkgdir"/usr/share/zsh/site-functions/_$pkgname
|
|
}
|
|
|
|
sha512sums="
|
|
4a4a409ad28629c088ddd824fa17a4a1eacf16cb71a644f8df7636208cca0101c0fb190dcad759f1a56e5471fe2094a37d00df47381e54b8259f93f78481f517 crystal-1.16.3.tar.gz
|
|
618a7a7e5ef2ec2cdfb95f4877bdef8e123bc9f8a3f0f07c163fa086aebd39785362c0a6a717a3c626e786ca154124d166da921b71981ce68c7aa53345550753 crystal-1.15.1-x86_64-alpine-linux-musl.tar.gz
|
|
e1d6d2e208ac0f8a5c3bb2b4cf7150ff97ab6b60b2a97e6f3339a74aadf994e1d1613ad42fc46bed54266a5cb6b2b9f744535e9fa2db1008d418a17344d097b6 crystal-1.15.1-aarch64-alpine-linux-musl.tar.gz
|
|
"
|