From efa57f8820e77971d3212e838eebd36c6a046c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 10 Dec 2018 11:33:36 +0000 Subject: [PATCH] glib: fix cross -> inherit devdoc from native build Glib uses gobject introspection to generate documentation. If we would want to cross-compile those, we would need native binaries from the previous build stage. Instead we can simply just copy over the generated documentation. --- pkgs/development/libraries/glib/default.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix index 1eb50fc4f10..22acd530093 100644 --- a/pkgs/development/libraries/glib/default.nix +++ b/pkgs/development/libraries/glib/default.nix @@ -2,6 +2,7 @@ , libiconv, zlib, libffi, pcre, libelf, gnome3, libselinux, bash, gnum4, gtk-doc, docbook_xsl, docbook_xml_dtd_45 # use utillinuxMinimal to avoid circular dependency (utillinux, systemd, glib) , utillinuxMinimal ? null +, buildPackages # this is just for tests (not in the closure of any regular package) , doCheck ? stdenv.config.doCheckByDefault or false @@ -78,12 +79,16 @@ stdenv.mkDerivation rec { utillinuxMinimal # for libmount ]; - nativeBuildInputs = [ meson ninja pkgconfig perl python3 gettext gtk-doc docbook_xsl docbook_xml_dtd_45 glibcLocales ]; + nativeBuildInputs = [ + meson ninja pkgconfig perl python3 gettext gtk-doc docbook_xsl docbook_xml_dtd_45 glibcLocales + ]; propagatedBuildInputs = [ zlib libffi gettext libiconv ]; mesonFlags = [ - "-Dgtk_doc=true" + # Avoid the need for gobject introspection binaries in PATH in cross-compiling case. + # Instead we just copy them over from the native output. + "-Dgtk_doc=${if stdenv.hostPlatform == stdenv.buildPlatform then "true" else "false"}" ]; LC_ALL = "en_US.UTF-8"; @@ -126,6 +131,8 @@ stdenv.mkDerivation rec { # This file is *included* in gtk3 and would introduce runtime reference via __FILE__. sed '1i#line 1 "${name}/include/glib-2.0/gobject/gobjectnotifyqueue.c"' \ -i "$dev"/include/glib-2.0/gobject/gobjectnotifyqueue.c + '' + optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' + cp -r ${buildPackages.glib.devdoc} $devdoc ''; checkInputs = [ tzdata libxml2 desktop-file-utils shared-mime-info ];