summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1ff13711ac51612e7eb5b48b0cea330111da6077 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
# Maintainer: Dringsim <dringsim@qq.com>
# Contributor: Felix Golatofski <contact@xdfr.de>
# Contributor: Sean Anderson <seanga2@gmail.com>

pkgname=('ocaml-atd' 'ocaml-atdgen' 'ocaml-atdgen-runtime' 'ocaml-atdgen-codec-runtime' 'ocaml-atdj' 'ocaml-atdpy' 'ocaml-atds' 'ocaml-atdts')
_oname=atd
pkgver=2.12.0
pkgrel=1
arch=('x86_64')
url="https://github.com/ahrefs/atd"
license=('BSD')
depends=('ocaml>=4.08'
	 'ocaml-menhir'
	 'ocaml-easy-format'
	 'ocaml-biniou'
	 'ocaml-yojson'
	 'ocaml-re')
makedepends=('ocaml-findlib' 'dune>=2' 'opam' 'scala')
checkdepends=('flake8' 'java-environment' 'mypy' 'nodejs' 'ocaml-alcotest' 'python-pytest' 'scala')
options=(!strip)
source=("https://github.com/ahrefs/${_oname}/archive/${pkgver}.tar.gz")
sha256sums=('0F588DE2D9A7A765CB3BF35A2A3F687BCA460363EFA76E4C9CA167453AA14153')
_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,atdj,atdpy,atds,atdts
}

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

_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
}

package_ocaml-atdj() {
	pkgdesc="Java code generation for ATD"
	depends=('ocaml-atd')

	_do_package atdj
}

package_ocaml-atdpy() {
	pkgdesc="Python/mypy code generation for ATD APIs"
	depends=('ocaml-atd' 'ocaml-cmdliner')

	_do_package atdpy
}

package_ocaml-atds() {
	pkgdesc="ATD Code generator for Scala"
	depends=('ocaml-atd')

	_do_package atds
}

package_ocaml-atdts() {
	pkgdesc="TypeScript code generation for ATD APIs"
	depends=('ocaml-atd' 'ocaml-cmdliner')

	_do_package atdts
}