aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-iconv/APKBUILD
blob: d778a98832d2108a176f17ad5bd9c24d09f85371 (plain) (blame)
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

md5sums="8a38b4e6ac8a9290093898793d16fe4b  lua-iconv-7.tar.gz
88e23691e79f357a6048f226e8ed8e23  0001-lua-iconv-make-close-available-from-lua.patch"