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
lighttpd: enable cross-compilation #50935
Conversation
@@ -24,15 +25,16 @@ stdenv.mkDerivation rec { | |||
patchShebangs tests | |||
''; | |||
|
|||
nativeBuildInputs = [ pkgconfig ]; | |||
depsBuildBuild = [ buildPackages.stdenv.cc buildPackages.pkgconfig ]; |
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.
Do you know what binaries it tries to compile for the builder?
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.
What do you mean?
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.
Back then it looked like it where using the compiler for the build architecture, but buildPackages.stdenv.cc indeed will produce binaries for the host architecture.
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.
Your approach seems the right for lighttpd. They respect $CC
for cross-compiling but looking for the host cc to build lemon
. pkgconfig
can stay however in nativeBuildInputs
:
diff --git a/pkgs/servers/http/lighttpd/default.nix b/pkgs/servers/http/lighttpd/default.nix
index 41394d3bcea..04640207a7b 100644
--- a/pkgs/servers/http/lighttpd/default.nix
+++ b/pkgs/servers/http/lighttpd/default.nix
@@ -1,4 +1,5 @@
-{ stdenv, fetchurl, pkgconfig, pcre, libxml2, zlib, attr, bzip2, which, file
+{ stdenv, fetchurl, autoreconfHook, pkgconfig
+, pcre, libxml2, zlib, attr, bzip2, which, file
, openssl, enableMagnet ? false, lua5_1 ? null
, enableMysql ? false, mysql ? null
, enableLdap ? false, openldap ? null
@@ -24,8 +25,8 @@ stdenv.mkDerivation rec {
postPatch = ''
patchShebangs tests
'';
-
- depsBuildBuild = [ buildPackages.stdenv.cc buildPackages.pkgconfig ];
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+ nativeBuildInputs = [ pkgconfig autoreconfHook ];
buildInputs = [ pcre libxml2 zlib attr bzip2 which file openssl ]
++ stdenv.lib.optional enableMagnet lua5_1
++ stdenv.lib.optional enableMysql mysql.connector-c
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 also would add autoreconfHook
because this is best practice.
Are there any updates on this pull request, please? |
I tested:
And none failed. I haven't tested usablity of any of these results but I still think it's not worth keeping this PR open so I'm closing as it's also ancient. |
Motivation for this change
Lighttpd needs some extra configure flags to build a working cross-compiler. I'm not sure if this makes it work with all combinations of options, and I'm not sure if there's an easier way to make the configure script pick up the host pkgconfig deps.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)