aboutsummaryrefslogtreecommitdiffstats
path: root/community/ocamlbuild/APKBUILD
blob: ae80c00d2aa3276fdc0afc9561b2272601620c2f (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
# Contributor: Jon Ong <jonongjs@rottenmage.com>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Anil Madhavapeddy <anil@recoil.org>
pkgname=ocamlbuild
pkgver=0.13.1
pkgrel=0
pkgdesc="Generic build tool with built-in rules for building OCaml library and programs"
url="https://github.com/ocaml/ocamlbuild"
arch="aarch64 ppc64le x86_64"  # limited by ocaml aport
license="LGPL-2.0-or-later-WITH-linking-exception"
checkdepends="ocaml-compiler-libs ocaml-findlib"
depends="ocaml-$pkgname=$pkgver-r$pkgrel cmd:tput"
makedepends="ocaml"
subpackages="$pkgname-doc ocaml-$pkgname-dev:_libdev ocaml-$pkgname:_lib"
source="$pkgname-$pkgver.tar.gz::https://github.com/ocaml/$pkgname/archive/$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"

	make configure \
		OCAML_NATIVE=true \
		OCAMLBUILD_BINDIR="/usr/bin" \
		OCAMLBUILD_LIBDIR="/usr/lib/ocaml"
	make
}

check() {
	cd "$builddir"
	make test
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install

	# Remove annotation files.
	rm -f "$pkgdir"/usr/lib/ocaml/$pkgname/*.cmt*

	# Keep only native binary.
	cd "$pkgdir"/usr/bin
	rm ocamlbuild.byte
	mv ocamlbuild.native ocamlbuild
}

_libdev() {
	pkgdesc="$pkgdesc (development files)"
	depends="ocaml-$pkgname=$pkgver-r$pkgrel"
	replaces="$pkgname"  # for backward compatibility

	local file; for file in '*.a' '*.cmx' '*.cmxa' '*.mli' '*.o'; do
		_submv "usr/lib/ocaml/$pkgname/$file"
	done
}

_lib() {
	pkgdesc="$pkgdesc (library)"
	replaces="$pkgname"  # for backward compatibility

	_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="ca22c4dfb9ddf20a5b0010a3df13495c8baf05fa6d660ea8ced2df86448bdc411d8231ffd05fb5fbfe96882e524a352cea555da3b97c16e9505b7520b96fa7b7  ocamlbuild-0.13.1.tar.gz"