summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4d752b52412e89aea6dae5fb410e062fb2373b13 (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
# Maintainer: Felix Golatofski <contact@xdfr.de>
# Contributor: Sean Anderson <seanga2@gmail.com>

pkgname=('ocaml-atd' 'ocaml-atdgen' 'ocaml-atdgen-runtime' 'ocaml-atdgen-codec-runtime')
_oname=atd
pkgver=2.2.1
pkgrel=2
arch=('i686' 'x86_64')
url="https://github.com/ahrefs/atd"
license=('BSD')
depends=('ocaml>=3.11'
	 'ocaml-menhir'
	 'ocaml-easy-format'
	 'ocaml-biniou'
	 'ocaml-yojson'
	 'ocaml-re')
makedepends=('ocaml-findlib' 'dune>=2' 'opam' 'scala')
options=(!strip)
source=("https://github.com/ahrefs/${_oname}/archive/${pkgver}.tar.gz")
md5sums=('c4120ec4dd6a54d5c04a6b9d6ec942b3')
_dune="dune $(getopt "j::" $MAKEOPTS 2>/dev/null | sed 's/--/\n/g' | head -n 1)"

prepare() {
	cd $srcdir/$_oname-$pkgver
	truncate -s 0 atds/test/run_test.sh
	echo "#!/bin/sh" >> atds/test/run_test.sh
}

build() {
	cd $srcdir/$_oname-$pkgver
	$_dune build --profile=release -p atd,atdgen,atdgen-runtime,atdgen-codec-runtime
}

check() {
	cd $srcdir/$_oname-$pkgver
	$_dune runtest -p atd,atdgen,atdgen-runtime,atdgen-codec-runtime
}

_do_package() {
	cd $srcdir/$_oname-$pkgver

	opam-installer --prefix=$pkgdir/usr \
		--libdir $pkgdir$(ocamlfind printconf destdir) \
		--docdir $pkgdir/usr/share/doc $1.install
	
	mv $pkgdir/usr/share/doc/$1 $pkgdir/usr/share/doc/$pkgname
	mkdir -p $pkgdir/usr/share/licenses/$pkgname/
	mv $pkgdir/usr/share/doc/$pkgname/LICENSE.md $pkgdir/usr/share/licenses/$pkgname/
}

package_ocaml-atd() {
	# options and directives that can be overridden
	pkgdesc="Adaptable type definitions for OCaml"

	_do_package atd
}

package_ocaml-atdgen() {
	# options and directives overrides
	pkgdesc="Efficient JSON serializer, deserializer and validator generator for OCaml"
	depends=('ocaml-atd' 'ocaml-atdgen-runtime' 'ocaml-atdgen-codec-runtime' 'bash')

	_do_package atdgen
}

package_ocaml-atdgen-runtime() {
	pkgdesc="Runtime for atdgen generated bucklescript converters"

	_do_package atdgen-runtime
}

package_ocaml-atdgen-codec-runtime() {
	pkgdesc="Runtime library for code generated by atdgen"
	
	_do_package atdgen-codec-runtime
}