From 67641d0589ea6a3ab821cae0278fc2c013940a3a Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Thu, 9 May 2024 18:41:48 +0200 Subject: [PATCH] wafHook: don't add cross compilation flags These flags are not part of waf, they're custom flags that are not widely implemented. More packages are broken because of these flags being added than actually recognise them. Of the packages in Nixpkgs that directly depend on wafHook that we can attempt to cross compile (i.e. all their dependencies cross compile), 5 already successfully cross compile and recognise these flags, 2 already successfully cross compile because they have been opted out of these flags, 3 don't cross compile successfully for reasons unrelated to these flags, and for the remaining 7, the only thing stopping them cross compiling successfully is that they are being passed these flags that they don't recognise. All of the five successfully cross-compiling packages that do recognise these flags are samba projects: ldb, talloc, tdb, tevent, and samba4. So this isn't a general waf convention, just a samba one. It therefore doesn't make sense to set these flags by default. They should just be included in the expressions for each samba project, like all the other quirks common to samba build systems. This change fixes cross compilation of the following packages: blockhash ganv ndn-cxx mda_lv2 pflask raul saldl --- doc/hooks/waf.section.md | 4 ---- pkgs/by-name/wa/waf/hook.nix | 2 -- pkgs/by-name/wa/waf/setup-hook.sh | 4 ---- pkgs/development/libraries/aubio/default.nix | 1 - pkgs/development/libraries/ldb/default.nix | 4 ++++ pkgs/development/libraries/talloc/default.nix | 4 ++++ pkgs/development/libraries/tdb/default.nix | 4 ++++ pkgs/development/libraries/tevent/default.nix | 4 ++++ pkgs/misc/jackaudio/default.nix | 2 -- pkgs/servers/samba/4.x.nix | 2 ++ 10 files changed, 18 insertions(+), 13 deletions(-) diff --git a/doc/hooks/waf.section.md b/doc/hooks/waf.section.md index fa027d87a94d..b58887b6b647 100644 --- a/doc/hooks/waf.section.md +++ b/doc/hooks/waf.section.md @@ -20,10 +20,6 @@ If `wafPath` doesn't exist, then `wafHook` will copy the `waf` provided from Nix Controls the flags passed to waf tool during build and install phases. For settings specific to build or install phases, use `wafBuildFlags` or `wafInstallFlags` respectively. -#### `dontAddWafCrossFlags` {#dont-add-waf-cross-flags} - -When set to `true`, don't add cross compilation flags during configure phase. - #### `dontUseWafConfigure` {#dont-use-waf-configure} When set to true, don't use the predefined `wafConfigurePhase`. diff --git a/pkgs/by-name/wa/waf/hook.nix b/pkgs/by-name/wa/waf/hook.nix index ac497d227831..8b52538a1b65 100644 --- a/pkgs/by-name/wa/waf/hook.nix +++ b/pkgs/by-name/wa/waf/hook.nix @@ -13,8 +13,6 @@ makeSetupHook { # waf is not inserted into propagatedBuildInputs, rather it is inserted # directly inherit waf; - wafCrossFlags = lib.optionalString (stdenv.hostPlatform.system != stdenv.targetPlatform.system) - ''--cross-compile "--cross-execute=${stdenv.targetPlatform.emulator pkgs}"''; }; meta = { diff --git a/pkgs/by-name/wa/waf/setup-hook.sh b/pkgs/by-name/wa/waf/setup-hook.sh index d3e2bf97e682..a154ae378a07 100644 --- a/pkgs/by-name/wa/waf/setup-hook.sh +++ b/pkgs/by-name/wa/waf/setup-hook.sh @@ -22,10 +22,6 @@ wafConfigurePhase() { ${wafConfigureTargets:-configure} ) - if [ -z "${dontAddWafCrossFlags:-}" ]; then - flagsArray+=(@wafCrossFlags@) - fi - echoCmd 'waf configure flags' "${flagsArray[@]}" python "$wafPath" "${flagsArray[@]}" diff --git a/pkgs/development/libraries/aubio/default.nix b/pkgs/development/libraries/aubio/default.nix index 89f81e26de40..6702eb91c9b1 100644 --- a/pkgs/development/libraries/aubio/default.nix +++ b/pkgs/development/libraries/aubio/default.nix @@ -15,7 +15,6 @@ stdenv.mkDerivation rec { buildInputs = [ alsa-lib fftw libjack2 libsamplerate libsndfile ]; strictDeps = true; - dontAddWafCrossFlags = true; wafFlags = lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "--disable-tests"; postPatch = '' diff --git a/pkgs/development/libraries/ldb/default.nix b/pkgs/development/libraries/ldb/default.nix index cdcf21edd799..3a1a8a8ebf1d 100644 --- a/pkgs/development/libraries/ldb/default.nix +++ b/pkgs/development/libraries/ldb/default.nix @@ -12,6 +12,7 @@ , docbook_xml_dtd_42 , cmocka , wafHook +, buildPackages , libxcrypt , testers }: @@ -62,6 +63,9 @@ stdenv.mkDerivation (finalAttrs: { "--bundled-libraries=NONE" "--builtin-libraries=replace" "--without-ldb-lmdb" + ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "--cross-compile" + "--cross-execute=${stdenv.hostPlatform.emulator buildPackages}" ]; # python-config from build Python gives incorrect values when cross-compiling. diff --git a/pkgs/development/libraries/talloc/default.nix b/pkgs/development/libraries/talloc/default.nix index 73cb8a65a162..793fc1ccf5cb 100644 --- a/pkgs/development/libraries/talloc/default.nix +++ b/pkgs/development/libraries/talloc/default.nix @@ -9,6 +9,7 @@ , docbook_xml_dtd_42 , fixDarwinDylibNames , wafHook +, buildPackages }: stdenv.mkDerivation rec { @@ -50,6 +51,9 @@ stdenv.mkDerivation rec { "--enable-talloc-compat1" "--bundled-libraries=NONE" "--builtin-libraries=replace" + ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "--cross-compile" + "--cross-execute=${stdenv.hostPlatform.emulator buildPackages}" ]; # python-config from build Python gives incorrect values when cross-compiling. diff --git a/pkgs/development/libraries/tdb/default.nix b/pkgs/development/libraries/tdb/default.nix index 1a289f7c2d61..f8b3d4df4b70 100644 --- a/pkgs/development/libraries/tdb/default.nix +++ b/pkgs/development/libraries/tdb/default.nix @@ -2,6 +2,7 @@ , fetchurl , pkg-config , wafHook +, buildPackages , python3 , readline , libxslt @@ -46,6 +47,9 @@ stdenv.mkDerivation rec { wafConfigureFlags = [ "--bundled-libraries=NONE" "--builtin-libraries=replace" + ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "--cross-compile" + "--cross-execute=${stdenv.hostPlatform.emulator buildPackages}" ]; postFixup = if stdenv.isDarwin diff --git a/pkgs/development/libraries/tevent/default.nix b/pkgs/development/libraries/tevent/default.nix index 18e4522de9ea..d4a7d9c4342d 100644 --- a/pkgs/development/libraries/tevent/default.nix +++ b/pkgs/development/libraries/tevent/default.nix @@ -10,6 +10,7 @@ , docbook_xml_dtd_42 , which , wafHook +, buildPackages , libxcrypt }: @@ -52,6 +53,9 @@ stdenv.mkDerivation rec { wafConfigureFlags = [ "--bundled-libraries=NONE" "--builtin-libraries=replace" + ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "--cross-compile" + "--cross-execute=${stdenv.hostPlatform.emulator buildPackages}" ]; # python-config from build Python gives incorrect values when cross-compiling. diff --git a/pkgs/misc/jackaudio/default.nix b/pkgs/misc/jackaudio/default.nix index 64f386e0378d..53b900806ab3 100644 --- a/pkgs/misc/jackaudio/default.nix +++ b/pkgs/misc/jackaudio/default.nix @@ -50,8 +50,6 @@ stdenv.mkDerivation (finalAttrs: { patchShebangs --build svnversion_regenerate.sh ''; - dontAddWafCrossFlags = true; - wafConfigureFlags = [ "--classic" "--autostart=${if (optDbus != null) then "dbus" else "classic"}" diff --git a/pkgs/servers/samba/4.x.nix b/pkgs/servers/samba/4.x.nix index a52099460e78..ee37db169bbb 100644 --- a/pkgs/servers/samba/4.x.nix +++ b/pkgs/servers/samba/4.x.nix @@ -173,6 +173,8 @@ stdenv.mkDerivation (finalAttrs: { ++ optional (!enablePam) "--without-pam" ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--bundled-libraries=!asn1_compile,!compile_et" + "--cross-compile" + "--cross-execute=${stdenv.hostPlatform.emulator buildPackages}" ] ++ optionals stdenv.buildPlatform.is32bit [ # By default `waf configure` spawns as many as available CPUs. On # 32-bit systems with many CPUs (like `i686` chroot on `x86_64`