summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3ef3fa2a2dfc627db2322d3b2b5cf8b8858660b0 (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
84
85
86
87
88
89
90
91
92
93
# Maintainer: Thomas Hansen <thomas-e-hansen at teh dot eu>
# Co-maintainer: MithicSpirit <rpc01234 at gmail dot com>

_pkgname=idris2
pkgname=$_pkgname-git
pkgver=latest
pkgrel=3
pkgdesc='A purely functional programming language with first class types'
url='https://www.idris-lang.org/'
license=('custom')
arch=('x86_64')
depends=('chez-scheme' 'sh')
makedepends=('git')
checkdepends=('nodejs' 'racket')
optdepends=('nodejs: javascript backend'
            'racket: racket backend'
            'gcc: refc backend')
provides=("$_pkgname")
conflicts=("$_pkgname")
source=("$_pkgname::git+https://github.com/idris-lang/${_pkgname^}.git")
sha256sums=('SKIP')
options=(staticlibs)

_setvars() {
	export MAKEFLAGS+=' -j1 '
	export SCHEME='chez'
	_bootstrap="$srcdir/bootstrap"
	export PATH="$_bootstrap/bin:$PATH"
}

pkgver() {
	cd "$srcdir/$_pkgname"
	git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
	_setvars
	cd "$srcdir/$_pkgname"

	mkdir -p "$_bootstrap"

	export PREFIX="$_bootstrap"
	make bootstrap
	make install
}

build() {
	_setvars
	cd "$srcdir/$_pkgname"

	export PREFIX='/usr/lib'
	make clean
	make all
}

check() {
	# tests seem to be broken upstream. disable them for now.
	return 0

	_setvars
	cd "$srcdir/$_pkgname"

	INTERACTIVE='' make test
}

package() {
	options=(staticlibs)
	_setvars
	cd "$srcdir/$_pkgname"

	PREFIX='/usr/lib' IDRIS2_PREFIX='/usr/lib' make src/IdrisPaths.idr
	sed -i 's|src/IdrisPaths.idr: FORCE|src/IdrisPaths.idr:|g' Makefile

	export PREFIX="$pkgdir/usr/lib"
	export IDRIS2_PREFIX="$PREFIX"

	make install
	make install-libdocs
	make install-with-src-libs
	make install-with-src-api

	mkdir -p "$pkgdir/usr/bin"
	mv "$pkgdir/usr/lib/bin/$_pkgname" "$pkgdir/usr/bin/$_pkgname"
	sed -i 's|$DIR|/usr/lib|g' "$pkgdir/usr/bin/$_pkgname"

	mv "$pkgdir/usr/lib/bin/${_pkgname}_app" \
		"$pkgdir/usr/lib/${_pkgname}_app"
	rmdir "$pkgdir/usr/lib/bin"

	install -Dm644 <(idris2 --bash-completion-script idris2) \
		"$pkgdir/usr/share/bash-completion/completions/$_pkgname"
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}