summaryrefslogtreecommitdiff
path: root/repo/lua5-1
diff options
context:
space:
mode:
Diffstat (limited to 'repo/lua5-1')
-rw-r--r--repo/lua5-1/lua-5.1-make.patch71
-rw-r--r--repo/lua5-1/lua-5.1-module_paths.patch24
-rw-r--r--repo/lua5-1/lua-5.1-readline.patch10
-rw-r--r--repo/lua5-1/lua.pc32
-rw-r--r--repo/lua5-1/lua5-1.xibuild77
5 files changed, 214 insertions, 0 deletions
diff --git a/repo/lua5-1/lua-5.1-make.patch b/repo/lua5-1/lua-5.1-make.patch
new file mode 100644
index 0000000..2db6367
--- /dev/null
+++ b/repo/lua5-1/lua-5.1-make.patch
@@ -0,0 +1,71 @@
+--- ./Makefile.orig
++++ ./Makefile
+@@ -126,3 +126,18 @@
+ .PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho
+
+ # (end of Makefile)
++
++# Use libtool for binary installs, etc.
++
++export V
++export LIBTOOL = ../libtool --quiet --tag=CC
++# See libtool manual about how to set this
++
++alpine_clean:
++ cd src; $(MAKE) $@
++
++alpine_install:
++ mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB)
++ cd src; $(LIBTOOL) --mode=install $(INSTALL_EXEC) lua luac $(INSTALL_BIN)
++ cd src; $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
++ cd src; $(LIBTOOL) --mode=install $(INSTALL_DATA) liblua.la $(INSTALL_LIB)
+--- ./src/Makefile.orig
++++ ./src/Makefile
+@@ -51,10 +51,10 @@
+ $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
+ $(RANLIB) $@
+
+-$(LUA_T): $(LUA_O) $(LUA_A)
++origin$(LUA_T): $(LUA_O) $(LUA_A)
+ $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+
+-$(LUAC_T): $(LUAC_O) $(LUA_A)
++origin$(LUAC_T): $(LUAC_O) $(LUA_A)
+ $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+
+ clean:
+@@ -178,5 +178,34 @@
+ lzio.h
+ print.o: print.c ldebug.h lstate.h lua.h luaconf.h lobject.h llimits.h \
+ ltm.h lzio.h lmem.h lopcodes.h lundump.h
++
++
++export LIBTOOL = ../libtool --quiet --tag=CC
++export LIB_VERSION = 0:0:0
++
++# The following rules use libtool for compiling and linking in order to
++# provide shared library support.
++
++LIB_NAME = liblua.la
++LIB_OBJS = $(CORE_O:.o=.lo) $(LIB_O:.o=.lo)
++
++%.lo %.o: %.c
++ $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
++
++$(LIB_NAME): $(LIB_OBJS)
++ $(LIBTOOL) --mode=link $(CC) -version-info $(LIB_VERSION) \
++ -rpath $(RPATH) $(LDFLAGS) -o $(LIB_NAME) $(LIB_OBJS) $(LIB_LIBS)
++
++$(LUA_T): $(LUA_O:.o=.lo) $(LIB_NAME)
++ $(LIBTOOL) --mode=link $(CC) -export-dynamic $(LDFLAGS) -o $@ $(LUA_O:.o=.lo) $(LIB_NAME) $(LUA_LIBS)
++
++$(LUAC_T): $(LUAC_O:.o=.lo) $(LIB_NAME)
++ $(LIBTOOL) --mode=link $(CC) -static $(LDFLAGS) -o $@ $(LUAC_O:.o=.lo) $(LIB_NAME)
++
++alpine_clean:
++ $(LIBTOOL) --mode=clean $(RM) $(ALL_O:.o=.lo) $(LIB_NAME) lua luac
++
++alpine_all: $(LIB_NAME) $(LUA_T) $(LUAC_T)
++
+
+ # (end of Makefile)
diff --git a/repo/lua5-1/lua-5.1-module_paths.patch b/repo/lua5-1/lua-5.1-module_paths.patch
new file mode 100644
index 0000000..e67d09f
--- /dev/null
+++ b/repo/lua5-1/lua-5.1-module_paths.patch
@@ -0,0 +1,24 @@
+--- a/src/luaconf.h
++++ b/src/luaconf.h
+@@ -95,13 +94,19 @@
+
+ #else
+ #define LUA_ROOT "/usr/local/"
++#define LUA_ROOT2 "/usr/"
+ #define LUA_LDIR LUA_ROOT "share/lua/5.1/"
++#define LUA_LDIR2 LUA_ROOT2 "share/lua/5.1/"
++#define LUA_LDIR3 LUA_ROOT2 "share/lua/common/"
+ #define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
++#define LUA_CDIR2 LUA_ROOT2 "lib/lua/5.1/"
+ #define LUA_PATH_DEFAULT \
+ "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
+- LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
++ LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \
++ LUA_LDIR2"?.lua;" LUA_LDIR2"?/init.lua;" \
++ LUA_LDIR3"?.lua;" LUA_LDIR3"?/init.lua"
+ #define LUA_CPATH_DEFAULT \
+- "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
++ "./?.so;" LUA_CDIR"?.so;" LUA_CDIR2"?.so;" LUA_CDIR"loadall.so"
+ #endif
+
+
diff --git a/repo/lua5-1/lua-5.1-readline.patch b/repo/lua5-1/lua-5.1-readline.patch
new file mode 100644
index 0000000..f144861
--- /dev/null
+++ b/repo/lua5-1/lua-5.1-readline.patch
@@ -0,0 +1,10 @@
+--- lua-5.1.1.orig/src/luaconf.h 2006-04-10 20:27:23.000000000 +0200
++++ lua-5.1.1/src/luaconf.h 2006-11-15 14:53:07.000000000 +0100
+@@ -36,7 +36,6 @@
+ #if defined(LUA_USE_LINUX)
+ #define LUA_USE_POSIX
+ #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
+-#define LUA_USE_READLINE /* needs some extra libraries */
+ #endif
+
+ #if defined(LUA_USE_MACOSX)
diff --git a/repo/lua5-1/lua.pc b/repo/lua5-1/lua.pc
new file mode 100644
index 0000000..1e78955
--- /dev/null
+++ b/repo/lua5-1/lua.pc
@@ -0,0 +1,32 @@
+# lua.pc -- pkg-config data for Lua
+
+# vars from install Makefile
+
+# grep '^V=' ../Makefile
+V= 5.1
+# grep '^R=' ../Makefile
+R= 5.1.5
+
+# 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
+includedir=${prefix}/include
+
+Name: Lua
+Description: An Extensible Extension Language
+Version: ${R}
+Requires:
+Libs: -L${libdir} -llua -lm
+Cflags: -I${includedir}
+
+# (end of lua.pc)
+
diff --git a/repo/lua5-1/lua5-1.xibuild b/repo/lua5-1/lua5-1.xibuild
new file mode 100644
index 0000000..5fc5f80
--- /dev/null
+++ b/repo/lua5-1/lua5-1.xibuild
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+MAKEDEPS="make "
+DEPS="readline"
+
+PKG_VER=5.1.5
+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%.*} alpine_all
+}
+
+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" \
+ alpine_install
+
+ 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/
+
+ # Create symlinks without version suffix.
+ ln -s lua5.1 "$PKG_DEST"/usr/bin/lua
+ ln -s luac5.1 "$PKG_DEST"/usr/bin/luac
+ ln -s lua5.1.pc "$PKG_DEST"/usr/lib/pkgconfig/lua.pc
+ ln -s lua5.1.1 "$PKG_DEST"/usr/share/man/man1/lua.1
+ ln -s luac5.1.1 "$PKG_DEST"/usr/share/man/man1/luac.1
+
+
+ install -m644 -D etc/lua.pc $PKG_DEST/usr/lib/pkgconfig/lua5.1.pc
+}