-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
luaPackages.luv: cleanup build #80528
Changes from all commits
33ea31e
a60662e
139c3cd
3025302
6a16042
f1f3d05
4caf110
e397f80
29018e4
838fdbb
d4ff83a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -264,37 +264,38 @@ with super; | |||||||
disabled = luaOlder "5.1" || (luaAtLeast "5.4"); | ||||||||
}); | ||||||||
|
||||||||
compat53 = super.compat53.override (old: { | ||||||||
# needed for luv build | ||||||||
postInstall = '' | ||||||||
cp -r c-api $out/c-api | ||||||||
''; | ||||||||
}); | ||||||||
|
||||||||
luv = super.luv.override({ | ||||||||
# Use system libuv instead of building local and statically linking | ||||||||
# This is a hacky way to specify -DWITH_SHARED_LIBUV=ON which | ||||||||
# is not possible with luarocks and the current luv rockspec | ||||||||
# While at it, remove bundled libuv source entirely to be sure. | ||||||||
# We may wish to drop bundled lua submodules too... | ||||||||
preBuild = '' | ||||||||
sed -i 's,\(option(WITH_SHARED_LIBUV.*\)OFF,\1ON,' CMakeLists.txt | ||||||||
rm -rf deps/libuv | ||||||||
# So we can be sure no internal dependency is used from the repo and that | ||||||||
# everything is provided by us | ||||||||
preConfigure = '' | ||||||||
rm -rf deps | ||||||||
'' | ||||||||
# See the following issues: | ||||||||
# - https://github.com/luarocks/luarocks/issues/1160 | ||||||||
# - https://github.com/luarocks/luarocks/issues/509 | ||||||||
# - https://github.com/luarocks/luarocks/issues/339 | ||||||||
+ '' | ||||||||
sed -i 's,\(option(WITH_SHARED_LIBUV.*\)OFF,\1ON,' CMakeLists.txt | ||||||||
''; | ||||||||
LUA_COMPAT53_DIR="${lua.pkgs.compat53}"; | ||||||||
|
||||||||
buildInputs = [ pkgs.libuv ]; | ||||||||
|
||||||||
passthru = { | ||||||||
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 | ||||||||
''; | ||||||||
|
||||||||
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"); | ||||||||
}); | ||||||||
}; | ||||||||
nativeBuildInputs = [ | ||||||||
lua.pkgs.compat53 | ||||||||
]; | ||||||||
# 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"); | ||||||||
Comment on lines
+295
to
+296
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
}); | ||||||||
|
||||||||
|
||||||||
rapidjson = super.rapidjson.override({ | ||||||||
preBuild = '' | ||||||||
sed -i '/set(CMAKE_CXX_FLAGS/d' CMakeLists.txt | ||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -99,6 +99,63 @@ with self; { | |||||||||
|
||||||||||
luarocks-nix = callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { }; | ||||||||||
|
||||||||||
# This package is very much like `lua.pkgs.luv`, but it's not defined as a | ||||||||||
# module because it fails to install some files if we use | ||||||||||
# `buildLuarocksPackage` instead of `mkDerivation`. However, if another | ||||||||||
# package (e.g lua.pkgs.nvim-client) would require `luv = | ||||||||||
# stdenv.mkDerivation`, it would not detect it and hence it would fail to | ||||||||||
# build. | ||||||||||
|
||||||||||
# The workaround implemented here is to create 2 versions of `libluv` while | ||||||||||
# `luv` is still defined by lua's generated packages and still overriden as | ||||||||||
# necessary in lua's overrides. This version is used in neovim and every | ||||||||||
# other package that needs luv as a shared library (not as a mere lua | ||||||||||
# module). | ||||||||||
libluv = pkgs.stdenv.mkDerivation rec { | ||||||||||
pname = "luv"; | ||||||||||
version = "1.34.2-0"; | ||||||||||
|
||||||||||
src = pkgs.fetchFromGitHub { | ||||||||||
owner = "luvit"; | ||||||||||
repo = pname; | ||||||||||
rev = version; | ||||||||||
sha256 = "0iq272n7p0wkll4a7d880qyhdp65582cwc3b2zzrirpli93x3v87"; | ||||||||||
}; | ||||||||||
disabled = (luaOlder "5.1"); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
# So we can be sure no internal dependency is used from the repo and that | ||||||||||
# everything is provided by us | ||||||||||
postUnpack = '' | ||||||||||
rm -rf deps | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
''; | ||||||||||
|
||||||||||
cmakeFlags = [ | ||||||||||
"-DWITH_SHARED_LIBUV=ON" | ||||||||||
"-DLUA_BUILD_TYPE=System" | ||||||||||
"-DBUILD_MODULE=ON" | ||||||||||
"-DBUILD_SHARED_LIBS=ON" | ||||||||||
"-DLUA_COMPAT53_DIR=${lua.pkgs.compat53}" | ||||||||||
]; | ||||||||||
|
||||||||||
buildInputs = [ pkgs.libuv ]; | ||||||||||
|
||||||||||
nativeBuildInputs = [ | ||||||||||
pkgs.cmake | ||||||||||
lua.pkgs.compat53 | ||||||||||
]; | ||||||||||
# 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"); | ||||||||||
Comment on lines
+147
to
+148
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
propagatedBuildInputs = [ lua ]; | ||||||||||
|
||||||||||
meta = with stdenv.lib; { | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
homepage = "https://github.com/luvit/luv"; | ||||||||||
description = "Bare libuv bindings for lua"; | ||||||||||
license = { | ||||||||||
fullName = "Apache 2.0"; | ||||||||||
}; | ||||||||||
Comment on lines
+154
to
+156
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
}; | ||||||||||
}; | ||||||||||
luxio = buildLuaPackage rec { | ||||||||||
name = "luxio-${version}"; | ||||||||||
version = "13"; | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.