void-packages/srcpkgs/nim/template
Patrick Pichler db02a69556 nim: update to 1.4.2
Use fixed commit for fusion repo rather than relying on build-time git
clone. (@ahesford)

Closes: #26868 [via git-merge-pr]
2020-12-19 23:46:31 -05:00

109 lines
3.1 KiB
Bash

# Template file for 'nim'
pkgname=nim
version=1.4.2
revision=1
_cversion=0.20.0
_nimbleversion=0.12.0
_fusionversion=e942c649892b2ae3802851fba6bc5d251326e5fb
create_wrksrc=yes
build_wrksrc="Nim-$version"
hostmakedepends="ed"
depends="gcc libressl-devel"
short_desc="Nim programming language"
maintainer="allan <mail@may.mooo.com>"
license="MIT"
homepage="https://nim-lang.org/"
_ghsite="https://github.com/nim-lang"
distfiles="${_ghsite}/Nim/archive/v${version}.tar.gz
${_ghsite}/csources/archive/v${_cversion}.tar.gz>csources-${_cversion}.tar.gz
${_ghsite}/nimble/archive/v${_nimbleversion}.tar.gz>nimble-${_nimbleversion}.tar.gz
${_ghsite}/fusion/archive/${_fusionversion}.tar.gz>fusion-${_fusionversion}.tar.gz"
checksum="fc1e25aa2c667a34fe48160a79472fd5ced35af6478a535919d20b8821277a3a
5e6fd15d90df1a8cb7614c4ffc70aa8c4198cd854d7742016202b96dd0228d3c
0b88d91a450f31641f85379f2d76afb0a013cf783e62144a6534525b9cb1cbac
76d10a2f0f25ba7fb3393bdb800c75e8084758d8ce69e63d07926cd36f555084"
post_extract() {
mv csources-$_cversion $build_wrksrc/csources
mkdir $build_wrksrc/dist
mv nimble-$_nimbleversion $build_wrksrc/dist/nimble
mv fusion-$_fusionversion $build_wrksrc/dist/fusion
}
do_build() {
cd csources
case "$XBPS_TARGET_MACHINE" in
i686*)
CC=cc LD=cc CFLAGS="-Os -pipe" LDFLAGS= \
sh build.sh --cpu i686;;
*)
CC=cc LD=cc CFLAGS="-Os -pipe" LDFLAGS= sh build.sh;;
esac
cd ..
bin/nim c koch
./koch boot -d:release -d:danger
case "$XBPS_TARGET_MACHINE" in
aarch64*) _arch=arm64;;
arm*) _arch=arm;;
ppc64le*) _arch=powerpc64el;;
ppc64*) _arch=powerpc64;;
ppc*) _arch=powerpc;;
esac
case "$XBPS_TARGET_MACHINE"
in arm*|aarch64*|ppc*)
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"/
a
arm64.linux.gcc.exe = "$CC"
arm64.linux.gcc.linkerexe = "$CC"
powerpc.linux.gcc.exe = "$CC"
powerpc.linux.gcc.linkerexe = "$CC"
powerpc64.linux.gcc.exe = "$CC"
powerpc64.linux.gcc.linkerexe = "$CC"
powerpc64el.linux.gcc.exe = "$CC"
powerpc64el.linux.gcc.linkerexe = "$CC"
.
w
q
EDIT
bin/nim c -d:release -d:danger --os:linux --cpu:$_arch --listCmd compiler/nim
for _p in \
dist/nimble/src/nimble \
tools/nimgrep \
nimsuggest/nimsuggest \
nimpretty/nimpretty
do
bin/nim c -d:release --os:linux --cpu:$_arch --listCmd $_p
mv $_p bin
done
;; *)
./koch tools
esac
}
do_install() {
./koch install ${DESTDIR}/usr/lib
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
for _f in nimble nimsuggest nimgrep nimpretty; do
chmod 0755 bin/$_f
cp bin/$_f ${DESTDIR}/usr/lib/nim/bin
ln -sf /usr/lib/nim/bin/$_f ${DESTDIR}/usr/bin/$_f
done
cp -r nimsuggest nimpretty 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
ln -sf /usr/lib/nim/nimsuggest ${DESTDIR}/usr/share/nim/nimsuggest
ln -sf /usr/lib/nim/nimpretty ${DESTDIR}/usr/share/nim/nimpretty
vlicense copying.txt
}