aboutsummaryrefslogtreecommitdiffstats
path: root/main/jsoncpp/APKBUILD
blob: c75877acdb92edc57f372a0af7a56488bb6b2523 (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
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=jsoncpp
pkgver=1.6.5
pkgrel=0
pkgdesc="JSON C++ library"
url="https://github.com/open-source-parsers/jsoncpp"
arch="all"
license="PublicDomain"
depends=
depends_dev=
makedepends="$depends_dev scons"
install=""
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/open-source-parsers/jsoncpp/archive/$pkgver.tar.gz"

_builddir="$srcdir"/jsoncpp-$pkgver
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	# we cannot use cmake since jsoncpp is a dependency for cmake which
	# means we would get circular buildtime deps
	scons platform=linux-gcc || return 1

	# build a proper shared lib
	g++ -o libjsoncpp.so.0.0.0 -shared -Wl,-soname,libjsoncpp.so.0 \
		buildscons/linux-gcc-*/src/lib_json/*.os -lpthread
}

package() {
	cd "$_builddir"

	mkdir -p "$pkgdir"/usr/lib
	cp "$_builddir"/libjsoncpp.so.0.0.0 "$pkgdir"/usr/lib/ || return 1
	ln -s libjsoncpp.so.0.0.0 "$pkgdir"/usr/lib/libjsoncpp.so.0 || return 1
	ln -s libjsoncpp.so.0.0.0 "$pkgdir"/usr/lib/libjsoncpp.so || return 1

	mkdir -p "$pkgdir"/usr/include/jsoncpp
	cp -r "$_builddir"/include/json/* "$pkgdir"/usr/include/jsoncpp/ \
		|| return 1
	ln -s jsoncpp "$pkgdir"/usr/include/json

	mkdir -p "$pkgdir"/usr/lib/pkgconfig
	sed -e 's:@CMAKE_INSTALL_PREFIX@:/usr:g' \
		-e 's:@LIBRARY_INSTALL_DIR@:lib:g' \
		-e 's:@INCLUDE_INSTALL_DIR@:include/jsoncpp:g'\
		-e "s:@JSONCPP_VERSION@:$pkgver:g"\
		pkg-config/jsoncpp.pc.in \
		> "$pkgdir"/usr/lib/pkgconfig/jsoncpp.pc || return 1
}

md5sums="2bb16bb8d2b867acbdd71d1855062a89  jsoncpp-1.6.5.tar.gz"
sha256sums="a2b121eaff56ec88cfd034d17685821a908d0d87bc319329b04f91a6552c1ac2  jsoncpp-1.6.5.tar.gz"
sha512sums="589153d525ffde15e10f1ef6907c6b5d0f62a41c8cebdc12fe2bc4d989bcd861cdac79526de2f51872c0a17e574bf0fd8c913f0aa301c184efa1e3f2fb2b1955  jsoncpp-1.6.5.tar.gz"