lua.pkgs.luv.libluv: fix linking against lua on darwin

[ 50%] Building C object CMakeFiles/luv.dir/src/luv.c.o
    [100%] Linking C shared library libluv.dylib
    Undefined symbols for architecture x86_64:
      "_luaL_addlstring", referenced from:
          _thread_dump in luv.c.o
      ...
This commit is contained in:
Daiderd Jordan 2019-10-02 00:08:13 +02:00
parent bb8b193bd5
commit fc408c8690
No known key found for this signature in database
GPG Key ID: D02435D05B810C96

View File

@ -273,17 +273,22 @@ with super;
sed -i 's,\(option(WITH_SHARED_LIBUV.*\)OFF,\1ON,' CMakeLists.txt
rm -rf deps/libuv
'';
propagatedBuildInputs = [
pkgs.libuv
];
buildInputs = [ pkgs.libuv ];
passthru = {
libluv = self.luv.override({
libluv = self.luv.override ({
preBuild = self.luv.preBuild + ''
sed -i 's,\(option(BUILD_MODULE.*\)ON,\1OFF,' CMakeLists.txt
sed -i 's,\(option(BUILD_SHARED_LIBS.*\)OFF,\1ON,' CMakeLists.txt
sed -i 's,${"\${INSTALL_INC_DIR}"},${placeholder "out"}/include/luv,' CMakeLists.txt
sed -i 's,\(option(BUILD_MODULE.*\)ON,\1OFF,' CMakeLists.txt
sed -i 's,\(option(BUILD_SHARED_LIBS.*\)OFF,\1ON,' CMakeLists.txt
sed -i 's,${"\${INSTALL_INC_DIR}"},${placeholder "out"}/include/luv,' CMakeLists.txt
'';
nativeBuildInputs = [ pkgs.fixDarwinDylibNames ];
# Fixup linking libluv.dylib, for some reason it's not linked against lua correctly.
NIX_LDFLAGS = pkgs.lib.optionalString pkgs.stdenv.isDarwin
(if isLuaJIT then "-lluajit-${lua.luaversion}" else "-llua");
});
};
});