aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua5.2/APKBUILD
blob: 80da83aa39a1f0b0fab2a102bfd0b958d46eaaa9 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lua5.2
pkgver=5.2.4
_luaver=${pkgname#lua}
pkgrel=1
pkgdesc="Powerful light-weight programming language"
url="http://www.lua.org/"
arch="all"
license="MIT"
depends=
ldpath="/usr/lib/$pkgname"
makedepends="libtool autoconf automake"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
source="http://www.lua.org/ftp/lua-$pkgver.tar.gz
	lua-5.2-make.patch
	lua-5.2-module_paths.patch
	"

_builddir="$srcdir"/lua-$pkgver
prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		patch*|*.patch)
			msg "Applying $i"
			patch -p1 -i "$srcdir"/$i || return 1
			;;
		esac
	done

	# disable readline
	sed -i -e '/#define LUA_USE_READLINE/d' src/luaconf.h

	# 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 \
		|| return 1
	cd src
	make V=$pkgver \
		CFLAGS=" -DLUA_USE_LINUX -DLUA_COMPAT_ALL" \
		SYSLDFLAGS="$LDFLAGS" \
		RPATH="/usr/lib" \
		LIB_LIBS="-lpthread -lm -ldl" \
		alpine_all || return 1
}

package() {
	cd "$_builddir"
	make V=$pkgver \
		INSTALL_TOP="$pkgdir"/usr \
		INSTALL_INC="$pkgdir"/usr/include/$pkgname \
		INSTALL_LIB="$pkgdir"/usr/lib/$pkgname \
		alpine_install || return 1
	rm "$pkgdir"/usr/lib/$pkgname/*.la || return 1

	for i in "$pkgdir"/usr/bin/* ; do
		mv $i ${i}${_luaver} || return 1
	done

	for i in "$pkgdir"/usr/lib/$pkgname/*.so.*; do
		ln -s $pkgname/${i##*/} "$pkgdir"/usr/lib/${i##*/} || return 1
	done

	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 \
		|| return 1

	install -d "$pkgdir"/usr/lib/pkgconfig
	cat > "$pkgdir"/usr/lib/pkgconfig/lua$_luaver.pc <<EOF
# lua.pc -- pkg-config data for Lua

# vars from install Makefile

# grep '^V=' ../Makefile
V= ${_luaver}
# grep '^R=' ../Makefile
R= ${pkgver}

# grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
prefix= /usr
INSTALL_BIN= \${prefix}/bin
INSTALL_INC= \${prefix}/include
INSTALL_LIB= \${prefix}/lib
INSTALL_MAN= \${prefix}/man/man1
INSTALL_LMOD= \${prefix}/share/lua/\${V}
INSTALL_CMOD= \${prefix}/lib/lua/\${V}

# canonical vars
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib/$pkgname
includedir=\${prefix}/include/$pkgname

Name: Lua
Description: An Extensible Extension Language
Version: \${R}
Requires:
Libs: -L\${libdir} -llua -lm
Cflags: -I\${includedir}

# (end of lua$_luaver.pc)
EOF

}

dev() {
	default_dev
	mkdir -p "$subpkgdir"/usr/$pkgname "$subpkgdir"/usr/lib/$pkgname
	ln -s ../include/$pkgname "$subpkgdir"/usr/$pkgname/include || return 1
	ln -s ../lib/$pkgname "$subpkgdir"/usr/$pkgname/lib || return 1
	mv "$pkgdir"/usr/lib/$pkgname/liblua.so "$subpkgdir"/usr/lib/$pkgname/ \
		|| return 1
}

libs() {
	pkgdesc="Lua dynamic library runtime"
	replaces="lua"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/lib "$subpkgdir"/usr/
}

md5sums="913fdb32207046b273fdb17aad70be13  lua-5.2.4.tar.gz
04df4ba7df30c617bd101aba3541c06d  lua-5.2-make.patch
c34dc7623ff3c8b9ec9dab6499c841e2  lua-5.2-module_paths.patch"
sha256sums="b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b  lua-5.2.4.tar.gz
eef3724469c62627722435b4cf30db4ebb1230e5512da11d9b9431a29b02955a  lua-5.2-make.patch
790802a33b2200064e92abfdd0faae560a2af903ae78e5b79661f4b8e19d2bb7  lua-5.2-module_paths.patch"
sha512sums="cd77148aba4b707b6c159758b5e8444e04f968092eb98f6b4c405b2fb647e709370d5a8dcf604176101d3407e196a7433b5dcdce4fe9605c76191d3649d61a8c  lua-5.2.4.tar.gz
f1d5e0a1db0790fae82dd6de5742631c6c4ca009752630a612d864746990a00c8f2eacc7dbf07be2bce94d04da4ad185ed10dc317d7bf093df698bf84fea682e  lua-5.2-make.patch
062eb61132a60c10358590db30e8f5698ceb088b94bdcff840423c70c7bcdac4fe96c3ad35a068b795953f25712f28a4e0efd7a7bb29a0360285bf2c8bf7c416  lua-5.2-module_paths.patch"