void-packages/srcpkgs/nim/template

98 lines
3.2 KiB
Bash

# Template file for 'nim'
pkgname=nim
version=2.0.4
revision=1
_c2version=86742fb02c6606ab01a532a0085784effb2e753e
_nimbleversion=0.14.2
_checksumsversion=b4c73320253f78e3a265aec6d9e8feb83f97c77b
_atlasversion=3e3b4482f228df670626adbe29a7fc55d1a27177
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/v${_nimbleversion}.tar.gz>nimble-${_nimbleversion}.tar.gz
https://github.com/nim-lang/checksums/archive/${_checksumsversion}.zip
https://github.com/nim-lang/atlas/archive/${_atlasversion}.zip"
checksum="482983608bacc712d86d1c0e6f187cc17c63df6006cfc1b639cd625240d7f65c
9c2be306011e0c953bd63a565a4bd6a094e22d3944ca201977c1d03560d0a25c
d94f11c592d49aed6c5a492289f187010eb8c103b2b653252763d2f65a82abac
bf526adf906f826bc10e1a6f049193825ed8ff26d0b42f6d5ba14ac7b32bbc3c
646aa1e2ef75fade7a0cabc8c938b2a99654acee6e9f186c184e3d3c776cebd4"
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
mv atlas-$_atlasversion $build_wrksrc/dist/atlas
}
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
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
}