3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #127425 from malbarbo/lua

This commit is contained in:
Sandro 2021-06-25 18:51:32 +02:00 committed by GitHub
commit f7ba1da31a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View file

@ -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({

View file

@ -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
'';