void-packages/srcpkgs/nim/template

105 lines
3.6 KiB
Bash

# Template file for 'nim'
pkgname=nim
version=2.0.10
revision=2
_c2version=86742fb02c6606ab01a532a0085784effb2e753e
_nimbleversion=4fb6f8e6c33963f6f510fe82d09ad2a61b5e4265
_checksumsversion=f8f6bd34bfa3fe12c64b919059ad856a96efcba0
_atlasversion=37aaee20dfd957d1dca2ecdab57d36e86e3f4bde
_satversion=faf1617f44d7632ee9601ebc13887644925dcc01
build_wrksrc="Nim-$version"
depends="gcc openssl-devel"
short_desc="Nim programming language"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="https://nim-lang.org/"
distfiles="https://github.com/nim-lang/Nim/archive/v${version}.tar.gz
https://github.com/nim-lang/csources_v2/archive/${_c2version}.tar.gz>csources_v2-${_c2version}.tar.gz
https://github.com/nim-lang/nimble/archive/${_nimbleversion}.zip
https://github.com/nim-lang/checksums/archive/${_checksumsversion}.zip
https://github.com/nim-lang/atlas/archive/${_atlasversion}.zip
https://github.com/nim-lang/sat/archive/${_satversion}.zip"
checksum="72955dc4791b5c5327624c35ce8e8c750183c20c3cfdab497e56a89ada4fc068
9c2be306011e0c953bd63a565a4bd6a094e22d3944ca201977c1d03560d0a25c
3de2002b6a97ae721c6bd078a069feb6500f6ff9fc1ef12bfa6f9de84c401acd
188bd0f0eb8cedf2d1a7f700af1cd809e529533e5ded05812eecf43fbeb96137
c8be6cfd01ba76af32dac37e5f53f12043ffeb3e38a9f5968a773f80b05052f4
a8969e14b0f8e06c6dc5a4ae622e51b209c3e1f24361980917d96e39f3d71114"
post_extract() {
mv csources_v2-$_c2version $build_wrksrc/csources_v2
mkdir $build_wrksrc/dist
mv nimble-$_nimbleversion $build_wrksrc/dist/nimble
mv checksums-$_checksumsversion $build_wrksrc/dist/checksums
mkdir -p $build_wrksrc/dist/nimble/dist
cp -r $build_wrksrc/dist/checksums $build_wrksrc/dist/nimble/dist/checksums
cp -r sat-$_satversion $build_wrksrc/dist/nimble/dist/sat
mv atlas-$_atlasversion $build_wrksrc/dist/atlas
mkdir -p $build_wrksrc/dist/atlas/dist
cp -r sat-$_satversion $build_wrksrc/dist/atlas/dist/sat
}
do_build() {
case "$XBPS_TARGET_MACHINE" in
i686*)
CC=cc LD=cc CFLAGS="-Os -pipe" LDFLAGS= \
make -C csources_v2 ucpu=i686 ${makejobs};;
ppc|ppc-musl)
CC=cc LD=cc CFLAGS="-Os -pipe" LDFLAGS= \
make -C csources_v2 ucpu=powerpc ${makejobs};;
*)
CC=cc LD=cc CFLAGS="-Os -pipe" LDFLAGS= \
make -C csources_v2 ${makejobs};;
esac
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;;
riscv64*) _arch=riscv64;;
esac
case "$XBPS_TARGET_MACHINE"
in arm*|aarch64*|ppc*|riscv64*)
vsed -i config/nim.cfg -e 's/^arm\.linux\.gcc\.\(linker\)\?exe /#&/'
cat >>config/nim.cfg <<-EDIT
# VOIDLINUX TEMP
$_arch.linux.gcc.exe = "$CC"
$_arch.linux.gcc.linkerexe = "$CC"
EDIT
bin/nim c -d:release -d:danger --os:linux --cpu:$_arch --listCmd compiler/nim
./koch tools --os:linux --cpu:$_arch --listCmd
vsed -i config/nim.cfg -e '/^# VOIDLINUX TEMP$/,$d'
;; *)
./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 testament atlas; 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 ${DESTDIR}/usr/lib/nim
cp -r dist ${DESTDIR}/usr/lib/nim/
ln -sf /usr/lib/nim/doc ${DESTDIR}/usr/share/nim/doc
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
}