aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-xml/APKBUILD
blob: 39a609b9c2b02167c6e40070a4532339a49538bb (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lua-xml
_pkgname=luaxml
pkgver=130610
_pkgver=$pkgver-1
pkgrel=5
pkgdesc="A minimal set of functions for the processing of XML data in Lua"
url="https://github.com/LuaDist2/luaxml"
arch="all"
license="MIT"
makedepends=""
subpackages=""
source="$pkgname-$pkgver.tar.gz::https://github.com/LuaDist2/$_pkgname/archive/$_pkgver.tar.gz
	0001-Fix-error-where-TAG-should-be-xml.TAG.patch"
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 || return 1
	cd "$builddir"

	# Remove garbage.
	rm -f *.dll *.so *.zip

	local lver; for lver in $_luaversions; do
		cp -r "$builddir" "$builddir-$lver" || return 1
	done
}

build() {
	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."

		make -C "$builddir-$lver" \
			CFLAGS="$CFLAGS -fPIC" \
			LFLAGS="$LDFLAGS -fPIC -shared" \
			INCDIR=$(pkg-config --cflags lua$lver) \
			LIBS=$(pkg-config --libs lua$lver) \
			|| return 1
	done
}

check() {
	local lver; for lver in $_luaversions; do
		msg "Testing on Lua $lver"

		cd "$builddir-$lver"
		lua$lver test.lua || return 1
	done
}

package() {
	mkdir -p "$pkgdir"
}

_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"

	cd "$builddir-$lver"

	install -m 755 -D LuaXML_lib.so \
		"$subpkgdir"/usr/lib/lua/$lver/LuaXML_lib.so || return 1
	install -m 755 -D LuaXml.lua \
		"$subpkgdir"/usr/share/lua/$lver/LuaXml.lua

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

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