summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7f21fbfa016d2a6b235399f6f2d1e078421e51b2 (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
# Maintainer: Romain Porte <microjoe@mailoo.org>
# Creator: chefpeyo <pierre-olivier.huguet@asp64.com>
# Contributor: kuri <sysegv@gmail.com>

pkgname=cjson-git
pkgver=v1.1.0.r4.gfcc89c4
pkgrel=2
pkgdesc="Dave Gamble's cJSON library. Easily handle JSON data in C (git version)."
arch=('i686' 'x86_64')
url="https://github.com/DaveGamble/cJSON"
license=('LGPL2')
depends=()
makedepends=('git' 'cmake')
conflits=()
provides=('cjson')
options=('!libtool')
source=('git://github.com/DaveGamble/cJSON.git')
md5sums=(SKIP)

_gitname="cJSON"

pkgver() {
	cd "$srcdir/$_gitname"
	( set -o pipefail
		git describe --long --tags 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
		printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
	)
}

build() {
	cd $_gitname

	rm -rf build
	mkdir build
	cd build
	cmake .. -DENABLE_CJSON_UTILS=On -DENABLE_CJSON_TEST=Off -DCMAKE_INSTALL_PREFIX=/usr
	make || return 1
}

package() {
	cd $_gitname/build

	make DESTDIR=$pkgdir install || return 1

	# install license files
	install -Dm644 $srcdir/$_gitname/LICENSE \
		$pkgdir/usr/share/licenses/$pkgname/LICENSE
}