summaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authorKonstantin Alekseev <mail@kalekseev.com>2021-05-14 23:38:50 +0300
committerGitHub <noreply@github.com>2021-05-14 16:38:50 -0400
commitfeb867f2fd346d8f15415fe0a1db7d64b18958d0 (patch)
treeacde833083b9b2d0875d59cd0bf1b9455834e789 /pkgs
parentf98633302381ab7e2839c61e41520371db8a8a74 (diff)
lua-5.4: fix build on darwin (#123028)
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/interpreters/lua-5/5.4.darwin.patch48
-rw-r--r--pkgs/development/interpreters/lua-5/default.nix2
2 files changed, 49 insertions, 1 deletions
diff --git a/pkgs/development/interpreters/lua-5/5.4.darwin.patch b/pkgs/development/interpreters/lua-5/5.4.darwin.patch
new file mode 100644
index 000000000000..eb16ed9c6897
--- /dev/null
+++ b/pkgs/development/interpreters/lua-5/5.4.darwin.patch
@@ -0,0 +1,48 @@
+--- a/Makefile 2021-05-14 22:39:14.407200562 +0300
++++ b/Makefile 2021-05-14 22:36:23.828513407 +0300
+@@ -41,7 +41,7 @@
+ # 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.${version}.dylib
+ TO_MAN= lua.1 luac.1
+
+ # Lua version and release.
+@@ -60,6 +60,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 -s -f liblua.${version}.dylib $(INSTALL_LIB)/liblua.${luaversion}.dylib
++ ln -s -f liblua.${luaversion}.dylib $(INSTALL_LIB)/liblua.dylib
+
+ uninstall:
+ cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
+--- a/src/Makefile 2021-05-14 22:35:38.575051882 +0300
++++ b/src/Makefile 2021-05-14 22:35:33.584631206 +0300
+@@ -32,7 +32,7 @@
+
+ PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris
+
+-LUA_A= liblua.a
++LUA_A= liblua.${version}.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,13 @@
+ a: $(ALL_A)
+
+ $(LUA_A): $(BASE_O)
+- $(AR) $@ $(BASE_O)
+- $(RANLIB) $@
++ $(CC) -dynamiclib -install_name $(out)/lib/liblua.${version}.dylib \
++ -compatibility_version ${version} -current_version ${version} \
++ -o liblua.${version}.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.${version} $(LIBS)
+
+ $(LUAC_T): $(LUAC_O) $(LUA_A)
+ $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
diff --git a/pkgs/development/interpreters/lua-5/default.nix b/pkgs/development/interpreters/lua-5/default.nix
index 3a52d58ffaba..43ed70fee1db 100644
--- a/pkgs/development/interpreters/lua-5/default.nix
+++ b/pkgs/development/interpreters/lua-5/default.nix
@@ -17,7 +17,7 @@ in rec {
lua5_4 = callPackage ./interpreter.nix {
sourceVersion = { major = "5"; minor = "4"; patch = "2"; };
hash = "0ksj5zpj74n0jkamy3di1p6l10v4gjnd2zjnb453qc6px6bhsmqi";
- patches = [
+ patches = if stdenv.isDarwin then [ ./5.4.darwin.patch ] else [
# build lua as a shared library as well, MIT-licensed from
# https://github.com/archlinux/svntogit-packages/tree/packages/lua/trunk
./liblua.so.patch