From bf15263d1c87f64a86828786b54455fa1210036d Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 7 Jul 2022 21:32:13 +0300 Subject: [PATCH] networkmanager: fix cross copy devdoc and man from native to cross doc does not have to be copied --- .../networking/networkmanager/default.nix | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/networking/networkmanager/default.nix b/pkgs/tools/networking/networkmanager/default.nix index 97a029d353b2..c170ed102872 100644 --- a/pkgs/tools/networking/networkmanager/default.nix +++ b/pkgs/tools/networking/networkmanager/default.nix @@ -34,6 +34,7 @@ , iputils , kmod , jansson +, elfutils , gtk-doc , libxslt , docbook_xsl @@ -43,14 +44,16 @@ , openconnect , curl , meson +, mesonEmulatorHook , ninja , libpsl , mobile-broadband-provider-info , runtimeShell +, buildPackages }: let - pythonForDocs = python3.withPackages (pkgs: with pkgs; [ pygobject3 ]); + pythonForDocs = python3.pythonForBuild.withPackages (pkgs: with pkgs; [ pygobject3 ]); in stdenv.mkDerivation rec { pname = "networkmanager"; @@ -102,7 +105,9 @@ stdenv.mkDerivation rec { "-Ddhcpcanon=no" # Miscellaneous - "-Ddocs=true" + # almost cross-compiles, however fails with + # ** (process:9234): WARNING **: Failed to load shared library '/nix/store/...-networkmanager-aarch64-unknown-linux-gnu-1.38.2/lib/libnm.so.0' referenced by the typelib: /nix/store/...-networkmanager-aarch64-unknown-linux-gnu-1.38.2/lib/libnm.so.0: cannot open shared object file: No such file or directory + "-Ddocs=${lib.boolToString (stdenv.buildPlatform == stdenv.hostPlatform)}" # We don't use firewalld in NixOS "-Dfirewalld_zone=false" "-Dtests=no" @@ -150,12 +155,12 @@ stdenv.mkDerivation rec { mobile-broadband-provider-info bluez5 dnsmasq - gobject-introspection modemmanager readline newt libsoup jansson + dbus # used to get directory paths with pkg-config during configuration ]; propagatedBuildInputs = [ gnutls libgcrypt ]; @@ -167,7 +172,7 @@ stdenv.mkDerivation rec { pkg-config vala gobject-introspection - dbus + elfutils # used to find jansson soname # Docs gtk-doc libxslt @@ -176,6 +181,8 @@ stdenv.mkDerivation rec { docbook_xml_dtd_42 docbook_xml_dtd_43 pythonForDocs + ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + mesonEmulatorHook ]; doCheck = false; # requires /sys, the net @@ -183,6 +190,10 @@ stdenv.mkDerivation rec { postPatch = '' patchShebangs ./tools patchShebangs libnm/generate-setting-docs.py + + # TODO: submit upstream + substituteInPlace meson.build \ + --replace "'vala', req" "'vala', native: false, req" ''; preBuild = '' @@ -194,6 +205,11 @@ stdenv.mkDerivation rec { ln -s $PWD/src/libnm-client-impl/libnm.so.0 ${placeholder "out"}/lib/libnm.so.0 ''; + postFixup = lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + cp -r ${buildPackages.networkmanager.devdoc} $devdoc + cp -r ${buildPackages.networkmanager.man} $man + ''; + passthru = { updateScript = gnome.updateScript { packageName = "NetworkManager";