APKBUILD 2.18 KB
Newer Older
Natanael Copa's avatar
Natanael Copa committed
1
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2
pkgname=lua-luaxml
3
_pkgname=luaxml
4
pkgver=130610
5
_pkgver=$pkgver-1
6
pkgrel=5
7
pkgdesc="A minimal set of functions for the processing of XML data in Lua"
8
url="https://github.com/LuaDist2/luaxml"
9
arch="all"
Natanael Copa's avatar
Natanael Copa committed
10
license="MIT"
11
makedepends=""
12
subpackages=""
13
replaces="lua-xml"
14 15 16 17 18
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"
19 20
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
21
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
22
done
Natanael Copa's avatar
Natanael Copa committed
23 24

prepare() {
25 26 27 28 29
	default_prepare || return 1
	cd "$builddir"

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

31 32
	local lver; for lver in $_luaversions; do
		cp -r "$builddir" "$builddir-$lver" || return 1
33
	done
Natanael Copa's avatar
Natanael Copa committed
34 35 36
}

build() {
37 38 39 40 41 42 43 44
	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) \
45 46
			|| return 1
	done
Natanael Copa's avatar
Natanael Copa committed
47 48
}

49 50 51 52 53 54
check() {
	local lver; for lver in $_luaversions; do
		msg "Testing on Lua $lver"

		cd "$builddir-$lver"
		lua$lver test.lua || return 1
55
	done
Natanael Copa's avatar
Natanael Copa committed
56 57
}

58 59
package() {
	mkdir -p "$pkgdir"
60 61
}

62 63 64 65
_subpackage() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc $lver"
	depends="lua$lver"
66
	replaces="lua$lver-xml"  # for backward compatibility
67
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
68
	local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$_pkgname/$_pkgver"
69 70 71 72 73 74 75

	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
76 77 78

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

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