Skip to content

Commit

Permalink
Add Lua 5.4.3, fix Lua 5.4.2 and 5.3.6 pkgconfig files
Browse files Browse the repository at this point in the history
  • Loading branch information
hishamhm committed Jul 31, 2021
1 parent e4f3f99 commit 47fd8ad
Show file tree
Hide file tree
Showing 9 changed files with 169 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Lua/5.3.6/Recipe
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ln -nfs $target/include/*.* $target/include/lua/5.3
ln -nfs $target/bin/lua $target/bin/lua53

mkdir -p $target/lib/pkgconfig
cat << EOF > $target/lib/pkgconfig/lua-5.3.pc
cat << "EOF" > $target/lib/pkgconfig/lua-5.3.pc
V=5.3
R=5.3.6

Expand All @@ -41,7 +41,7 @@ Name: Lua
Description: An Extensible Extension Language
Version: ${R}
Requires:
Libs: {libdir}/liblua.so.${V} -lm -ldl
Libs: ${libdir}/liblua.so.${V} -lm -ldl
Cflags: -I${includedir}
EOF
ln -nfs $target/lib/pkgconfig/lua-5.3.pc $target/lib/pkgconfig/lua.pc
Expand Down
4 changes: 2 additions & 2 deletions Lua/5.4.2/Recipe
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ln -nfs $target/include/*.* $target/include/lua/5.4
ln -nfs $target/bin/lua $target/bin/lua54

mkdir -p $target/lib/pkgconfig
cat << EOF > $target/lib/pkgconfig/lua-5.4.pc
cat << "EOF" > $target/lib/pkgconfig/lua-5.4.pc
V=5.4
R=5.4.2

Expand All @@ -41,7 +41,7 @@ Name: Lua
Description: An Extensible Extension Language
Version: ${R}
Requires:
Libs: {libdir}/liblua.so.${V} -lm -ldl
Libs: ${libdir}/liblua.so.${V} -lm -ldl
Cflags: -I${includedir}
EOF
ln -nfs $target/lib/pkgconfig/lua-5.4.pc $target/lib/pkgconfig/lua.pc
Expand Down
69 changes: 69 additions & 0 deletions Lua/5.4.3/01-Makefile.patch.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Add rules for creating the dynamic library as well.

diff -Nur lua-5.4.2.old/Makefile lua-5.4.2/Makefile
--- lua-5.4.2.old/Makefile 2020-11-10 17:54:50.000000000 -0300
+++ lua-5.4.2/Makefile 2020-12-22 13:42:52.972611401 -0300
@@ -41,8 +41,12 @@
# What to install.
TO_BIN= lua luac
TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
-TO_LIB= liblua.a
+TO_LIB= liblua.a.5.4 liblua.so.5.4
TO_MAN= lua.1 luac.1
+FULL_LIB_SO= liblua.so.5.4
+LIB_SO= liblua.so
+FULL_LIB_A= liblua.a.5.4
+LIB_A= liblua.a

# Lua version and release.
V= 5.4
@@ -60,6 +64,8 @@
cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
+ ln -nfs $(INSTALL_LIB)/$(FULL_LIB_SO) $(INSTALL_LIB)/$(LIB_SO)
+ ln -nfs $(INSTALL_LIB)/$(FULL_LIB_A) $(INSTALL_LIB)/$(LIB_A)

uninstall:
cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
diff -Nur lua-5.4.2.old/src/Makefile lua-5.4.2/src/Makefile
--- lua-5.4.2.old/src/Makefile 2020-11-10 15:39:37.000000000 -0300
+++ lua-5.4.2/src/Makefile 2020-12-22 13:44:23.490607689 -0300
@@ -6,6 +6,8 @@
# Your platform. See PLATS for possible values.
PLAT= guess

+MYLDFLAGS=-L@%Compile_goboLibraries%@
+LD= ld
CC= gcc -std=gnu99
CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)
LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
@@ -32,7 +34,8 @@

PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris

-LUA_A= liblua.a
+LUA_A= liblua.a.5.4
+LUA_SO= liblua.so.5.4
CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o
LIB_O= lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o
BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
@@ -44,7 +47,7 @@
LUAC_O= luac.o

ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
ALL_A= $(LUA_A)

# Targets start here.
@@ -66,6 +69,9 @@
$(LUAC_T): $(LUAC_O) $(LUA_A)
$(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)

+$(LUA_SO): $(CORE_O) $(LIB_O)
+ $(LD) $(MYFLAGS) $? -fPIC -shared -lm -lpthread -ldl -o $@
+
test:
./lua -v

14 changes: 14 additions & 0 deletions Lua/5.4.3/02-add-fpic-pthread.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Add -fPIC and -lpthread (see http://lua-users.org/lists/lua-l/2015-04/msg00010.html)

diff -Nur lua-5.4.2.old/src/Makefile lua-5.4.2/src/Makefile
--- lua-5.4.2.old/src/Makefile 2015-01-05 14:04:52.000000000 -0200
+++ lua-5.4.2/src/Makefile 2015-04-04 15:21:07.841376633 -0300
@@ -121,7 +121,7 @@
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl"

linux-readline:
- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE" SYSLIBS="-Wl,-E -ldl -lreadline"
+ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -fPIC" SYSLIBS="-Wl,-E -ldl -lreadline -lpthread"

Darwin macos macosx:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE" SYSLIBS="-lreadline"
48 changes: 48 additions & 0 deletions Lua/5.4.3/Recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Recipe for version 5.4.3 by Hisham Muhammad <[email protected]>, on Sat Jul 31 15:27:10 -03 2021
compile_version=1.10.2
url=http://www.lua.org/ftp/lua-5.4.3.tar.gz
file_size=358216
file_md5=ef63ed2ecfb713646a7fcc583cf5f352
recipe_type=makefile
build_target=linux-readline

docs=(
"doc/*.html"
)

make_variables=(
INSTALL_TOP=$target
INSTALL_MAN=$target/share/man/man1
)

pre_link() {
mkdir -p $target/include/lua/5.4
ln -nfs $target/include/*.* $target/include/lua/5.4

ln -nfs $target/bin/lua $target/bin/lua54

mkdir -p $target/lib/pkgconfig
cat << "EOF" > $target/lib/pkgconfig/lua-5.4.pc
V=5.4
R=5.4.3

prefix=/usr
INSTALL_BIN=${prefix}/bin
INSTALL_INC=${prefix}/include
INSTALL_LIB=${prefix}/lib
INSTALL_MAN=${prefix}/share/man/man1
INSTALL_LMOD=${prefix}/share/lua/${V}
INSTALL_CMOD=${prefix}/lib/lua/${V}
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: Lua
Description: An Extensible Extension Language
Version: ${R}
Requires:
Libs: ${libdir}/liblua.so.${V} -lm -ldl
Cflags: -I${includedir}
EOF
ln -nfs $target/lib/pkgconfig/lua-5.4.pc $target/lib/pkgconfig/lua.pc
}
2 changes: 2 additions & 0 deletions Lua/5.4.3/Resources/BuildInformation
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Glibc 2.30
Readline 8.0
1 change: 1 addition & 0 deletions Lua/5.4.3/Resources/Dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Readline 7.0
15 changes: 15 additions & 0 deletions Lua/5.4.3/Resources/Description
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Name] Lua
[Summary] An extensible extension language
[License] MIT/X Consortium License
[Description] Lua is a programming language originally designed for extending
applications, but also frequently used as a general-purpose, stand-alone
language. It combines simple procedural syntax (similar to Pascal) with
powerful data description constructs based on associative arrays and
extensible semantics. It is dynamically typed, interpreted from bytecodes, and
has automatic memory management, making it ideal for configuration, scripting,
and rapid prototyping. It is implemented as a small library of C functions,
written in ANSI C, and compiles unmodified in all known platforms. The
implementation goals are simplicity, efficiency, portability, and low
embedding cost. It has been used on games such as Battle Mages, Vendetta,
FarCry, Homeworld2, and Painkiller.
[Homepage] http://www.lua.org/
16 changes: 16 additions & 0 deletions Lua/5.4.3/Resources/Environment
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Lua 5.4 Environment
#####################

export LUA_PATH_5_4="\
./?.lua;\
$goboShared/lua/5.4/?.lua;\
$goboShared/lua/5.4/?/init.lua;\
$goboLibraries/lua/5.4/?.lua;\
$goboLibraries/lua/5.4/?/init.lua;\
"

export LUA_CPATH_5_4="\
./?.so;\
$goboLibraries/lua/5.4/?.so;\
$goboLibraries/lua/5.4/loadall.so\
"

0 comments on commit 47fd8ad

Please sign in to comment.