lua 5.4.1

master
carlocab 2020-12-01 12:26:44 +00:00 committed by Francois-Xavier Coudert
parent 88132eb4a1
commit 7f73e7947a
3 changed files with 42 additions and 44 deletions

View File

@ -1,10 +1,9 @@
class Lua < Formula
desc "Powerful, lightweight programming language"
homepage "https://www.lua.org/"
url "https://www.lua.org/ftp/lua-5.3.5.tar.gz"
sha256 "0c2eed3f960446e1a3e4b9a1ca2f3ff893b6ce41942cf54d5dd59ab4b3b058ac"
url "https://www.lua.org/ftp/lua-5.4.1.tar.gz"
sha256 "4ba786c3705eb9db6567af29c91a01b81f1c0ac3124fdbf6cd94bdd9e53cca7d"
license "MIT"
revision 1
livecheck do
url "https://www.lua.org/ftp/"
@ -38,7 +37,7 @@ class Lua < Formula
inreplace "src/Makefile" do |s|
s.gsub! "@LUA_PREFIX@", prefix
s.remove_make_var! "CC"
s.change_make_var! "CFLAGS", "#{ENV.cflags} -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)"
s.change_make_var! "CFLAGS", "#{ENV.cflags} -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)"
s.change_make_var! "MYLDFLAGS", ENV.ldflags
end
@ -51,19 +50,19 @@ class Lua < Formula
(lib/"pkgconfig/lua.pc").write pc_file
# Fix some software potentially hunting for different pc names.
bin.install_symlink "lua" => "lua5.3"
bin.install_symlink "lua" => "lua-5.3"
bin.install_symlink "luac" => "luac5.3"
bin.install_symlink "luac" => "luac-5.3"
(include/"lua5.3").install_symlink Dir[include/"lua/*"]
lib.install_symlink "liblua.5.3.dylib" => "liblua5.3.dylib"
(lib/"pkgconfig").install_symlink "lua.pc" => "lua5.3.pc"
(lib/"pkgconfig").install_symlink "lua.pc" => "lua-5.3.pc"
bin.install_symlink "lua" => "lua#{version.major_minor}"
bin.install_symlink "lua" => "lua-#{version.major_minor}"
bin.install_symlink "luac" => "luac#{version.major_minor}"
bin.install_symlink "luac" => "luac-#{version.major_minor}"
(include/"lua#{version.major_minor}").install_symlink Dir[include/"lua/*"]
lib.install_symlink "liblua.#{version.major_minor}.dylib" => "liblua#{version.major_minor}.dylib"
(lib/"pkgconfig").install_symlink "lua.pc" => "lua#{version.major_minor}.pc"
(lib/"pkgconfig").install_symlink "lua.pc" => "lua-#{version.major_minor}.pc"
end
def pc_file
<<~EOS
V= 5.3
V= #{version.major_minor}
R= #{version}
prefix=#{HOMEBREW_PREFIX}
INSTALL_BIN= ${prefix}/bin
@ -93,68 +92,68 @@ class Lua < Formula
end
test do
system "#{bin}/lua", "-e", "print ('Ducks are cool')"
assert_match "Homebrew is awesome!", shell_output("#{bin}/lua -e \"print ('Homebrew is awesome!')\"")
end
end
__END__
diff --git a/Makefile b/Makefile
index 7fa91c8..a825198 100644
index 1797df9..2f80d16 100644
--- a/Makefile
+++ b/Makefile
@@ -41,7 +41,7 @@ PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
@@ -41,7 +41,7 @@ PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix
# 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.5.3.5.dylib
+TO_LIB= liblua.5.4.1.dylib
TO_MAN= lua.1 luac.1
# Lua version and release.
@@ -63,6 +63,8 @@ install: dummy
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 -s -f liblua.5.3.5.dylib $(INSTALL_LIB)/liblua.5.3.dylib
+ ln -s -f liblua.5.3.dylib $(INSTALL_LIB)/liblua.dylib
@@ -60,6 +60,8 @@ install: dummy
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 -s -f liblua.5.4.1.dylib $(INSTALL_LIB)/liblua.5.4.dylib
+ ln -s -f liblua.5.4.dylib $(INSTALL_LIB)/liblua.dylib
uninstall:
cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
diff --git a/src/Makefile b/src/Makefile
index 2e7a412..d0c4898 100644
index 514593d..90c78b8 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -28,7 +28,7 @@ MYOBJS=
@@ -32,7 +32,7 @@ CMCFLAGS= -Os
PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris
-LUA_A= liblua.a
+LUA_A= liblua.5.3.5.dylib
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
@@ -56,11 +56,12 @@ o: $(ALL_O)
+LUA_A= liblua.5.4.1.dylib
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)
@@ -57,11 +57,12 @@ o: $(ALL_O)
a: $(ALL_A)
$(LUA_A): $(BASE_O)
- $(AR) $@ $(BASE_O)
- $(RANLIB) $@
+ $(CC) -dynamiclib -install_name @LUA_PREFIX@/lib/liblua.5.3.dylib \
+ -compatibility_version 5.3 -current_version 5.3.5 \
+ -o liblua.5.3.5.dylib $^
+ $(CC) -dynamiclib -install_name @LUA_PREFIX@/lib/liblua.5.4.dylib \
+ -compatibility_version 5.4 -current_version 5.4.1 \
+ -o liblua.5.4.1.dylib $^
$(LUA_T): $(LUA_O) $(LUA_A)
- $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+ $(CC) -fno-common $(MYLDFLAGS) -o $@ $(LUA_O) $(LUA_A) -L. -llua.5.3.5 $(LIBS)
+ $(CC) -fno-common $(MYLDFLAGS) -o $@ $(LUA_O) $(LUA_A) -L. -llua.5.4.1 $(LIBS)
$(LUAC_T): $(LUAC_O) $(LUA_A)
$(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
@@ -110,7 +111,7 @@ linux:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
$(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
@@ -124,7 +125,7 @@ linux-readline:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE" SYSLIBS="-Wl,-E -ldl -lreadline"
macosx:
- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline"
+ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -fno-common" SYSLIBS="-lreadline"
Darwin macos macosx:
- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE" SYSLIBS="-lreadline"
+ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE -fno-common" SYSLIBS="-lreadline"
mingw:
$(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \
$(MAKE) "LUA_A=lua54.dll" "LUA_T=lua.exe" \

View File

@ -75,7 +75,6 @@
"libcppa": "caf",
"libmongoclient": "mongo-cxx-driver",
"lua51": "lua@5.1",
"lua@5.3": "lua",
"mat": "mat2",
"maven32": "maven@3.2",
"mkl-dnn": "onednn",