diff options
author | John Wiegley <johnw@newartisans.com> | 2014-04-14 14:39:23 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2014-04-14 14:39:23 -0500 |
commit | f9c2f684e816df1241b66afddd14341cac68dda3 (patch) | |
tree | 469c5bf6191308f4e390f64d5a0803dc807c38ce /pkgs/development/interpreters/lua-5 | |
parent | 7ce743b4226e44067e1562eac125d267dcce04f3 (diff) |
Allow lua5 to build as a dylib on Darwin
Diffstat (limited to 'pkgs/development/interpreters/lua-5')
-rw-r--r-- | pkgs/development/interpreters/lua-5/5.1.darwin.patch | 52 | ||||
-rw-r--r-- | pkgs/development/interpreters/lua-5/5.1.nix | 9 |
2 files changed, 59 insertions, 2 deletions
diff --git a/pkgs/development/interpreters/lua-5/5.1.darwin.patch b/pkgs/development/interpreters/lua-5/5.1.darwin.patch new file mode 100644 index 0000000000000..b7754da79baf8 --- /dev/null +++ b/pkgs/development/interpreters/lua-5/5.1.darwin.patch @@ -0,0 +1,52 @@ +diff --git a/Makefile b/Makefile +index 209a132..9387b09 100644 +--- a/Makefile ++++ b/Makefile +@@ -43,7 +43,7 @@ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris + # What to install. + TO_BIN= lua luac + TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp +-TO_LIB= liblua.a ++TO_LIB= liblua.5.1.5.dylib + TO_MAN= lua.1 luac.1 + + # Lua version and release. +@@ -64,6 +64,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.1.5.dylib $(INSTALL_LIB)/liblua.5.1.dylib ++ ln -s -f liblua.5.1.dylib $(INSTALL_LIB)/liblua.dylib + + ranlib: + cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB) +diff --git a/src/Makefile b/src/Makefile +index e0d4c9f..4477d7b 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -22,7 +22,7 @@ MYLIBS= + + PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris + +-LUA_A= liblua.a ++LUA_A= liblua.5.1.5.dylib + CORE_O= lapi.o lcode.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 +@@ -48,11 +48,13 @@ o: $(ALL_O) + a: $(ALL_A) + + $(LUA_A): $(CORE_O) $(LIB_O) +- $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files +- $(RANLIB) $@ ++ $(CC) -dynamiclib -install_name $(out)/lib/liblua.5.1.dylib \ ++ -compatibility_version 5.1 -current_version 5.1.5 \ ++ -o liblua.5.1.5.dylib $^ + + $(LUA_T): $(LUA_O) $(LUA_A) +- $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) ++ $(CC) -fno-common $(MYLDFLAGS) \ ++ -o $@ $(LUA_O) $(LUA_A) -L. -llua.5.1.5 $(LIBS) + + $(LUAC_T): $(LUAC_O) $(LUA_A) + $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) diff --git a/pkgs/development/interpreters/lua-5/5.1.nix b/pkgs/development/interpreters/lua-5/5.1.nix index 27b1589d27fa0..9a57a034ad19c 100644 --- a/pkgs/development/interpreters/lua-5/5.1.nix +++ b/pkgs/development/interpreters/lua-5/5.1.nix @@ -18,9 +18,14 @@ stdenv.mkDerivation rec { buildInputs = [ readline ]; - patches = [ dsoPatch ]; + patches = if stdenv.isDarwin then [ ./5.1.darwin.patch ] else [ dsoPatch ]; - configurePhase = '' + configurePhase = + if stdenv.isDarwin + then '' + makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=macosx CFLAGS="-DLUA_USE_LINUX -fno-common -O2" LDLAGS="" ) + installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.5.1.5.dylib" INSTALL_DATA='cp -d' ) + '' else '' makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=linux CFLAGS="-DLUA_USE_LINUX -O2 -fPIC" LDLAGS="-fPIC" ) installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.a liblua.so liblua.so.5.1 liblua.so.5.1.5" INSTALL_DATA='cp -d' ) ''; |