aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua5.3/APKBUILD
blob: 7682b0a5f09d29e8373c7f3b8089937e9fcd7d67 (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
145
146
147
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lua5.3
_pkgname=lua
pkgver=5.3.2
_luaver=${pkgname#lua}
pkgrel=0
pkgdesc="Powerful light-weight programming language"
url="http://www.lua.org/"
arch="all"
license="MIT"
ldpath="/usr/lib/$pkgname"
depends_dev="$pkgname"
makedepends="libtool autoconf automake linenoise-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
source="http://www.lua.org/ftp/$_pkgname-$pkgver.tar.gz
	lua-5.3-make.patch
	lua-5.3-module_paths.patch
	linenoise.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

prepare() {
	default_prepare || return 1
	cd "$builddir"

	# 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_5_2 -DLUA_USE_LINENOISE" \
		SYSLDFLAGS="$LDFLAGS" \
		RPATH="/usr/lib" \
		LIB_LIBS="-lpthread -lm -ldl -llinenoise" \
		alpine_all || return 1
}

package() {
	local i
	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/*.a || 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 || return 1

	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="33278c2ab5ee3c1a875be8d55c1ca2a1  lua-5.3.2.tar.gz
67acac7d9e37da67806f6a08c8100599  lua-5.3-make.patch
eefd0de61b6993c62a880dc218c9abd6  lua-5.3-module_paths.patch
1447ddfe8a4217b1d23ece0583ab771c  linenoise.patch"
sha256sums="c740c7bb23a936944e1cc63b7c3c5351a8976d7867c5252c8854f7b2af9da68f  lua-5.3.2.tar.gz
64eafd1d2945623fe807384f9967f94d485b4b9b620ed977b3faca80548444ce  lua-5.3-make.patch
d2e2d96d3b10e72dda2c78cb7f478d655c730195d46ab466c961a7846793c644  lua-5.3-module_paths.patch
a1761ba3151e5f0c921debecb39a7ac983a6311f08f7e5691de9f05c4cb02964  linenoise.patch"
sha512sums="c8c7908ca927bcafe6739fb8b0226d77c796226c1e6770a38f1b1b577a73f7fb08ead64fe40809d5fff9a13db50e932e9f7164e4524e9d4fb3678182ec3d4d28  lua-5.3.2.tar.gz
1bc6c623024c1738155b30ff9c0edcce0f336edc25aa20c3a1400c859421ea2015d75175cce8d515e055ac3e96028426b74812e04022af18a0ed4c4601556027  lua-5.3-make.patch
313ff823ed871f380a2cb0ba1f0afbba5cfa9b98da40e6e5e8f3c7a2e5993b13c2577efbe7147b79e3903ff27d5a814fa782c1c925092b08510cb4ce02abf464  lua-5.3-module_paths.patch
49880d1131b7bd2a3169a26f401769a91d9a6a62cefe68aa5a89097139289588b7ef753535a2d0ba7f45c0369c760554940fd810716b7b1353deace32432fcfe  linenoise.patch"