about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/interpreters/lua-5
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-07-09 12:30:28 +0000
committerAlyssa Ross <hi@alyssa.is>2021-07-23 09:11:31 +0000
commit55cc63c079f49e81d695a25bc2f5b3902f2bd290 (patch)
treee705335d97f50b927c76ccb4a3fbde9fab8372b9 /nixpkgs/pkgs/development/interpreters/lua-5
parentc26eb6f74d9393127a21eee7a9620a920769f613 (diff)
parent87807e64a5ef5206b745a40af118c7be8db73681 (diff)
downloadnixlib-55cc63c079f49e81d695a25bc2f5b3902f2bd290.tar
nixlib-55cc63c079f49e81d695a25bc2f5b3902f2bd290.tar.gz
nixlib-55cc63c079f49e81d695a25bc2f5b3902f2bd290.tar.bz2
nixlib-55cc63c079f49e81d695a25bc2f5b3902f2bd290.tar.lz
nixlib-55cc63c079f49e81d695a25bc2f5b3902f2bd290.tar.xz
nixlib-55cc63c079f49e81d695a25bc2f5b3902f2bd290.tar.zst
nixlib-55cc63c079f49e81d695a25bc2f5b3902f2bd290.zip
Merge commit '87807e64a5ef5206b745a40af118c7be8db73681'
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters/lua-5')
-rw-r--r--nixpkgs/pkgs/development/interpreters/lua-5/default.nix4
-rw-r--r--nixpkgs/pkgs/development/interpreters/lua-5/interpreter.nix10
2 files changed, 8 insertions, 6 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/default.nix b/nixpkgs/pkgs/development/interpreters/lua-5/default.nix
index d2ba451b9e60..3e36f77dab43 100644
--- a/nixpkgs/pkgs/development/interpreters/lua-5/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/lua-5/default.nix
@@ -19,10 +19,6 @@ rec {
 
     patches =
       lib.optionals stdenv.isDarwin [ ./5.2.darwin.patch ];
-
-    postBuild = lib.optionalString (!stdenv.isDarwin) ''
-      ( cd src; make $makeFlags "''${makeFlagsArray[@]}" liblua.so )
-    '';
   };
 
   lua5_3_compat = lua5_3.override({
diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/interpreter.nix b/nixpkgs/pkgs/development/interpreters/lua-5/interpreter.nix
index fd8c47d751b3..3476b2b648b6 100644
--- a/nixpkgs/pkgs/development/interpreters/lua-5/interpreter.nix
+++ b/nixpkgs/pkgs/development/interpreters/lua-5/interpreter.nix
@@ -7,6 +7,7 @@
 , patches ? []
 , postConfigure ? null
 , postBuild ? null
+, staticOnly ? stdenv.hostPlatform.isStatic
 }:
 let
 luaPackages = callPackage ../../lua-modules {lua=self; overrides=packageOverrides;};
@@ -38,7 +39,7 @@ self = stdenv.mkDerivation rec {
 
   inherit patches;
 
-  postPatch = lib.optionalString (!stdenv.isDarwin) ''
+  postPatch = lib.optionalString (!stdenv.isDarwin && !staticOnly) ''
     # Add a target for a shared library to the Makefile.
     sed -e '1s/^/LUA_SO = liblua.so/' \
         -e 's/ALL_T *= */&$(LUA_SO) /' \
@@ -56,6 +57,10 @@ self = stdenv.mkDerivation rec {
     "PLAT=${plat}"
     "CC=${stdenv.cc.targetPrefix}cc"
     "RANLIB=${stdenv.cc.targetPrefix}ranlib"
+    # Lua links with readline wich depends on ncurses. For some reason when
+    # building pkgsStatic.lua it fails because symbols from ncurses are not
+    # found. Adding ncurses here fixes the problem.
+    "MYLIBS=-lncurses"
   ];
 
   configurePhase = ''
@@ -66,7 +71,8 @@ self = stdenv.mkDerivation rec {
     makeFlagsArray+=(${lib.optionalString stdenv.isDarwin "CC=\"$CC\""}${lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) " 'AR=${stdenv.cc.targetPrefix}ar rcu'"})
 
     installFlagsArray=( TO_BIN="lua luac" INSTALL_DATA='cp -d' \
-      TO_LIB="${if stdenv.isDarwin then "liblua.${version}.dylib" else "liblua.a liblua.so liblua.so.${luaversion} liblua.so.${version}"}" )
+      TO_LIB="${if stdenv.isDarwin then "liblua.${version}.dylib"
+                else ("liblua.a" + lib.optionalString (!staticOnly) " liblua.so liblua.so.${luaversion} liblua.so.${version}" )}" )
 
     runHook postConfigure
   '';