Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

@tathougies
Copy link
Contributor

tathougies commented Nov 23, 2018

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
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@@ -24,15 +25,16 @@ stdenv.mkDerivation rec {
patchShebangs tests
'';

nativeBuildInputs = [ pkgconfig ];
depsBuildBuild = [ buildPackages.stdenv.cc buildPackages.pkgconfig ];

This comment has been minimized.

Copy link
@Mic92

Mic92 Nov 23, 2018

Contributor

Do you know what binaries it tries to compile for the builder?

This comment has been minimized.

Copy link
@tathougies

tathougies Nov 25, 2018

Author Contributor

What do you mean?

This comment has been minimized.

Copy link
@Mic92

Mic92 Nov 26, 2018

Contributor

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.

This comment has been minimized.

Copy link
@Mic92

Mic92 Nov 26, 2018

Contributor

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

This comment has been minimized.

Copy link
@Mic92

Mic92 Nov 26, 2018

Contributor

I also would add autoreconfHook because this is best practice.

@mmahut
Copy link
Member

mmahut commented Aug 11, 2019

Are there any updates on this pull request, please?

@doronbehar
Copy link
Contributor

doronbehar commented May 16, 2020

I tested:

  1. nix-build -A pkgsCross.aarch64-multiplatform-musl.lighttpd
  2. nix-build -A pkgsCross.aarch64-multiplatform-musl.lighttpd
  3. nix-build -A pkgsCross.raspberryPi.lighttpd
  4. nix-build -A pkgsCross.armv7l-hf-multiplatform.lighttpd

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.

@doronbehar doronbehar closed this May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants
You can’t perform that action at this time.