aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/lua-file-magic/APKBUILD49
-rw-r--r--main/lua5.2-file-magic/APKBUILD27
2 files changed, 49 insertions, 27 deletions
diff --git a/main/lua-file-magic/APKBUILD b/main/lua-file-magic/APKBUILD
new file mode 100644
index 0000000000..4d8ae880ec
--- /dev/null
+++ b/main/lua-file-magic/APKBUILD
@@ -0,0 +1,49 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=lua-file-magic
+pkgver=0.2
+pkgrel=1
+pkgdesc="Lua binding to libmagic"
+url="https://github.com/ncopa/lua-file-magic"
+arch="all"
+license="LGPL"
+depends="lua"
+makedepends="file-dev"
+source="$pkgname-$pkgver.tar.gz::https://github.com/ncopa/$pkgname/archive/v$pkgver.tar.gz"
+builddir="$srcdir/$pkgname-$pkgver"
+
+_luaversions="5.2 5.3"
+for _v in $_luaversions; do
+ makedepends="$makedepends lua$_v-dev"
+ subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
+done
+
+prepare() {
+ default_prepare
+
+ local lver; for lver in $_luaversions; do
+ cp -r "$builddir" "$builddir-$lver"
+ done
+}
+
+build() {
+ local lver; for lver in $_luaversions; do
+ msg "Building for Lua $lver..."
+ make -C "$builddir-$lver" LUAPC=lua$lver
+ done
+}
+
+package() {
+ mkdir -p "$pkgdir"
+}
+
+_subpackage() {
+ local lver="${subpkgname:3:3}"
+ pkgdesc="$pkgdesc (for Lua $lver)"
+ depends="lua$lver"
+ install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
+ local cmod_dir="$subpkgdir/$(pkg-config --variable=INSTALL_CMOD lua$lver)"
+
+ install -D -m 755 "$builddir-$lver"/magic.so "$cmod_dir"/magic.so
+}
+
+sha512sums="f107b27410a3acf1305536bed064fa730943369afbeaeadc4b723334d4c16c330fc8544e426fda223f5b10353d83d028f306a48ec5d6f6cb905fda45271b94c8 lua-file-magic-0.2.tar.gz"
diff --git a/main/lua5.2-file-magic/APKBUILD b/main/lua5.2-file-magic/APKBUILD
deleted file mode 100644
index 92a9877af5..0000000000
--- a/main/lua5.2-file-magic/APKBUILD
+++ /dev/null
@@ -1,27 +0,0 @@
-# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
-pkgname=lua5.2-file-magic
-_pkgname=lua-file-magic
-pkgver=0.2
-pkgrel=0
-pkgdesc="Lua binding to libmagic"
-url="https://github.com/ncopa/lua-file-magic"
-arch="all"
-license="LGPL"
-depends="lua5.2"
-makedepends="lua5.2-dev file-dev"
-source="$_pkgname-$pkgver.tar.gz::https://github.com/ncopa/$_pkgname/archive/v$pkgver.tar.gz"
-builddir="$srcdir/$_pkgname-$pkgver"
-
-build() {
- cd "$builddir"
- make
-}
-
-package() {
- cd "$builddir"
-
- local cmod_dir=$(pkg-config --variable=INSTALL_CMOD lua5.2)
- install -D magic.so "$pkgdir"/$cmod_dir/magic.so
-}
-
-sha512sums="f107b27410a3acf1305536bed064fa730943369afbeaeadc4b723334d4c16c330fc8544e426fda223f5b10353d83d028f306a48ec5d6f6cb905fda45271b94c8 lua-file-magic-0.2.tar.gz"