aboutsummaryrefslogtreecommitdiffstats
path: root/community/ocaml/APKBUILD
blob: 6a0ed49f6608da6f3fa5bec03dd73edf74b76646 (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
119
120
121
122
123
124
125
# Contributor: Borys Zhukov <mp5@mp5.im>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ocaml
pkgver=4.08.1
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%.*}/$pkgname-$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
	"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	./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() {
	cd "$builddir"

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

package() {
	cd "$builddir"

	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' \
		'vmthreads/*.cmi' \
		'vmthreads/*.cma' \
		'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="8239c1879926e59c3d9611ad0d97618ce21b0528f1bd59db3df9c24287ad180ffa74f34e52e1fab39e71cbf8113a9a4ee5037cc33ae64ca6a9a109fe4ada0256  ocaml-4.08.1.tar.gz
49cbd6df3a70d00df33d34ab4508dd04d52cbc94efc6c8cac8668758e7346be3c7acedf5b8af38a0adb18c69b8d0859667b12cc11699002c048af962cf283ad2  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"