Skip to content

Commit

Permalink
lua: bump to 5.4.1
Browse files Browse the repository at this point in the history
Not sure what happened to Homebrew#57133
but it seems to not have progressed, so I'm trying this again.

Also adding [email protected] because lua is known for making quite a few drastic
(read: API-breaking) changes between versions.

Ref: neovim/neovim#9760 (comment)

Some formulae may need to continue to depend on [email protected]. At minimum,
it may make sense to temporarily accept [email protected] into homebrew/core while
formulae that depend on lua are slowly migrated to the latest version.
This is probably better than lua not being upgraded at all because of
unresolved dependency issues.
  • Loading branch information
carlocab committed Dec 1, 2020
1 parent ede053f commit 594a553
Showing 1 changed file with 42 additions and 43 deletions.
85 changes: 42 additions & 43 deletions Formula/lua.rb
Original file line number Diff line number Diff line change
@@ -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/"
Expand Down Expand Up @@ -38,7 +37,7 @@ def install
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

Expand All @@ -51,19 +50,19 @@ def install
(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" => "lua5.4"
bin.install_symlink "lua" => "lua-5.4"
bin.install_symlink "luac" => "luac5.4"
bin.install_symlink "luac" => "luac-5.4"
(include/"lua5.4").install_symlink Dir[include/"lua/*"]
lib.install_symlink "liblua.5.4.dylib" => "liblua5.4.dylib"
(lib/"pkgconfig").install_symlink "lua.pc" => "lua5.4.pc"
(lib/"pkgconfig").install_symlink "lua.pc" => "lua-5.4.pc"
end

def pc_file
<<~EOS
V= 5.3
V= 5.4
R= #{version}
prefix=#{HOMEBREW_PREFIX}
INSTALL_BIN= ${prefix}/bin
Expand Down Expand Up @@ -93,68 +92,68 @@ def caveats
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" \

0 comments on commit 594a553

Please sign in to comment.