summaryrefslogtreecommitdiff
path: root/repo/lua5-1/lua5-1.xibuild
blob: ddfd991ced59f8e1cbd3d1415f3dde8e3acdf20b (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
#!/bin/sh

MAKEDEPS="make "
DEPS="readline"

PKG_VER=5.4.4
SOURCE=https://www.lua.org/ftp/lua-$PKG_VER.tar.gz

#  use alpinelinux's makefile
ADDITIONAL="
    lua-5.1-make.patch
    lua-5.1-module_paths.patch
    lua-5.1-readline.patch
"

DESC="A powerful lightweight scripting language"

prepare () {

    apply_patches
    
	# 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

	cat > configure.ac <<-EOF
		top_buildir=.

		AC_INIT(src/luaconf.h)
		AC_PROG_LIBTOOL
		AC_OUTPUT()
	EOF
	libtoolize --force --install && aclocal && autoconf


}

build () {
	./configure \
		--prefix=/usr
    cd src
    make CFLAGS="$CFLAGS -DLUA_USE_LINUX" \
		SYSLDFLAGS="$LDFLAGS" \
		LIB_LIBS="-lpthread -lm -ldl" \
        RPATH="/usr/lib" \
        V=${PKG_VER%.*} 
}

package () {
    cd ..
    sed -i "s/INSTALL= install -p/INSTALL= install/g" Makefile
    make V=$PKG_VER \
		INSTALL_TOP="$PKG_DEST/usr" \
		INSTALL_INC="$PKG_DEST/usr/include" \
		INSTALL_LIB="$PKG_DEST/usr/lib" \

    install -D -m 644 etc/lua.pc "$PKG_DEST"/usr/lib/pkgconfig/lua5.1.pc
	install -D -m 644 doc/lua.1 "$PKG_DEST"/usr/share/man/man1/lua5.1.1
	install -D -m 644 doc/luac.1 "$PKG_DEST"/usr/share/man/man1/luac5.1.1

	mkdir -p "$PKG_DEST"/usr/share/doc/lua5-1/
	install -m644 doc/*.html doc/*.css doc/logo.gif doc/cover.png \
		"$PKG_DEST"/usr/share/doc/lua5-1/

    install -m644 -D etc/lua.pc $PKG_DEST/usr/lib/pkgconfig/lua5.1.pc
}