aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-cjson
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-12-27 23:00:48 +0100
committerJakub Jirutka <jakub@jirutka.cz>2017-12-27 23:17:04 +0100
commit40cd52c03ab5e1686b41fca0ae6caf7412e34252 (patch)
tree63c7d30318949536bc8db5ce898dd6d4dc7199da /main/lua-cjson
parente34876fe5259dc9db39e93a1e3a32eed7e9113cc (diff)
downloadaports-40cd52c03ab5e1686b41fca0ae6caf7412e34252.tar.bz2
aports-40cd52c03ab5e1686b41fca0ae6caf7412e34252.tar.xz
main/lua-cjson: improve abuild and add rock manifest
Diffstat (limited to 'main/lua-cjson')
-rw-r--r--main/lua-cjson/APKBUILD79
1 files changed, 33 insertions, 46 deletions
diff --git a/main/lua-cjson/APKBUILD b/main/lua-cjson/APKBUILD
index 8c7cc9a8bf..57b7073950 100644
--- a/main/lua-cjson/APKBUILD
+++ b/main/lua-cjson/APKBUILD
@@ -1,77 +1,64 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
-
-_luaversions="5.1 5.2 5.3"
pkgname=lua-cjson
pkgver=2.1.0
-pkgrel=7
+pkgrel=8
pkgdesc="fast JSON parsing and encoding support for Lua"
url="https://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
+source="http://www.kyne.com.au/~mark/software/download/$pkgname-$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
0004-Option-for-sorting-object-keys.patch
"
+builddir="$srcdir/$pkgname-$pkgver"
-
-_sdir="$srcdir"/lua-cjson-$pkgver
+_luaversions="5.1 5.2 5.3"
+for _v in $_luaversions; do
+ makedepends="$makedepends lua$_v-dev"
+ subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
+done
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
+ default_prepare
+
+ local lver; for lver in $_luaversions; do
+ cp -r "$builddir" "$builddir-$lver"
done
}
build() {
- for _i in $_luaversions; do
- cd "$srcdir"/build-$_i
- make PREFIX=/usr || return 1
+ local lver; for lver in $_luaversions; do
+ msg "Building for Lua $lver..."
+ make -C "$builddir-$lver" \
+ CFLAGS="$CFLAGS -Wall -pedantic -DNDEBUG" \
+ BUILD_CFLAGS="$(pkg-config --cflags lua$lver) -fpic"
done
}
package() {
- for _i in $_luaversions; do
- cd "$srcdir"/build-$_i
- make PREFIX=/usr DESTDIR="$pkgdir" install || return 1
- done
+ mkdir -p "$pkgdir"
}
-_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
-}
+_subpackage() {
+ local lver="${subpkgname:3:3}"
+ pkgdesc="$pkgdesc $lver"
+ depends="lua$lver"
+ install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
+ local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$pkgname/$pkgver-1"
-for _i in $_luaversions; do
- eval "split_${_i/./_}() { _split $_i; }"
-done
+ make -C "$builddir-$lver" \
+ DESTDIR="$subpkgdir" \
+ LUA_CMODULE_DIR=$(pkg-config --variable=INSTALL_CMOD lua$lver) \
+ PREFIX=/usr \
+ install
+
+ mkdir -p "$rockdir"
+ echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
+}
sha512sums="4343513b942f2ed98dc1ea6d7e852303bc1263f8acc5c70c8d674aec7adfc8279c5af7d5173a417b6f9a74543b8f6c8f98742d002f4f75832bbf23bb5a30ad2f lua-cjson-2.1.0.tar.gz
5137cf25ca125b03ff2e95cedd8396d63b9a4919b1aba4ef333fd8945a4fd20f423c1e8d36b954a15969bd344cd43bb6c50df8b878cd74a706d6065455fbb003 0001-Use-pkg-config-to-detect-cflags-or-fallback-to-LUA_I.patch