APKBUILD 1.67 KB
Newer Older
1
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2

3
_luaversions="5.1 5.2 5.3"
4

5
pkgname=lua-lzlib
6
_name=lzlib
7
pkgver=0.4.3
8
pkgrel=0
9
pkgdesc="Lua bindings to the ZLib compression library"
10
url="https://github.com/LuaDist/lzlib"
11
arch="all"
12
license="MIT"
13
depends=""
14
makedepends="zlib-dev"
15
subpackages=
16 17
for _i in $_luaversions; do
        makedepends="$makedepends lua$_i-dev"
18
        subpackages="$subpackages lua$_i-lzlib:_zlib_${_i/./_}"
19 20 21
done
install=
source="$pkgname-$pkgver.tar.gz::https://github.com/LuaDist/$_name/archive/$pkgver.tar.gz"
22

23
_builddir="$srcdir"/$_name-$pkgver
24 25 26 27

prepare() {
	cd "$_builddir"
	# apply patches here
28 29 30
	for _i in $_luaversions; do
		cp -a "$_builddir" "$srcdir"/build-$_i || return 1
	done
31 32 33 34
}

build() {
	cd "$_builddir"
35 36 37 38 39 40 41 42
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		msg "build for Lua $_i"
		make \
			CFLAGS="$CFLAGS $(pkg-config --cflags lua$_i)" \
			LDFLAGS="$LDFLAGS $(pkg-config --libs lua$_i)" \
			|| return 1
        done
43 44 45
}

package() {
46
	mkdir -p "$pkgdir"
47 48
}

49 50 51
_split_zlib() {
	local _ver=$1
	pkgdesc="$pkgdesc for Lua $_ver"
52
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
53 54 55 56 57 58 59 60 61 62 63
	depends=""

	cd "$srcdir"/build-$_ver
	install -Dm755 zlib.so "$subpkgdir"/usr/lib/lua/$_ver/zlib.so
	install -Dm644 gzip.lua "$subpkgdir"/usr/share/lua/$_ver/gzip.lua
}

for _i in $_luaversions; do
	eval "_zlib_${_i/./_}() { _split_zlib $_i; }"
done

64 65 66
md5sums="96fe467c2c9cd1b29faf2a0f0a029f00  lua-lzlib-0.4.3.tar.gz"
sha256sums="cbb0cac5825e940b4ea2f31a336d2aaf6db39847d456920afd8e443804420dbb  lua-lzlib-0.4.3.tar.gz"
sha512sums="7f90533091ed4917019a26c1a944101dffbaaeac8c6608d9a9e078e624f8598f46e8fee939680dcea95317d752ca6bb85b21fb611f003ddbae362fa36e05e9c3  lua-lzlib-0.4.3.tar.gz"