summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4c265c50f4e0452fcc1e0824654697ab92f13751 (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
# Contributor: Thomas Letan <lthms@soap.coffee>

_projectname='jsonm'
pkgname=ocaml-$_projectname
pkgver=1.0.2
pkgrel=1
license=('custom:ISC')
arch=('x86_64')
pkgdesc="Non-blocking streaming JSON codec for OCaml"
url="https://erratique.ch/software/$_projectname"
depends=(
  'ocaml'
  'ocaml-uutf'
)
makedepends=(
  'ocaml-findlib'
  'ocamlbuild'
  'ocaml-topkg'
  'opam'
)
source=(
  "$pkgname-$pkgver.tbz::https://erratique.ch/software/jsonm/releases/jsonm-$pkgver.tbz"
)
options=('!strip')
sha512sums=(
  "0072f5c31080202ed1cb996a8530d72c882723f26b597f784441033f59338ba8c0cbabf901794d5b1ae749a54af4d7ebf7b47987db43488c7f6ac7fe191a042f"
)

_sourcedirectory="$_projectname-$pkgver"

prepare() {
	cd "$srcdir/$_sourcedirectory/"

	# Replace topkg watermarks
	find . -type f -exec sed -i "s/%%\(VERSION\|VERSION_NUM\)%%/$pkgver/g" {} +
}

build() {
	cd "$srcdir/$_sourcedirectory/"
	ocaml 'pkg/pkg.ml' build --dev-pkg false
}

package() {
	cd "$srcdir/$_sourcedirectory/"
	opam-installer --prefix="$pkgdir/usr" --libdir='lib/ocaml' --docdir='share/doc'

	for _folder in "$pkgdir/usr/share/doc/"*; do
		mv "$_folder" "$pkgdir/usr/share/doc/ocaml-$(basename "$_folder")"
	done

	install -dm755 "$pkgdir/usr/share/licenses/$pkgname"
	ln -sf "/usr/share/doc/$pkgname/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/LICENSE.md"
}