lua 5.3.4, rename from lua@5.3

This commit is contained in:
ilovezfs 2017-12-05 01:21:41 -08:00
parent ee5db62302
commit a2a595fb3e
4 changed files with 42 additions and 244 deletions

View file

@ -1,9 +1,9 @@
class Lua < Formula
desc "Powerful, lightweight programming language"
homepage "https://www.lua.org/"
url "https://www.lua.org/ftp/lua-5.2.4.tar.gz"
sha256 "b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b"
revision 5
url "https://www.lua.org/ftp/lua-5.3.4.tar.gz"
sha256 "f681aa518233bc407e23acf0f5887c884f17436f000d453b2491a9f11a52400c"
revision 2
bottle do
cellar :any
@ -12,39 +12,13 @@ class Lua < Formula
sha256 "29553ce97e43d24c7b35eb9a44800e0e2b94e83ac79dff25d6d0d0b58590ad7e" => :el_capitan
end
pour_bottle? do
reason "The bottle needs to be installed into /usr/local."
# DomT4: I'm pretty sure this can be fixed, so don't leave this in place forever.
# https://github.com/Homebrew/legacy-homebrew/issues/44619
satisfy { HOMEBREW_PREFIX.to_s == "/usr/local" }
end
option "with-completion", "Enables advanced readline support"
option "without-sigaction", "Revert to ANSI signal instead of improved POSIX sigaction"
option "without-luarocks", "Don't build with Luarocks support embedded"
# Be sure to build a dylib, or else runtime modules will pull in another static copy of liblua = crashy
# See: https://github.com/Homebrew/legacy-homebrew/pull/5043
# ***Update me with each version bump!***
patch :DATA
# completion provided by advanced readline power patch
# See http://lua-users.org/wiki/LuaPowerPatches
if build.with? "completion"
patch do
url "https://luajit.org/patches/lua-5.2.0-advanced_readline.patch"
sha256 "33d32d11fce4f85b88ce8f9bd54e6a6cbea376dfee3dbf8cdda3640e056bc29d"
end
end
# sigaction provided by posix signalling power patch
if build.with? "sigaction"
patch do
# original patch file (not available): http://lua-users.org/files/wiki_insecure/power_patches/5.2/lua-5.2.3-sig_catch.patch
url "https://raw.githubusercontent.com/Homebrew/patches/d674e02d1097b21032198854080204680b616b61/lua/lua-5.2.3-sig_catch.patch"
sha256 "f2e77f73791c08169573658caa3c97ba8b574c870a0a165972ddfbddb948c164"
end
end
# Don't use the https://luarocks.org/releases/luarocks-x.y.z.tar.gz URL
# directly as it redirects to the HTTP version of the below URL.
resource "luarocks" do
@ -58,7 +32,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_ALL $(SYSCFLAGS) $(MYCFLAGS)"
s.change_make_var! "CFLAGS", "#{ENV.cflags} -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)"
s.change_make_var! "MYLDFLAGS", ENV.ldflags
end
@ -71,13 +45,13 @@ class Lua < Formula
(lib/"pkgconfig/lua.pc").write pc_file
# Fix some software potentially hunting for different pc names.
bin.install_symlink "lua" => "lua5.2"
bin.install_symlink "lua" => "lua-5.2"
bin.install_symlink "luac" => "luac5.2"
bin.install_symlink "luac" => "luac-5.2"
(include/"lua5.2").install_symlink include.children
(lib/"pkgconfig").install_symlink "lua.pc" => "lua5.2.pc"
(lib/"pkgconfig").install_symlink "lua.pc" => "lua-5.2.pc"
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 include.children
(lib/"pkgconfig").install_symlink "lua.pc" => "lua5.3.pc"
(lib/"pkgconfig").install_symlink "lua.pc" => "lua-5.3.pc"
# This resource must be handled after the main install, since there's a lua dep.
# Keeping it in install rather than postinstall means we can bottle.
@ -86,19 +60,19 @@ class Lua < Formula
ENV.prepend_path "PATH", bin
system "./configure", "--prefix=#{libexec}", "--rocks-tree=#{HOMEBREW_PREFIX}",
"--sysconfdir=#{etc}/luarocks52", "--with-lua=#{prefix}",
"--lua-version=5.2", "--versioned-rocks-dir"
"--sysconfdir=#{etc}/luarocks53", "--with-lua=#{prefix}",
"--lua-version=5.3", "--versioned-rocks-dir"
system "make", "build"
system "make", "install"
(pkgshare/"5.2/luarocks").install_symlink Dir["#{libexec}/share/lua/5.2/luarocks/*"]
bin.install_symlink libexec/"bin/luarocks-5.2"
bin.install_symlink libexec/"bin/luarocks-admin-5.2"
(pkgshare/"5.3/luarocks").install_symlink Dir["#{libexec}/share/lua/5.3/luarocks/*"]
bin.install_symlink libexec/"bin/luarocks-5.3"
bin.install_symlink libexec/"bin/luarocks-admin-5.3"
bin.install_symlink libexec/"bin/luarocks"
bin.install_symlink libexec/"bin/luarocks-admin"
# This block ensures luarock exec scripts don't break across updates.
inreplace libexec/"share/lua/5.2/luarocks/site_config.lua" do |s|
inreplace libexec/"share/lua/5.3/luarocks/site_config.lua" do |s|
s.gsub! libexec.to_s, opt_libexec
s.gsub! include.to_s, "#{HOMEBREW_PREFIX}/include"
s.gsub! lib.to_s, "#{HOMEBREW_PREFIX}/lib"
@ -109,22 +83,22 @@ class Lua < Formula
end
def pc_file; <<~EOS
V= 5.2
R= 5.2.4
prefix=#{opt_prefix}
V= 5.3
R= #{version}
prefix=#{HOMEBREW_PREFIX}
INSTALL_BIN= ${prefix}/bin
INSTALL_INC= ${prefix}/include
INSTALL_LIB= ${prefix}/lib
INSTALL_MAN= ${prefix}/share/man/man1
INSTALL_LMOD= #{HOMEBREW_PREFIX}/share/lua/${V}
INSTALL_CMOD= #{HOMEBREW_PREFIX}/lib/lua/${V}
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: 5.2.4
Version: #{version}
Requires:
Libs: -L${libdir} -llua -lm
Cflags: -I${includedir}
@ -133,7 +107,7 @@ class Lua < Formula
def caveats; <<~EOS
Please be aware due to the way Luarocks is designed any binaries installed
via Luarocks-5.2 AND 5.1 will overwrite each other in #{HOMEBREW_PREFIX}/bin.
via Luarocks-5.3 AND 5.1 will overwrite each other in #{HOMEBREW_PREFIX}/bin.
This is, for now, unavoidable. If this is troublesome for you, you can build
rocks with the `--tree=` command to a special, non-conflicting location and
@ -144,9 +118,9 @@ class Lua < Formula
test do
system "#{bin}/lua", "-e", "print ('Ducks are cool')"
if File.exist?(bin/"luarocks-5.2")
if File.exist?(bin/"luarocks-5.3")
(testpath/"luarocks").mkpath
system bin/"luarocks-5.2", "install", "moonscript", "--tree=#{testpath}/luarocks"
system bin/"luarocks-5.3", "install", "moonscript", "--tree=#{testpath}/luarocks"
assert_predicate testpath/"luarocks/bin/moon", :exist?
end
end
@ -154,15 +128,15 @@ end
__END__
diff --git a/Makefile b/Makefile
index bd9515f..5940ba9 100644
index 7fa91c8..a825198 100644
--- a/Makefile
+++ b/Makefile
@@ -41,7 +41,7 @@ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
@@ -41,7 +41,7 @@ PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
# 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.2.4.dylib
+TO_LIB= liblua.5.3.4.dylib
TO_MAN= lua.1 luac.1
# Lua version and release.
@ -170,21 +144,21 @@ index bd9515f..5940ba9 100644
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.2.4.dylib $(INSTALL_LIB)/liblua.5.2.dylib
+ ln -s -f liblua.5.2.dylib $(INSTALL_LIB)/liblua.dylib
+ ln -s -f liblua.5.3.4.dylib $(INSTALL_LIB)/liblua.5.3.dylib
+ ln -s -f liblua.5.3.dylib $(INSTALL_LIB)/liblua.dylib
uninstall:
cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
diff --git a/src/Makefile b/src/Makefile
index 8c9ee67..7f92407 100644
index 2e7a412..d0c4898 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -28,7 +28,7 @@ MYOBJS=
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
-LUA_A= liblua.a
+LUA_A= liblua.5.2.4.dylib
+LUA_A= liblua.5.3.4.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
@ -194,17 +168,17 @@ index 8c9ee67..7f92407 100644
$(LUA_A): $(BASE_O)
- $(AR) $@ $(BASE_O)
- $(RANLIB) $@
+ $(CC) -dynamiclib -install_name @LUA_PREFIX@/lib/liblua.5.2.dylib \
+ -compatibility_version 5.2 -current_version 5.2.4 \
+ -o liblua.5.2.4.dylib $^
+ $(CC) -dynamiclib -install_name @LUA_PREFIX@/lib/liblua.5.3.dylib \
+ -compatibility_version 5.3 -current_version 5.3.4 \
+ -o liblua.5.3.4.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.2.4 $(LIBS)
+ $(CC) -fno-common $(MYLDFLAGS) -o $@ $(LUA_O) $(LUA_A) -L. -llua.5.3.4 $(LIBS)
$(LUAC_T): $(LUAC_O) $(LUA_A)
$(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
@@ -106,7 +107,7 @@ linux:
@@ -110,7 +111,7 @@ linux:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
macosx:
@ -212,4 +186,4 @@ index 8c9ee67..7f92407 100644
+ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -fno-common" SYSLIBS="-lreadline" CC=cc
mingw:
$(MAKE) "LUA_A=lua52.dll" "LUA_T=lua.exe" \
$(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \

View file

@ -1,176 +0,0 @@
class LuaAT53 < Formula
desc "Powerful, lightweight programming language"
homepage "https://www.lua.org/"
url "https://www.lua.org/ftp/lua-5.3.4.tar.gz"
sha256 "f681aa518233bc407e23acf0f5887c884f17436f000d453b2491a9f11a52400c"
revision 1
bottle do
cellar :any
sha256 "ca948267360a9de2e991411e1e29d62d631c486a2976e7c5f73e619105f474ac" => :high_sierra
sha256 "c4dcbbe1c4d8768551b899f49b580d1960e685607878331966eeee3a3a185596" => :sierra
sha256 "64100dce40fd112e668b6913fc922cef559db4247b0e17a6ed13228bda22ab8d" => :el_capitan
end
option "without-luarocks", "Don't build with Luarocks support embedded"
# Be sure to build a dylib, or else runtime modules will pull in another static copy of liblua = crashy
# See: https://github.com/Homebrew/legacy-homebrew/pull/5043
# ***Update me with each version bump!***
patch :DATA
resource "luarocks" do
url "https://keplerproject.github.io/luarocks/releases/luarocks-2.3.0.tar.gz"
sha256 "68e38feeb66052e29ad1935a71b875194ed8b9c67c2223af5f4d4e3e2464ed97"
end
def install
# Use our CC/CFLAGS to compile.
inreplace "src/Makefile" do |s|
s.remove_make_var! "CC"
s.change_make_var! "CFLAGS", "#{ENV.cflags} -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)"
s.change_make_var! "MYLDFLAGS", ENV.ldflags
end
# Fix path in the config header
inreplace "src/luaconf.h", "/usr/local", HOMEBREW_PREFIX
# We ship our own pkg-config file as Lua no longer provide them upstream.
system "make", "macosx", "INSTALL_TOP=#{prefix}", "INSTALL_MAN=#{man1}", "INSTALL_INC=#{include}/lua-5.3"
system "make", "install", "INSTALL_TOP=#{prefix}", "INSTALL_MAN=#{man1}", "INSTALL_INC=#{include}/lua-5.3"
(lib/"pkgconfig/lua-5.3.pc").write pc_file
# Renaming from Lua to Lua53.
# Note that the naming must be both lua-version & lua.version.
# Software can't find the libraries without supporting both the hyphen or full stop.
mv "#{bin}/lua", "#{bin}/lua-5.3"
mv "#{bin}/luac", "#{bin}/luac-5.3"
mv "#{man1}/lua.1", "#{man1}/lua-5.3.1"
mv "#{man1}/luac.1", "#{man1}/luac-5.3.1"
bin.install_symlink "lua-5.3" => "lua5.3"
bin.install_symlink "luac-5.3" => "luac5.3"
include.install_symlink "lua-5.3" => "lua5.3"
(lib/"pkgconfig").install_symlink "lua-5.3.pc" => "lua5.3.pc"
# This resource must be handled after the main install, since there's a lua dep.
# Keeping it in install rather than postinstall means we can bottle.
if build.with? "luarocks"
resource("luarocks").stage do
ENV.prepend_path "PATH", bin
lua_prefix = prefix
system "./configure", "--prefix=#{libexec}", "--rocks-tree=#{HOMEBREW_PREFIX}",
"--sysconfdir=#{etc}/luarocks53", "--with-lua=#{lua_prefix}",
"--lua-version=5.3", "--versioned-rocks-dir"
system "make", "build"
system "make", "install"
(share/"lua/5.3/luarocks").install_symlink Dir["#{libexec}/share/lua/5.3/luarocks/*"]
bin.install_symlink libexec/"bin/luarocks-5.3"
bin.install_symlink libexec/"bin/luarocks-admin-5.3"
# This block ensures luarock exec scripts don't break across updates.
inreplace libexec/"share/lua/5.3/luarocks/site_config.lua" do |s|
s.gsub! libexec.to_s, opt_libexec
s.gsub! include.to_s, "#{HOMEBREW_PREFIX}/include"
s.gsub! lib.to_s, "#{HOMEBREW_PREFIX}/lib"
s.gsub! bin.to_s, "#{HOMEBREW_PREFIX}/bin"
end
end
end
end
def pc_file; <<~EOS
V= 5.3
R= #{version}
prefix=#{HOMEBREW_PREFIX}
INSTALL_BIN= ${prefix}/bin
INSTALL_INC= ${prefix}/include/lua-5.3
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/lua-5.3
Name: Lua
Description: An Extensible Extension Language
Version: #{version}
Requires:
Libs: -L${libdir} -llua.5.3 -lm
Cflags: -I${includedir}
EOS
end
test do
system "#{bin}/lua-5.3", "-e", "print ('Ducks are cool')"
if File.exist?(bin/"luarocks-5.3")
(testpath/"luarocks").mkpath
system bin/"luarocks-5.3", "install", "moonscript", "--tree=#{testpath}/luarocks"
assert_predicate testpath/"luarocks/bin/moon", :exist?
end
end
end
__END__
diff --git a/Makefile b/Makefile
index 7fa91c8..a825198 100644
--- a/Makefile
+++ b/Makefile
@@ -41,7 +41,7 @@ PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
# 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.4.dylib
TO_MAN= lua.1 luac.1
# Lua version and release.
@@ -63,6 +63,7 @@ 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.4.dylib $(INSTALL_LIB)/liblua.5.3.dylib
uninstall:
cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
diff --git a/src/Makefile b/src/Makefile
index 2e7a412..d0c4898 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -28,7 +28,7 @@ MYOBJS=
PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
-LUA_A= liblua.a
+LUA_A= liblua.5.3.4.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)
a: $(ALL_A)
$(LUA_A): $(BASE_O)
- $(AR) $@ $(BASE_O)
- $(RANLIB) $@
+ $(CC) -dynamiclib -install_name HOMEBREW_PREFIX/lib/liblua.5.3.dylib \
+ -compatibility_version 5.3 -current_version 5.3.4 \
+ -o liblua.5.3.4.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.4 $(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"
macosx:
- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" CC=cc
+ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -fno-common" SYSLIBS="-lreadline" CC=cc
mingw:
$(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \

View file

@ -104,7 +104,7 @@
"llvm38": "llvm@3.8",
"logstash24": "logstash@2.4",
"lua51": "lua@5.1",
"lua53": "lua@5.3",
"lua@5.3": "lua",
"mapnik2": "mapnik@2",
"mariadb100": "mariadb@10.0",
"maven31": "maven@3.1",