void-packages/srcpkgs/nim/template

60 lines
1.5 KiB
Bash

# Template file for 'nim'
pkgname=nim
version=0.14.2
revision=1
_cversion=0.13.0
depends="gcc"
hostmakedepends="ed"
short_desc="The Nim programming language"
maintainer="allan <mail@may.mooo.com>"
license="MIT"
homepage="http://nim-lang.org/"
distfiles="https://github.com/nim-lang/Nim/archive/v${version}.tar.gz
https://github.com/nim-lang/csources/archive/v${_cversion}.tar.gz>csources.tar.gz"
checksum="5a98586f136c8f7a3c8d02245844bc87d05b3673410783d85d810d5bedff7491
fe6aee48c5c2585eea14a7cb338bd3766e3d104a22195a79a53c35c8de371f64"
build_wrksrc=Nim-$version
create_wrksrc=yes
nopie=yes
post_extract() {
mv csources-$_cversion $build_wrksrc/csources
}
do_build() {
cd csources
sh build.sh
cd ..
bin/nim c koch
./koch boot -d:release
case "$XBPS_TARGET_MACHINE" in
arm*)
ed config/nim.cfg <<-EDIT
,s/^arm.linux.gcc.exe .*/arm.linux.gcc.exe = "$CC"/
,s/^arm.linux.gcc.linkerexe .*/arm.linux.gcc.linkerexe = "$CC"/
w
q
EDIT
bin/nim c -d:release --os:linux --cpu:arm compiler/nim;;
esac
}
do_install() {
./koch install ${DESTDIR}/usr/lib
rm -rf ${DESTDIR}/usr/lib/nim/compiler/nim{,0,1,2,cache}
if [ "$CROSS_BUILD" ]; then
mv compiler/nim ${DESTDIR}/usr/lib/nim/bin/nim
fi
vmkdir usr/bin
vmkdir usr/share/nim
ln -sf /usr/lib/nim/bin/nim ${DESTDIR}/usr/bin/nim
cp -r doc examples ${DESTDIR}/usr/lib/nim
ln -sf /usr/lib/nim/doc ${DESTDIR}/usr/share/nim/doc
ln -sf /usr/lib/nim/examples ${DESTDIR}/usr/share/nim/examples
vlicense copying.txt
}