aboutsummaryrefslogtreecommitdiffstats
path: root/testing/js_of_ocaml/APKBUILD
blob: 892c507eebaa15fad7472127f3360d150173bdee (plain) (blame)
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
# TODO: Verify declared dependencies.
pkgname=js_of_ocaml
pkgver=3.1.0
pkgrel=3
pkgdesc="Compiler from OCaml to Javascript"
url="http://ocsigen.org/js_of_ocaml/"
arch="all !x86 !armhf !armv7 !s390x"  # limited by ocaml aport
license="LGPL-2.0-or-later"
depends="
	$pkgname-compiler=$pkgver-r$pkgrel
	ocaml-migrate-parsetree
	ocaml-ppx_tools_versioned
	ocaml-uchar
	"
checkdepends="nodejs ocaml-deriving"
makedepends="
	bash
	dune
	ocaml
	ocaml-camlp4-dev
	ocaml-cmdliner-dev
	ocaml-compiler-libs
	ocaml-cppo-dev
	ocaml-findlib-dev
	ocaml-lwt-dev
	ocaml-migrate-parsetree-dev
	ocaml-ocamlbuild-dev
	ocaml-ppx_deriving-dev
	ocaml-ppx_tools-dev
	ocaml-ppx_tools_versioned-dev
	ocaml-react-dev
	ocaml-reactivedata-dev
	ocaml-tyxml-dev
	ocaml-uchar-dev
	ocaml-yojson-dev
	ocamlbuild
	opam
	"
options="!check"  # FIXME: needs additional dependencies
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/ocsigen/$pkgname/archive/$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

for _i in camlp4 compiler lwt ocamlbuild ppx ppx_deriving_json toplevel tyxml; do
	subpackages="$subpackages $pkgname-$_i"
done

build() {
	cd "$builddir"
	jbuilder build @install @DEFAULT -j ${JOBS:-2}
}

check() {
	cd "$builddir"
	jbuilder runtest
}

package() {
	cd "$builddir"

	mkdir -p "$pkgdir"/usr/lib/ocaml
	jbuilder install \
		--destdir="$pkgdir"/usr \
		--libdir="$pkgdir"/usr/lib/ocaml

	cd "$pkgdir"

	_mv usr/man usr/share/

	# There's just a readme and changelog.
	rm -Rf usr/doc

	# These are just duplicates.
	rm -f usr/bin/*.exe

	# Remove annotation files and sources.
	find usr/lib/ocaml \
		\( -name '*.cmt' -o -name '*.cmti' -o -name '*.ml' \) \
		-a -delete
}

dev() {
	default_dev

	cd "$pkgdir"

	local path
	for path in $(find usr/lib/ocaml/ -name '*.cmx' -o -name '*.cmxa' -o -name '*.mli'); do
		_mv "$path" "$subpkgdir"/${path%/*}/
	done
}

camlp4() {
	pkgdesc="$pkgdesc (Camlp4 syntax extension)"
	depends="ocaml-camlp4"
	_subpackage
}

compiler() {
	pkgdesc="$pkgdesc (compiler)"
	depends="ocaml ocaml-cmdliner ocaml-cppo ocaml-findlib ocaml-yojson"

	_subpackage

	cd "$pkgdir"/usr/bin
	_mv js_of_ocaml jsoo_minify jsoo_link "$subpkgdir"/usr/bin/
}

lwt() {
	pkgdesc="$pkgdesc (lwt)"
	depends="$pkgname=$pkgver-r$pkgrel
		$pkgname-ppx=$pkgver-r$pkgrel
		ocaml-lwt"
	_subpackage
}

ocamlbuild() {
	pkgdesc="$pkgdesc (OCamlbuild plugin)"
	depends="ocamlbuild"
	_subpackage
}

ppx() {
	pkgdesc="$pkgdesc (ppx syntax extensions)"
	depends="$pkgname=$pkgver-r$pkgrel
		ocaml-migrate-parsetree
		ocaml-ppx_tools_versioned"
	_subpackage
}

ppx_deriving_json() {
	pkgdesc="$pkgdesc ([@@deriving json])"
	depends="$pkgname ocaml-ppx_tools ocaml-ppx_deriving"
	_subpackage
}

toplevel() {
	pkgdesc="Web-based OCaml toplevel"
	depends="$pkgname=$pkgver-r$pkgrel
		$pkgname-compiler=$pkgver-r$pkgrel
		$pkgname-ppx=$pkgver-r$pkgrel
		ocaml-compiler-libs
		ocaml-findlib"

	_subpackage

	cd "$pkgdir"/usr/bin
	_mv jsoo_mkcmis jsoo_mktop jsoo_listunits "$subpkgdir"/usr/bin/
}

tyxml() {
	pkgdesc="$pkgname (Tyxml)"
	depends="$pkgname=$pkgver-r$pkgrel
		$pkgname-ppx=$pkgver-r$pkgrel
		ocaml-reactivedata
		ocaml-tyxml"
	_subpackage
}

_subpackage() {
	depends="ocaml-runtime $depends"
	_mv "$pkgdir"/usr/lib/ocaml/$subpkgname "$subpkgdir"/usr/lib/ocaml/
}

_mv() {
	local dest; for dest; do true; done  # get last argument
	mkdir -p "$dest"
	mv "$@"
}

sha512sums="63bd4961fbdc677cc992d253a7254a159d86c444b6aa5a8b2fac446925f35fbc8454865db167364cb2c2b7f02b113ebb0c0ac1cb5d2f7d7ae06519c68cdbc58a  js_of_ocaml-3.1.0.tar.gz"