aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ocaml-migrate-parsetree/APKBUILD
blob: 91979c702bb3a27dd2217956b35f71da293faa5e (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ocaml-migrate-parsetree
pkgver=1.0.7
pkgrel=1
pkgdesc="Convert OCaml parsetrees between different major versions"
url="https://github.com/ocaml-ppx/ocaml-migrate-parsetree"
arch="all !x86 !armhf !s390x"  # limited by ocaml
license="LGPL-2.1-only-WITH-linking-exception"
makedepends="dune ocaml ocamlbuild ocaml-findlib ocaml-result-dev opam"
options="textrels"  # ppc64le (?!)
subpackages="$pkgname-dev $pkgname-doc $pkgname-ocamlbuild"
source="$pkgname-$pkgver.tar.gz::https://github.com/ocaml-ppx/$pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	jbuilder build @install
}

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"

	find usr/lib/ocaml -name '*.cmxs' -exec chmod 0755 {} \;

	# Remove annotation files, sources and some generated code (?).
	find usr/lib/ocaml \
		-name '*.cmt' -delete \
		-o -name '*.cmti' -delete \
		-o -name '*.ml' -delete \
		-o -name '*.ml-gen' -delete

	# Move docs to proper location and remove redundant docs dir.
	mkdir -p usr/share/doc
	mv usr/doc/$pkgname usr/share/doc/$pkgname
	rm -Rf usr/doc/$pkgname-ocamlbuild
	rmdir usr/doc
}

ocamlbuild() {
	pkgdesc="$pkgdesc (ocamlbuild plugin)"
	depends="$pkgname=$pkgver-r$pkgrel ocamlbuild"

	mkdir -p "$subpkgdir"/usr/lib/ocaml
	mv "$pkgdir"/usr/lib/ocaml/$pkgname-ocamlbuild "$subpkgdir"/usr/lib/ocaml/
}

dev() {
	default_dev

	depends="$pkgname=$pkgver-r$pkgrel $pkgname-ocamlbuild=$pkgver-r$pkgrel"
	local sitelib="usr/lib/ocaml/$pkgname"

	cd "$pkgdir"

	local path; for path in $(find $sitelib*/ \
		-name '*.cmx' \
		-o -name '*.cmxa' \
		-o -name '*.mli')
	do
		mkdir -p "${path%/*}"
		mv "$path" "$subpkgdir"/${path%/*}/
		rmdir "$path" 2>/dev/null || true
	done
}

sha512sums="3ba1bfe4840b2664b5053068b3659eb6a2ca216f29ece3f4522d1e7c5d87cb643bfb59ebe0563264cafdc31b9aa572007b4261fd3df8b27607fad47ff6168892  ocaml-migrate-parsetree-1.0.7.tar.gz"