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
This commit is contained in:
Alyssa Ross 2024-05-09 18:41:48 +02:00
parent 0fd0a8bac1
commit 67641d0589
10 changed files with 18 additions and 13 deletions

View File

@ -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`.

View File

@ -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 = {

View File

@ -22,10 +22,6 @@ wafConfigurePhase() {
${wafConfigureTargets:-configure}
)
if [ -z "${dontAddWafCrossFlags:-}" ]; then
flagsArray+=(@wafCrossFlags@)
fi
echoCmd 'waf configure flags' "${flagsArray[@]}"
python "$wafPath" "${flagsArray[@]}"

View File

@ -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 = ''

View File

@ -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.

View File

@ -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.

View File

@ -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

View File

@ -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.

View File

@ -50,8 +50,6 @@ stdenv.mkDerivation (finalAttrs: {
patchShebangs --build svnversion_regenerate.sh
'';
dontAddWafCrossFlags = true;
wafConfigureFlags = [
"--classic"
"--autostart=${if (optDbus != null) then "dbus" else "classic"}"

View File

@ -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`