aboutsummaryrefslogtreecommitdiffstats
path: root/testing/utop/APKBUILD
blob: bfd2f04b7ba4653036a26082ff60959e53dedbd5 (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
107
108
109
110
111
112
113
114
115
116
117
118
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=utop
pkgver=2.1.0
pkgrel=1
pkgdesc="Universal toplevel for OCaml"
url="https://github.com/diml/utop"
# x86, armhf, s390x: limited by ocaml aport
arch="all !x86 !armhf !s390x"
license="BSD-3-Clause"
depends="
	ocaml-$pkgname=$pkgver-r$pkgrel
	$pkgname-common=$pkgver-r$pkgrel
	"
_depends_ocaml="
	ocaml-runtime
	ocaml-camomile
	ocaml-findlib>=1.7.2
	ocaml-lambda-term
	ocaml-lwt
	ocaml-lwt-react
	ocaml-react
	"
makedepends="
	dune
	ocaml
	ocaml-compiler-libs
	ocaml-camomile-dev
	ocaml-cppo
	ocaml-findlib-dev
	ocaml-lambda-term-dev
	ocaml-lwt-dev
	ocaml-react-dev
	opam
	"
subpackages="
	$pkgname-full:_full
	$pkgname-common:_common:noarch
	$pkgname-doc
	$pkgname-emacs::noarch
	ocaml-$pkgname-dev:_libdev
	ocaml-$pkgname:_lib
	"
source="$pkgname-$pkgver.tar.bz2::https://github.com/diml/$pkgname/releases/download/$pkgver/$pkgname-$pkgver.tbz"
builddir="$srcdir/$pkgname-$pkgver"

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

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

package() {
	cd "$builddir"

	opam-installer -i \
		--prefix="$pkgdir/usr" \
		--libdir="$pkgdir/usr/lib/ocaml" \
		--docdir="$pkgdir/doc" \
		--mandir="$pkgdir/usr/share/man" \
		$pkgname.install

	# There's just a readme and changelog.
	rm -Rf "$pkgdir"/doc

	# Remove annotation files and sources.
	cd "$pkgdir"/usr/lib/ocaml/$pkgname
	rm -f *.cmt* *.ml
}

_full() {
	pkgdesc="$pkgdesc (non-expunged)"

	_submv usr/bin/utop-full
}

_common() {
	pkgdesc="Common files for utop and utop-full"
	depends=""

	_submv usr/share/$pkgname
}

emacs() {
	pkgdesc="utop plugin for Emacs"
	depends="$pkgname=$pkgver-r$pkgrel"
	install_if="$pkgname=$pkgver-r$pkgrel emacs"

	_submv usr/share/emacs
}

_libdev() {
	pkgdesc="$pkgdesc (development files)"
	depends="ocaml-$pkgname=$pkgver-r$pkgrel"
	local sitelib="usr/lib/ocaml/$pkgname"

	_submv $sitelib/*.mli
}

_lib() {
	pkgdesc="$pkgdesc (library)"
	depends="$_depends_ocaml"

	_submv usr/lib/ocaml
}

_submv() {
	local path="$1"
	mkdir -p "$subpkgdir"/${path%/*}
	mv "$pkgdir"/$path "$subpkgdir"/${path%/*}/
	rmdir -p "$pkgdir"/${path%/*} 2>/dev/null || true
}

sha512sums="5c18daad46569fccbaadebd258be8afa5c0499853b026260f12f6dec3b05c77875d555fb538a7008a994d9e4b7731128927a6cc1fece455dfe227954ee12372c  utop-2.1.0.tar.bz2"