aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua5.1/APKBUILD
blob: 3630b0fb05db079caa819ea42e472339d0dada86 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lua5.1
_pkgname=lua
pkgver=5.1.5
_luaver=${pkgname#lua}
pkgrel=4
pkgdesc="A powerful light-weight programming language designed for extending applications."
url="https://www.lua.org/"
arch="all"
license="MIT"
depends_dev="$pkgname"
makedepends="libtool autoconf automake"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
source="https://www.lua.org/ftp/lua-$pkgver.tar.gz
	lua-5.1-make.patch
	lua-5.1-module_paths.patch
	lua-5.1-readline.patch
	"
builddir="$srcdir/lua-$pkgver"

prepare() {
	default_prepare

	cd "$builddir"

	# we want packages to find our things
	sed -i 's:/usr/local:/usr:' etc/lua.pc

	# correct lua versioning
	sed -i 's/\(LIB_VERSION = \).*/\16:4:1/' src/Makefile

	# we use libtool
	cat > configure.ac <<-EOF
		top_buildir=.

		AC_INIT(src/luaconf.h)
		AC_PROG_LIBTOOL
		AC_OUTPUT()
	EOF

	libtoolize --force --install && aclocal && autoconf
}

build() {
	cd "$builddir"

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr

	cd "$builddir"/src
	make CFLAGS=" -DLUA_USE_LINUX $CFLAGS" \
		RPATH="/usr/lib" \
		LIB_LIBS="-lpthread -lm -ldl" \
		V=$pkgver \
		alpine_all
}

package() {
	cd "$builddir"

	make V=$pkgver \
		INSTALL_TOP="$pkgdir/usr" \
		INSTALL_INC="$pkgdir/usr/include" \
		INSTALL_LIB="$pkgdir/usr/lib" \
		alpine_install

	local i; for i in "$pkgdir"/usr/bin/*; do
		mv "$i" "$i"$_luaver
	done

	install -D -m 644 etc/lua.pc "$pkgdir"/usr/lib/pkgconfig/lua$_luaver.pc
	install -D -m 644 doc/lua.1 "$pkgdir"/usr/share/man/man1/lua$_luaver.1
	install -D -m 644 doc/luac.1 "$pkgdir"/usr/share/man/man1/luac$_luaver.1
}

dev() {
	default_dev
	replaces="lua-dev"
}

libs() {
	pkgdesc="Lua dynamic library runtime"
	replaces="lua lua-libs"

	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/lib "$subpkgdir"/usr/
}

sha512sums="0142fefcbd13afcd9b201403592aa60620011cc8e8559d4d2db2f92739d18186860989f48caa45830ff4f99bfc7483287fd3ff3a16d4dec928e2767ce4d542a9  lua-5.1.5.tar.gz
ec5945f9f73d87fceaaa2418f1dc5c0f1e2ab1392e3a110e9ca737bfd122a951543899cd9b6170771374c35de8dd106f7b51ba9885eae281241c79b47ee58370  lua-5.1-make.patch
6f9ad12b48ce250d23ed5d91b2feb2db43c405efc30df8ea1c818a83d0a4b36d934e8629224a9a3ca575f9bad1337ed4a97624884e4e2bab9b73e3aed5c20c64  lua-5.1-module_paths.patch
a99154258419dc2e582804eae97517687e5b8b5f731dc91722193d1ff470b8522af6ff4e7142c9258afe4734cd52e6987d3c2108ac52b1487a262f1e89f2f332  lua-5.1-readline.patch"