void-packages/srcpkgs/nim/template

104 lines
3.6 KiB
Bash

# Template file for 'nim'
pkgname=nim
version=2.0.8
revision=1
_c2version=86742fb02c6606ab01a532a0085784effb2e753e
_nimbleversion=be2f1309b35a6189ff5eb34a007793e6d3f94157
_checksumsversion=025bcca3915a1b9f19878cea12ad68f9884648fc
_atlasversion=5faec3e9a33afe99a7d22377dd1b45a5391f5504
_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="3a408e8342392342db745e26bb6acab2e6acb381db89b2624e8e58a85a1c6656
9c2be306011e0c953bd63a565a4bd6a094e22d3944ca201977c1d03560d0a25c
2c24302cb012df0e97a143bb81e39ccb1854fc16d8bfdb82f9db3f446bbb9cac
a0f2a159980b84ae259f1cd5d0a0c44d800b17f43e78b511256a38476fb9cb95
98e6f971b3d762aed1805e77647c80d0bb26d4cbbb776e450b2819a281d0cec0
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
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
}