aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ocaml-lwt/APKBUILD
blob: 6e4e90c460052bb8e15e913f5fefa07d58b373de (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ocaml-lwt
_pkgname=lwt
pkgver=4.1.0
pkgrel=0
pkgdesc="OCaml promises and concurrent I/O"
url="https://github.com/ocsigen/lwt"
arch="all !x86 !armhf !armv7 !s390x"  # limited by ocaml aport
license="LGPL-2.1-or-later-WITH-linking-exception BSD-3-Clause"
depends="ocaml-runtime ocaml-result"
depends_dev="libev-dev"
makedepends="$depends_dev
	dune
	ocaml
	ocaml-compiler-libs
	ocaml-cppo-dev
	ocaml-findlib
	ocaml-migrate-parsetree-dev
	ocaml-ppx_tools_versioned-dev
	ocaml-react-dev
	ocaml-result-dev
	opam
	"
options="!check"  # FIXME: tests hang
subpackages="$pkgname-dev ${pkgname}_ppx:_ppx ${pkgname}_react:_react"
source="$pkgname-$pkgver.tar.gz::https://github.com/ocsigen/$_pkgname/archive/$pkgver.tar.gz
	result_lseek_noinline.patch"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	cd "$builddir"

	ocaml src/util/configure.ml \
		-use-libev true

	jbuilder build @install
}

check() {
	cd "$builddir"

	jbuilder runtest
}

package() {
	local libdir="$pkgdir/usr/lib/ocaml"
	cd "$builddir"

	mkdir -p "$libdir"
	jbuilder install \
		--destdir="$pkgdir"/usr \
		--libdir="$libdir"

	find "$libdir" -name '*.cmxs' -exec chmod 0755 {} \;

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

	# Remove annotation files and sources.
	find "$libdir"/$_pkgname* \( \
		-name '*.cmt' -o \
		-name '*.cmti' -o \
		-name '*.ml' \) -delete
}

dev() {
	default_dev
	depends="$depends_dev
		$pkgname=$pkgver-r$pkgrel
		${pkgname}_ppx=$pkgver-r$pkgrel
		${pkgname}_react=$pkgver-r$pkgrel"
	provides="${pkgname}_ppx-dev ${pkgname}_react-dev"

	cd "$pkgdir"

	local path; for path in $(find usr/lib/ocaml/$_pkgname*/ \
		-name '*.cmx' \
		-o -name '*.cmxa' \
		-o -name '*.mli')
	do
		mkdir -p "${path%/*}"
		mv "$path" "$subpkgdir"/${path%/*}/
	done
}

_ppx() {
	pkgdesc="$pkgdesc (PPX syntax)"
	depends="$pkgname=$pkgver-r$pkgrel
		ocaml-runtime
		ocaml-migrate-parsetree
		ocaml-ppx_tools_versioned"

	_submv usr/lib/ocaml/lwt_ppx
}

_react() {
	pkgdesc="$pkgdesc (for FRP)"
	depends="$pkgname=$pkgver-r$pkgrel ocaml-runtime ocaml-react"

	_submv usr/lib/ocaml/lwt_react
}

_submv() {
	local path="$1"
	mkdir -p "$subpkgdir"/${path%/*}
	mv "$pkgdir"/$path "$subpkgdir"/${path%/*}/
}

sha512sums="28bc51e75d5e4c74171f17aaba86fdefad70f57f9f2023680044d5bf65250d8531501adc85d0422e644c1e318dcee0a4d53f7841c82d9dca9854e8fbb09987f2  ocaml-lwt-4.1.0.tar.gz
dc3abce70b3ad022066e8023a9b37346df0ecbbc6351186cc24b569189142ad3e7e32f27c33a4378f11ec8c40df5c96f4c37190ca4797bc228ca8943f53cf5bf  result_lseek_noinline.patch"