summaryrefslogtreecommitdiffstats
path: root/main/yajl/APKBUILD
blob: c6e63aea55959e928f34b43369057471571af5b0 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=yajl
pkgver=2.0.4
pkgrel=0
pkgdesc="Yet Another JSON Library (YAJL)"
url="http://lloyd.github.com/yajl/"
arch="all"
license="BSD"
depends=""
makedepends="cmake"
install=""
subpackages="$pkgname-dev $pkgname-tools"
source="http://dev.alpinelinux.org/archive/yajl/yajl-$pkgver.tar.gz
	libm.patch"

_builddir="$srcdir"/yajl-$pkgver

# How to create archive from git:
#
#  abuild snapshot
#

_gitrepo=yajl.git
_giturl="git://github.com/lloyd/$_gitrepo"
_gittag=$pkgver

snapshot() {
	local _tarball=$pkgname-$pkgver.tar.gz
	msg "Creating $_tarball.."
	mkdir -p "$srcdir"
	cd "${SRCDEST:-$srcdir}"
	if ! [ -d "$_gitrepo" ]; then
		git clone --bare  $_giturl || return 1
	else
		git --git-dir=$_gitrepo fetch || return 1
        fi

        git --git-dir=$_gitrepo archive --prefix=$pkgname-$pkgver/ \
		-o "$SRCDEST"/$_tarball $_gittag || return 1

	msg "Uploading $_tarball"
        scp "$SRCDEST"/$_tarball dev.alpinelinux.org:/archive/$pkgname/
}

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"
	cmake -DCMAKE_INSTALL_PREFIX="/usr" . || return 1
	make
}

package() {
	cd "$_builddir"
	make install DESTDIR="$pkgdir" || return 1
	mv "$pkgdir"/usr/share/pkgconfig "$pkgdir"/usr/lib/
}

tools() {
	pkgdesc="JSON tools based on Yajl"
	mkdir -p "$subpkgdir"/usr/
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}


md5sums="2e66ad7d668423875aeeb4c1b206e385  yajl-2.0.4.tar.gz
64ae0008a567c3246ce805b6495d4c54  libm.patch"