aboutsummaryrefslogtreecommitdiffstats
path: root/testing/nim/APKBUILD
blob: f22e984ea783702f6caa63c4c2c6a570d10f1723 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
#
# WARNING: Coroutines does not work and there may be more breakages!
pkgname=nim
pkgver=0.17.2
pkgrel=0
pkgdesc="A systems and applications programming language"
url="https://nim-lang.org/"
arch="all"
license="MIT"
checkdepends="sqlite-libs nodejs"
subpackages="$pkgname-doc nimsuggest niminst"
source="https://nim-lang.org/download/$pkgname-$pkgver.tar.xz
	$pkgname-csources-$pkgver.tar.gz::https://github.com/nim-lang/csources/archive/v$pkgver.tar.gz
	niminst-fix-paths.patch
	nim-config-fix-paths.patch"
builddir="$srcdir/$pkgname-$pkgver"

# Don't run tests on armhf, it'd take eternity...
case "$CARCH" in
	armhf) options="!check";;
esac

prepare() {
	mv "$srcdir"/csources-$pkgver "$builddir"/csources
	default_prepare
}

build() {
	cd "$builddir"/csources

	msg2 "Building nim csources..."
	./build.sh

	cd ..

	msg2 "Building koch..."
	./bin/nim compile -d:release koch

	msg2 "Building nim..."
	./koch boot -d:release

	msg2 "Building nimsuggest..."
	./bin/nim compile -d:release nimsuggest/nimsuggest.nim
}

check() {
	cd "$builddir"
	# XXX: Some tests fail!
	./koch tests --pedantic --targets="c js" all || true
}

package() {
	cd "$builddir"
	DESTDIR="$pkgdir" ./koch install /usr/bin

	cd "$pkgdir"
	mkdir -p usr/include
	local file; for file in usr/lib/nim/*.h; do
		mv $file usr/include/
		ln -s ../../include/${file##*/} usr/lib/nim/${file##*/}
	done
}

nimsuggest() {
	pkgdesc="idetools for the nim language"

	install -D -m 755 "$builddir"/nimsuggest/nimsuggest \
		"$subpkgdir"/usr/bin/nimsuggest
}

niminst() {
	pkgdesc="A tool to generate an installer for a Nim program"

	install -D -m 755 "$builddir"/tools/niminst/niminst \
		"$subpkgdir"/usr/bin/niminst
}

sha512sums="7b4ed1eb1e9067ce72b76b95c43ec74eb38f04611776c174ba6a697254a9253fed61258712fb938f15e662bb3b0d36138194fc8fa89bbcb4d22888263e5e2880  nim-0.17.2.tar.xz
4a8f1e87bd96ab33998b0d3415c0ba9560b78795e0396d8af8b588a93c23477097f2c5388b4e612fbc142b490480326b394a933c805a3585cd6f3d7e8390e3e6  nim-csources-0.17.2.tar.gz
4ab36c5d8772567ba09b536e3dd91ddcf253892056751318ccbfce7ac24f0a646bfcd94f5dadc823c9a8394bea9614fede20c1805638052ebdbe7b5bafba4f05  niminst-fix-paths.patch
813eb4cb93b0e9f12cb7666bef65c583390008ec09bc850f43f621688dc809bc51c105898095a8ef6316fbef49ac657a7abc75d74ad7b8cb3919c8f1a721af02  nim-config-fix-paths.patch"