aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-xml/APKBUILD
blob: a5873264760411ec0b7fb0e3d31d00c6d910d526 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2"
pkgname=lua-xml
_name=luaxml
pkgver=130610
pkgrel=4
pkgdesc="a minimal set of functions for the processing of XML data in Lua"
url="https://github.com/LuaDist2/luaxml"
arch="all"
license="MIT"
depends=
makedepends=""
install=
subpackages=
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-xml:split_${_v/./_}"
done
# Original upstream http://viremo.eludi.net/LuaXML/ is not available anymore.
source="$pkgname-$pkgver.tar.gz::https://github.com/LuaDist2/$_name/archive/$pkgver-1.tar.gz
0001-Fix-error-where-TAG-should-be-xml.TAG.patch"

_builddir="$srcdir/$_name-$pkgver-1"

prepare() {
	cd "$_builddir"
	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
		mkdir $i
		cp *.c Makefile *.lua $i/ || return 1
	done
}

build() {
	for i in $_luaversions; do
		cd "$_builddir"/$i
		make INCDIR="$CFLAGS $(pkg-config --cflags lua$i)" \
			LIBS= \
			|| return 1
	done
}

package() {
	for i in $_luaversions; do
		cd "$_builddir"/$i
		install -m755 -D LuaXML_lib.so \
			"$pkgdir"/usr/lib/lua/$i/LuaXML_lib.so || return 1
		install -m755 -D LuaXml.lua \
			"$pkgdir"/usr/share/lua/$i/LuaXml.lua || return 1
	done
}

_split() {
	local d= _ver=$1
	pkgdesc="$pkgdesc for Lua $_ver"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	depends=
	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 _v in $_luaversions; do
	eval "split_${_v/./_}() { _split $_v; }"
done

sha512sums="aabac62b5e748c04cd3591e5c2e6b417909c7a9efa1ff6c3dd1f546a2387220eb7fa1ffa56d3be0718a84a6fed51f287b68c7d334661c66787f7024d76142dfc  lua-xml-130610.tar.gz
60ba65a0d47065e2609ca4d5c8d994fc29b9d4c6b5b0a060fa7f83612c71937999648e48dd26063f6528811eb053fe912ee5b6c4465576912c9dacb9bb406cae  0001-Fix-error-where-TAG-should-be-xml.TAG.patch"