aboutsummaryrefslogtreecommitdiffstats
path: root/community/ocaml/APKBUILD
blob: 665a4d0de6ba07d28a3ad97c26f9dec99823b5e6 (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
# Contributor: Borys Zhukov <mp5@mp5.im>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ocaml
pkgver=4.09.0
pkgrel=0
pkgdesc="Main implementation of the Caml programming language"
url="http://ocaml.org/"
arch="aarch64 ppc64le x86_64"
license="LGPL-2.1-or-later-WITH-linking-exception"
depends="$pkgname-runtime=$pkgver-r$pkgrel gcc"
makedepends="gdbm-dev libc-dev ncurses-dev zlib-dev binutils-dev"
[ "$CARCH" = "x86_64" ] || options="textrels"
subpackages="
	$pkgname-doc
	$pkgname-dev
	$pkgname-ocamldoc
	$pkgname-compiler-libs:_compiler_libs
	$pkgname-runtime
	"
source="http://caml.inria.fr/pub/distrib/ocaml-${pkgver%.*}/ocaml-$pkgver.tar.gz
	compile-without-debug-info.patch
	fix-mcontext-fields.patch
	fix-segfault-in-ppc64le.patch
	fix-check-parser-uptodate-or-warn.sh.patch
	"

build() {
	./configure \
		--prefix /usr \
		--bindir /usr/bin \
		--libdir /usr/lib/ocaml \
		--mandir /usr/share/man \
		CC="${CC:-gcc}" \
		AS="${CC:-gcc} -c" \
		ASPP="${CC:-gcc} -c"
	make world.opt
}

check() {
	# FIXME: there seem to be some spurious failures, ignore until fixed.
	make -C testsuite all || true
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
	install -Dm644 Changes "$pkgdir"/usr/share/doc/$pkgname/Changes

	cd "$pkgdir"

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

	# To be consistent with other binaries.
	mv usr/bin/ocamldoc usr/bin/ocamldoc.byte
	ln -s ocamldoc.opt usr/bin/ocamldoc
}

dev() {
	pkgdesc="OCaml bytecode executables"

	_submv 'usr/bin/*.byte'
}

ocamldoc() {
	pkgdesc="Documentation generator for OCaml"
	depends="$pkgname=$pkgver-r$pkgrel"
	replaces="$pkgname"  # for backward compatibility

	_submv usr/bin/ocamldoc\*
	_submv usr/lib/ocaml/ocamldoc
}

_compiler_libs() {
	pkgdesc="Compiler libraries for OCaml"
	depends="$pkgname=$pkgver-r$pkgrel"
	replaces="$pkgname"  # for backward compatibility

	_submv usr/lib/ocaml/compiler-libs
}

runtime() {
	pkgdesc="OCaml runtime environment"
	depends=""
	replaces="$pkgname"  # for backward compatibility

	_submv usr/bin/ocamlrun

	local i; for i in \
		'*.cmo' \
		'*.cmi' \
		'*.cma' \
		'VERSION' \
		'stublibs' \
		'threads/*.cmi' \
		'threads/*.cma'
	do
		_submv "usr/lib/ocaml/$i"
	done
}

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

sha512sums="c1b666839960c157868fc32a96fe4137280a4b99464ba2c6616700b962d802ed86467ec21c341abbefdf684b8314b90fd6a5018c6de58dc29152af851eebea88  ocaml-4.09.0.tar.gz
9421514297ae014c012f909f9b3fc08dbcac567aae9eaf2c404ed3be28c60b5cfbb55f7486185feaeb15df4f027c8754a121ee18487bc7943ec1c40b314c2e31  compile-without-debug-info.patch
cd0b9a8c3dc8d952a40eb1758cc74dc388ec4bcc5fe5a25c3f073f0088bf51027b53ea1b9f6d02a84b11bd3964bec1c50b5da28caa7c1e31ec76f9930ea7d527  fix-mcontext-fields.patch
e65b647427d9c94933d5be97857daf8cdc65e25c10066740dbcbab7a4e6f8ddb2277ee7d5796abf5916e5bdd59b057de736190432c480fc8ff2a4b2a94d46eca  fix-segfault-in-ppc64le.patch
b3362906c23ecdb084db7dbf18cae22f0a54ba968f1ecf9c8d13c230ca221b3f77fa820a52e091ce7b71b1cb4a91faf1346692aa6fa411bb46fca784500def25  fix-check-parser-uptodate-or-warn.sh.patch"