aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua5.4/APKBUILD
blob: 89c7c68d68b70b8ae0c28ff5b2945e037fa59412 (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
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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lua5.4
_pkgname=lua
pkgver=5.4.2
_luaver=${pkgname#lua}
pkgrel=0
pkgdesc="Powerful light-weight programming language"
url="https://www.lua.org/"
arch="all"
license="MIT"
ldpath="/usr/lib/$pkgname"
depends_dev="$pkgname"
makedepends="libtool autoconf automake readline-dev"
provides="lua"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
source="https://www.lua.org/ftp/$_pkgname-$pkgver.tar.gz
	lua-5.4-make.patch
	lua-5.4-module_paths.patch
	lua5.4.pc
	"
builddir="$srcdir/$_pkgname-$pkgver"

# secfixes:
#   5.3.5-r2:
#     - CVE-2019-6706

prepare() {
	default_prepare

	# Fill in data from pkgconfig file
	sed -e "s|@MAJOR_VER@|$_luaver|g" \
		-e "s|@MINOR_VER@|$pkgver|g" \
		-i "$srcdir"/lua5.4.pc

	# 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() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr

	cd src
	make V=${pkgver%.*} \
		CFLAGS="$CFLAGS -DLUA_USE_LINUX -DLUA_COMPAT_5_2 -DLUA_USE_READLINE" \
		SYSLDFLAGS="$LDFLAGS" \
		RPATH="/usr/lib" \
		LIB_LIBS="-lpthread -lm -ldl -lreadline" \
		alpine_all
}

check() {
	make test
}

package() {
	local i
	make V=${pkgver%.*} \
		INSTALL_TOP="$pkgdir"/usr \
		INSTALL_INC="$pkgdir"/usr/include/$pkgname \
		INSTALL_LIB="$pkgdir"/usr/lib/$pkgname \
		alpine_install

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

	for i in "$pkgdir"/usr/lib/$pkgname/*.so.*; do
		ln -s $pkgname/${i##*/} "$pkgdir"/usr/lib/${i##*/}
	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

	install -Dm644 "$srcdir"/lua5.4.pc -t "$pkgdir"/usr/lib/pkgconfig
}

dev() {
	default_dev

	mkdir -p "$subpkgdir"/usr/$pkgname "$subpkgdir"/usr/lib/$pkgname
	ln -s ../include/$pkgname "$subpkgdir"/usr/$pkgname/include
	ln -s ../lib/$pkgname "$subpkgdir"/usr/$pkgname/lib
	mv "$pkgdir"/usr/lib/$pkgname/liblua.so "$subpkgdir"/usr/lib/$pkgname/
}

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

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

sha512sums="9454a6ffd973598f2f4a2399834c31c4d5090bd12e716776e3189aa57760319d114ee64a8338bbc2ef5e08150bf0adc2ad94a1b2677f38538a43359969d4d920  lua-5.4.2.tar.gz
1bc6c623024c1738155b30ff9c0edcce0f336edc25aa20c3a1400c859421ea2015d75175cce8d515e055ac3e96028426b74812e04022af18a0ed4c4601556027  lua-5.4-make.patch
904a9b296d0bdb68630f8865fce86fc8f092120ee6ebfeb97f069b5aa49f203ddc63aeceee276ae8e006bbb73bf2811e7eceb6aae82817170d3acef3ad057c93  lua-5.4-module_paths.patch
34466bc244737a557ff2c87efbc62ab5c5424523f574d17b2f34aea40f534f2c45cdfa242097aadecd38f00d732b0c8e9daef1cd461728a084c72946edb9a48a  lua5.4.pc"