void-packages/srcpkgs/choosenim/template

67 lines
1.9 KiB
Bash

# Template file for 'choosenim'
pkgname=choosenim
version=0.8.4
revision=1
create_wrksrc=yes
hostmakedepends="git nim openssl-devel pkg-config"
makedepends="openssl-devel zlib-devel libarchive-devel"
depends="gcc"
short_desc="Nim toolchain installer"
maintainer="SolitudeSF <solitudesf@protonmail.com>"
license="MIT"
homepage="https://github.com/dom96/choosenim"
distfiles="${homepage}/archive/v${version}.tar.gz>choosenim-${version}.tar.gz
https://github.com/genotrance/nimarchive/archive/v0.5.4.tar.gz>nimarchive-0.5.4.tar.gz"
checksum="c849fb531a3b19d362288a59cc78044221b01cb752e0f5f40810707e6377b09c
c38e8c66c2eac2bc021d450f2b60d0e45c5355df963d0133930448639c0bd8d4"
case "$XBPS_TARGET_MACHINE" in
ppc-musl) broken="ftbfs" ;;
esac
post_extract() {
mv choosenim-$version/* .
mv nimarchive-0.5.4 nimarchive
}
do_build() {
local arch args
case "$XBPS_TARGET_MACHINE" in
aarch64*) arch=arm64;;
arm*) arch=arm;;
mips*) arch=mips;;
ppc64le*) arch=powerpc64el;;
ppc64*) arch=powerpc64;;
ppc*) arch=powerpc;;
riscv64*) arch=riscv64;;
*) msg_error "choosenim: $XBPS_TARGET_MACHINE unknown to template";;
esac
LDFLAGS+=" $($PKG_CONFIG --libs-only-l --static openssl)"
LDFLAGS+=" $($PKG_CONFIG --libs-only-l --static libarchive)"
LDFLAGS+=" -lrt -ldl -lpthread"
: >nim.cfg
if [ -z "$CROSS_BUILD" ]; then
cat >>nim.cfg <<-EOF
gcc.options.always = "$CPPFLAGS $CFLAGS -pthread"
gcc.options.linker = "$LDFLAGS"
EOF
fi
if [ -n "$arch" ]; then
cat >>nim.cfg <<-EOF
$arch.linux.gcc.exe = "$CC"
$arch.linux.gcc.linkerexe = "$CC"
$arch.linux.gcc.options.always = "$CPPFLAGS $CFLAGS -pthread"
$arch.linux.gcc.options.linker = "$LDFLAGS"
EOF
args="--cpu:$arch"
fi
ln -sf $XBPS_CROSS_BASE/usr/include/archive.h src
ln -sf $XBPS_CROSS_BASE/usr/include/archive_entry.h src
nimble -y build -d:release --passC:-flto "$args" --path:$wrksrc/nimarchive
}
do_install() {
vbin bin/choosenim
vlicense LICENSE
}