aboutsummaryrefslogtreecommitdiffstats
path: root/community/ocaml/APKBUILD
blob: 3747b897a490d74b9c9641ba8c32ee615f33be13 (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
126
127
128
# Contributor: Borys Zhukov <mp5@mp5.im>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ocaml
pkgver=4.06.1
pkgrel=2
pkgdesc="Main implementation of the Caml programming language"
url="http://ocaml.org/"
arch="all !x86 !armhf !s390x"
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"
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
	"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"

	# Strip out -fomit-frame-pointer due to -pg.
	export CFLAGS="${CFLAGS/-fomit-frame-pointer/} -fPIC"

	./configure \
		-cc "${CC:-gcc}" \
		--bindir /usr/bin \
		--libdir /usr/lib/ocaml \
		--mandir /usr/share/man \
		--no-curses
	make -j1 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 install \
		BINDIR="$pkgdir"/usr/bin \
		LIBDIR="$pkgdir"/usr/lib/ocaml \
		MANDIR="$pkgdir"/usr/share/man

	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="42560874ce363212fa4e862138d7260113bc8dff8b39c040332bbd9b039ba938788344ba8ce63ffc0a251bf21a6e493f3c1e505b6f51db6fec4d21578921060e  ocaml-4.06.1.tar.gz
b42af74ae80428a0488bbb182ca5f48d35ce34d6ba336aa10904a78863e7e1e6b61303d5cd3ad89cba5329cb0983692ba92341e2058ea3e31bb22aa4f7b46dd8  compile-without-debug-info.patch
75c67e143a4a05b334bdebbad48ded1e04d383d8ea9b747df2633a5af96b1115b502510faf57753c71bbac38fbc9d9746b167861a63b2fd295901db0d22ea317  fix-mcontext-fields.patch
b2cef41400b31c1dcfd206c1534827f7b33b0afd6234b26fb95cf15c092affa85c27a615c14ece254ec326430f31b58ca70b9cc23a84ebf8baac2624bd5b0a71  fix-segfault-in-ppc64le.patch"