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
lua: support non-Darwin non-Linux OSes; clean up #119860
Conversation
Looks like |
@rmcgibbo could you try that again please? :) |
This is supposed to be automatically set by Lua's Makefile if PLAT is set appropriately, but it was being overridden by us overridding CFLAGS. Setting it manually was a hack. The correct thing to do was to make sure SYSCFLAGS (where Lua's Makefile puts LUA_USE_LINUX) was still included in our custom CFLAGS.
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.
Diff looks fine
] else []) | ||
; | ||
"PLAT=${plat}" | ||
"CC=${stdenv.cc.targetPrefix}gcc" |
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.
"CC=${stdenv.cc.targetPrefix}gcc" | |
"CC=${stdenv.cc.targetPrefix}cc" |
not sure how this works on darwin without this?
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.
Ah yes I think you're right. Do we have any way of testing Darwin at the moment, since it doesn't seem to be working on OfBorg?
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.
I can test it, but it's gonna take a bit.
Thats on the todo and AFAIK curently not possible. |
postPatch = lib.optionalString (!stdenv.isDarwin) '' | ||
sed -e '1s/^/LUA_SO = liblua.so/' \ | ||
-e 's/ALL_T *= */&$(LUA_SO) /' \ | ||
-i src/Makefile | ||
cat ${./lua-dso.make} >> src/Makefile |
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.
A comment here wouldn't hurt.
We do this same patch in three different ways for four different Lua versions, even though the structure of the Makefile barely changes between releases. We can easily consolidate this by just modifying the Makefile ourselves instead of using patches (Makefiles are very amenable to this).
On other OSes, like NetBSD, these are part of libc. Fortunately, the Lua Makefile already knows about this, and has a SYSLIBS variable we can use for this.
This evaluates to an empty string when not cross compiling, so by using this instead of stdenv.hostPlatform.config we can eliminate a conditional.
Tested on darwin. |
Commit 57832e6 (PR #119860) switched to using SYSCFLAGS, but lua 5.1 calls it MYCFLAGS. We noticed due to broken luarocks build: https://hydra.nixos.org/build/142663274
Still a problem. All liblua.so are under-linked (on standard x86_64-linux at least), missing EDIT: test by |
After 539ad4f it looks good, but if you have a better idea... |
Motivation for this change
See commit messages.
With these changes I can now build
pkgsCross.x86_64-netbsd.lua
.Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)