aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-iconv/APKBUILD
blob: 5731264b7c7979f94f02492d00299467048ef364 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-iconv
pkgver=7
pkgrel=1
pkgdesc="Lua binding to the POSIX 'iconv' library"
url="http://ittner.github.io/lua-iconv/"
arch="all"
license="MIT"
depends=
makedepends=""
for _i in $_luaversions; do
	makedepends="$makedepends lua$_i-dev"
	subpackages="$subpackages lua$_i-iconv:split_${_i/./_}"
done
install=
source="https://github.com/downloads/ittner/lua-iconv/lua-iconv-$pkgver.tar.gz
	0001-lua-iconv-make-close-available-from-lua.patch"

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_builddir"
	patch -p1 -i "$srcdir"/0001-lua-iconv-make-close-available-from-lua.patch
	cd "$srcdir"
	for _i in $_luaversions; do
		cp -r $_builddir $_i || return 1
	done
}

build() {
	for _i in $_luaversions; do
		msg "Build for Lua $_i"
		cd "$srcdir"/$_i
		make LUAPKG="lua$_i" \
			CFLAGS="$CFLAGS $(pkg-config lua$_i --cflags)" \
				|| return 1
	done
}

package() {
	cd "$srcdir"
	for _i in $_luaversions; do
		install -D -s $_i/iconv.so "$pkgdir"/usr/lib/lua/$_i/iconv.so \
			|| return 1
	done
}

_split() {
	local d=usr/lib/lua _ver=$1
	pkgdesc="$pkgdesc for Lua $_ver"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	depends=
	mkdir -p "$subpkgdir/$d" || return 1
	mv "$pkgdir/$d/$1" "$subpkgdir/$d"
}

for _v in $_luaversions; do
	eval "split_${_v/./_}() { _split $_v; }"
done

sha512sums="03b537ba6050ca8e59e6a62474e837c0d6463d1da4610e6da820afc573659571f75de0c7507792e8b7348fd91623d7af7050ead18bd09ec0c7b89a742e024a57  lua-iconv-7.tar.gz
472e6611638d57c6c99fcfe53defa9766d89c45f6eec5fb4dd31bd63a119901a99fa2219d38d66644d00c0fcfd006418ccb3ee5c0496f2397d3d76d05ae0cee9  0001-lua-iconv-make-close-available-from-lua.patch"