aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-cjson/APKBUILD
blob: 8f9dbd6e6ed2bed87e7f0d44ab1c85ec43c5eb73 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>

_luaversions="5.1 5.2 5.3"
pkgname=lua-cjson
pkgver=2.1.0
pkgrel=6
pkgdesc="fast JSON parsing and encoding support for Lua"
url="http://www.kyne.com.au/~mark/software/lua-cjson.php"
arch="all"
license="MIT"
depends=""
install=""
makedepends=""
subpackages=""
for _i in $_luaversions; do
	makedepends="$makedepends lua$_i-dev"
	subpackages="$subpackages lua$_i-cjson:split_${_i/./_}"
done
source="http://www.kyne.com.au/~mark/software/download/lua-cjson-$pkgver.tar.gz
	0001-Use-pkg-config-to-detect-cflags-or-fallback-to-LUA_I.patch
	0002-lua53-integers.patch
	0003-empty-array-metadata.patch
	"


_sdir="$srcdir"/lua-cjson-$pkgver

prepare() {
	local i
	cd "$_sdir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	for _i in $_luaversions; do
		cp -r "$_sdir" "$srcdir"/build-$_i
		sed -i -e "/^LUA_VERSION\s*=/s/=.*/= $_i/" \
			"$srcdir"/build-$_i/Makefile || return 1
	done
}

build() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make PREFIX=/usr || return 1
	done
}

package() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make PREFIX=/usr DESTDIR="$pkgdir" install || return 1
	done
}

_split() {
	local d= _ver=$1
	pkgdesc="fast JSON parsing and encoding support for Lua $_ver"
	replaces="$pkgname"
	depends=
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	for d in usr/lib/lua usr/share/lua; do
		if [ -d "$pkgdir"/$d/$_ver ]; then
			mkdir -p "$subpkgdir"/$d
			mv "$pkgdir"/$d/$_ver "$subpkgdir"/$d/ || return 1
		fi
	done
}

for _i in $_luaversions; do
	eval "split_${_i/./_}() { _split $_i; }"
done

md5sums="24f270663e9f6ca8ba2a02cef19f7963  lua-cjson-2.1.0.tar.gz
84a94739f4ead0b4b2e80376dbed7b08  0001-Use-pkg-config-to-detect-cflags-or-fallback-to-LUA_I.patch
1b37edbe331691d96d9a506ed6fbe1db  0002-lua53-integers.patch
18d361083d5b5aab987d897629a38982  0003-empty-array-metadata.patch"
sha256sums="51bc69cd55931e0cba2ceae39e9efa2483f4292da3a88a1ed470eda829f6c778  lua-cjson-2.1.0.tar.gz
cef22bd926c88053b1be147c6420e9b9918b09a32cb3cad9e81524619048020a  0001-Use-pkg-config-to-detect-cflags-or-fallback-to-LUA_I.patch
76bcddec37e70538831d366998e7b1ccf9609bd7f07fe181b3475667be7dcfd9  0002-lua53-integers.patch
a28eb784e0d33d149f69f1011a8f65549c38cbe5d9a2e823ce40c3cd9c7c6cde  0003-empty-array-metadata.patch"
sha512sums="4343513b942f2ed98dc1ea6d7e852303bc1263f8acc5c70c8d674aec7adfc8279c5af7d5173a417b6f9a74543b8f6c8f98742d002f4f75832bbf23bb5a30ad2f  lua-cjson-2.1.0.tar.gz
5137cf25ca125b03ff2e95cedd8396d63b9a4919b1aba4ef333fd8945a4fd20f423c1e8d36b954a15969bd344cd43bb6c50df8b878cd74a706d6065455fbb003  0001-Use-pkg-config-to-detect-cflags-or-fallback-to-LUA_I.patch
2cf4d4fa116850a6a8fb74f27779383a339ca08ed81cdcb03be985c731b91234e7552a26913b609f2c9b02516fc74171d4e5fbb446bcdaf0eddddac3af08865a  0002-lua53-integers.patch
77a05166a88b7ec7d1c7fa2cd7e22fdf75dd2882d67529f8c924e8408c8bf3d210b8e2cd803cffc6d6460a63e079e331237811f1dbfeb03051090f4d6278a350  0003-empty-array-metadata.patch"