summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8770f7cab29b6c782b8bbf4c7e58e4960194a1ef (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
# Maintainer: Daniel Peukert <dan.peukert@gmail.com>
_projectname='dtoa'
pkgname="ocaml-$_projectname"
pkgver='0.3.2'
pkgrel='1'
pkgdesc='double-to-ascii ocaml implementation'
arch=('x86_64' 'i686')
url="https://github.com/flowtype/$pkgname"
license=('MIT')
depends=('ocaml')
makedepends=('dune' 'ocaml-findlib')
checkdepends=('ocaml-ounit')
options=('!strip')
source=(
	"$pkgname-$pkgver-$pkgrel.tar.gz::$url/archive/v$pkgver.tar.gz"
	'fix-ounit-name.diff'
	'fix-tests.diff'
)
sha256sums=('967bdcf83f67491a27a3e0c31bb55696f4f89a00be9aa0b3a248c7ef14374afd'
            '9b26ee783aeba8c8a2f299e2fd061d06ebceac61cbe13becd2debb93b61aa4e4'
            'fc4ab96c8be38e7a2440ad80b474631829d48ae4a25c16a886997304d44da4b1')

_sourcedirectory="$pkgname-$pkgver"

prepare() {
	cd "$srcdir/$_sourcedirectory"
	patch --forward -p1 < "$srcdir/fix-ounit-name.diff"
	patch --forward -p1 < "$srcdir/fix-tests.diff"
}

build() {
	cd "$srcdir/$_sourcedirectory"
	dune build
}

check() {
	cd "$srcdir/$_sourcedirectory"
	dune runtest
}

package() {
	cd "$srcdir/$_sourcedirectory"
	DESTDIR="$pkgdir" dune install --prefix '/usr' --libdir 'lib/ocaml'

	install -dm755 "$pkgdir/usr/share/doc/$pkgname"
	mv "$pkgdir/usr/doc/$_projectname/"* "$pkgdir/usr/share/doc/$pkgname/"
	rm -r "$pkgdir/usr/doc/"

	install -dm755 "$pkgdir/usr/share/licenses/$pkgname"
	ln -sf "/usr/share/doc/$pkgname/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}