diff options
Diffstat (limited to 'main/lua-cjson/APKBUILD')
-rw-r--r-- | main/lua-cjson/APKBUILD | 67 |
1 files changed, 53 insertions, 14 deletions
diff --git a/main/lua-cjson/APKBUILD b/main/lua-cjson/APKBUILD index 2126d959a4..90e8889091 100644 --- a/main/lua-cjson/APKBUILD +++ b/main/lua-cjson/APKBUILD @@ -1,37 +1,76 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> -pkgname=lua-cjson -pkgver=1.0.4 -pkgrel=0 + +_luaversions="5.1 5.2" +pkgname=lua${_luaver}-cjson +pkgver=2.1.0 +pkgrel=2 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="" -makedepends="lua-dev" +depends="lua5.1-cjson" install="" +makedepends="" subpackages="" -source="http://www.kyne.com.au/~mark/software/lua-cjson-$pkgver.tar.gz" +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" + + +_sdir="$srcdir"/lua-cjson-$pkgver -_builddir="$srcdir"/lua-cjson-$pkgver prepare() { local i - cd "$_builddir" + 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() { - cd "$_builddir" - make CFLAGS_EXTRA= PREFIX=/usr|| return 1 + for _i in $_luaversions; do + cd "$srcdir"/build-$_i + make PREFIX=/usr || return 1 + done } package() { - cd "$_builddir" - make PREFIX=/usr DESTDIR="$pkgdir" install || return 1 - rm -f "$pkgdir"/usr/lib/*.la + for _i in $_luaversions; do + cd "$srcdir"/build-$_i + make PREFIX=/usr DESTDIR="$pkgdir" install || return 1 + rm -f "$pkgdir"/usr/lib/*.la + done } -md5sums="9b04196a37f724c7530794248f8e1f96 lua-cjson-1.0.4.tar.gz" +_split() { + local d= _ver=$1 + pkgdesc="fast JSON parsing and encoding support for Lua $_ver" + replaces="$pkgname" + 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" +sha256sums="51bc69cd55931e0cba2ceae39e9efa2483f4292da3a88a1ed470eda829f6c778 lua-cjson-2.1.0.tar.gz +cef22bd926c88053b1be147c6420e9b9918b09a32cb3cad9e81524619048020a 0001-Use-pkg-config-to-detect-cflags-or-fallback-to-LUA_I.patch" +sha512sums="4343513b942f2ed98dc1ea6d7e852303bc1263f8acc5c70c8d674aec7adfc8279c5af7d5173a417b6f9a74543b8f6c8f98742d002f4f75832bbf23bb5a30ad2f lua-cjson-2.1.0.tar.gz +5137cf25ca125b03ff2e95cedd8396d63b9a4919b1aba4ef333fd8945a4fd20f423c1e8d36b954a15969bd344cd43bb6c50df8b878cd74a706d6065455fbb003 0001-Use-pkg-config-to-detect-cflags-or-fallback-to-LUA_I.patch" |