From 3d1f96e1b4aecea4ebca6edb0627c5ddbc91ed7c Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 1 Sep 2022 01:19:16 +0300 Subject: [PATCH 1/2] gobject-introspection: enable strictDeps and improve cross conditional the flags defined in it are required if the hostPlatform can't be executed --- .../development/libraries/gobject-introspection/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix index f4d1d2c80032..8dae27e7ccae 100644 --- a/pkgs/development/libraries/gobject-introspection/default.nix +++ b/pkgs/development/libraries/gobject-introspection/default.nix @@ -64,6 +64,8 @@ stdenv.mkDerivation (finalAttrs: { }) ]; + strictDeps = true; + nativeBuildInputs = [ meson ninja @@ -76,7 +78,7 @@ stdenv.mkDerivation (finalAttrs: { # Build definition checks for the Python modules needed at runtime by importing them. (buildPackages.python3.withPackages pythonModules) finalAttrs.setupHook # move .gir files - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ gobject-introspection-unwrapped ]; + ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ gobject-introspection-unwrapped ]; buildInputs = [ (python3.withPackages pythonModules) @@ -95,7 +97,7 @@ stdenv.mkDerivation (finalAttrs: { "--datadir=${placeholder "dev"}/share" "-Dcairo=disabled" "-Dgtk_doc=${lib.boolToString (stdenv.hostPlatform == stdenv.buildPlatform)}" - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ "-Dgi_cross_ldd_wrapper=${substituteAll { name = "g-ir-scanner-lddwrapper"; isExecutable = true; From 8f40fcbb4cab70262f298070a68602288fcfc742 Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 1 Sep 2022 05:52:51 +0300 Subject: [PATCH 2/2] gobject-introspection: propagate self/targetself to avoid having to add gobject-introspection to buildInputs i should probably move to use the wrapper when host != build and do the canExecute things inside the wrapper.nix then i could use gobject-introspection-unwrapped in it even when host == build void also adds gobject-introspection to makeDepends when its gir build helper is used --- .../libraries/gobject-introspection/default.nix | 8 ++++++++ .../libraries/gobject-introspection/wrapper.nix | 1 + 2 files changed, 9 insertions(+) diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix index 8dae27e7ccae..bd2873a04070 100644 --- a/pkgs/development/libraries/gobject-introspection/default.nix +++ b/pkgs/development/libraries/gobject-introspection/default.nix @@ -138,6 +138,14 @@ stdenv.mkDerivation (finalAttrs: { rm $out/lib/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary} ''; + # add self to buildInputs to avoid needing to add gobject-introspection to buildInputs in addition to nativeBuildInputs + # builds use target-pkg-config to look for gobject-introspection instead of just looking for binaries in $PATH + # wrapper uses depsTargetTargetPropagated so ignore it + preFixup = lib.optionalString (!lib.hasSuffix "-wrapped" finalAttrs.pname) '' + mkdir -p $dev/nix-support + echo "$out" > $dev/nix-support/propagated-target-target-deps + ''; + setupHook = ./setup-hook.sh; passthru = { diff --git a/pkgs/development/libraries/gobject-introspection/wrapper.nix b/pkgs/development/libraries/gobject-introspection/wrapper.nix index 917debf98264..132104c1f645 100644 --- a/pkgs/development/libraries/gobject-introspection/wrapper.nix +++ b/pkgs/development/libraries/gobject-introspection/wrapper.nix @@ -18,6 +18,7 @@ in (gobject-introspection-unwrapped.override args).overrideAttrs (previousAttrs: { pname = "gobject-introspection-wrapped"; + depsTargetTargetPropagated = [ gobject-introspection-unwrapped ]; postFixup = (previousAttrs.postFixup or "") + '' mv $dev/bin/g-ir-compiler $dev/bin/.g-ir-compiler-wrapped mv $dev/bin/g-ir-scanner $dev/bin/.g-ir-scanner-wrapped