From d43e540f891eb804513683b0393b1bf1e0d8d372 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 10 Feb 2023 20:48:14 -0500 Subject: [PATCH] gtk: Add `meta.pkgConfigModules` and test --- pkgs/development/libraries/gtk/2.x.nix | 19 +++++++++++++++---- pkgs/development/libraries/gtk/3.x.nix | 21 ++++++++++++++++----- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/pkgs/development/libraries/gtk/2.x.nix b/pkgs/development/libraries/gtk/2.x.nix index 23680c9b6757..88dfc54094f3 100644 --- a/pkgs/development/libraries/gtk/2.x.nix +++ b/pkgs/development/libraries/gtk/2.x.nix @@ -5,6 +5,7 @@ , gdktarget ? if stdenv.isDarwin then "quartz" else "x11" , AppKit, Cocoa , fetchpatch, buildPackages +, testers }: let @@ -17,12 +18,12 @@ let in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "gtk+"; version = "2.24.33"; src = fetchurl { - url = "mirror://gnome/sources/gtk+/2.24/${pname}-${version}.tar.xz"; + url = "mirror://gnome/sources/gtk+/2.24/${finalAttrs.pname}-${finalAttrs.version}.tar.xz"; sha256 = "rCrHV/WULTGKMRpUsMgLXvKV8pnCpzxjL2v7H/Scxto="; }; @@ -37,7 +38,9 @@ stdenv.mkDerivation rec { ]; - nativeBuildInputs = setupHooks ++ [ perl pkg-config gettext gobject-introspection ]; + nativeBuildInputs = finalAttrs.setupHooks ++ [ + perl pkg-config gettext gobject-introspection + ]; patches = [ ./patches/2.0-immodules.cache.patch @@ -90,6 +93,7 @@ stdenv.mkDerivation rec { $out/bin/gtk-query-immodules-2.0 $out/lib/gtk-2.0/2.10.0/immodules/*.so > $out/lib/gtk-2.0/2.10.0/immodules.cache ''; # workaround for bug of nix-mode for Emacs */ ''; inherit gdktarget; + tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; }; meta = with lib; { @@ -97,6 +101,13 @@ stdenv.mkDerivation rec { homepage = "https://www.gtk.org/"; license = licenses.lgpl2Plus; maintainers = with maintainers; [ lovek323 raskin ]; + pkgConfigModules = [ + "gdk-2.0" + "gtk+-2.0" + ] ++ lib.optionals (gdktarget == "x11") [ + "gdk-x11-2.0" + "gtk+-x11-2.0" + ]; platforms = platforms.all; longDescription = '' @@ -111,4 +122,4 @@ stdenv.mkDerivation rec { ''; changelog = "https://gitlab.gnome.org/GNOME/gtk/-/raw/${version}/NEWS"; }; -} +}) diff --git a/pkgs/development/libraries/gtk/3.x.nix b/pkgs/development/libraries/gtk/3.x.nix index 1533f59b4aec..6737cdd7e410 100644 --- a/pkgs/development/libraries/gtk/3.x.nix +++ b/pkgs/development/libraries/gtk/3.x.nix @@ -46,6 +46,7 @@ , QuartzCore , broadwaySupport ? true , wayland-scanner +, testers }: let @@ -58,7 +59,7 @@ let in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "gtk+3"; version = "3.24.36"; @@ -70,7 +71,9 @@ stdenv.mkDerivation rec { gtkCleanImmodulesCache ]; - src = fetchurl { + src = let + inherit (finalAttrs) version; + in fetchurl { url = "mirror://gnome/sources/gtk+/${lib.versions.majorMinor version}/gtk+-${version}.tar.xz"; sha256 = "sha256-J6bvFXdDNQyAf/6lm6odcCJtvt6CpelT/9WOpgWf5pE="; }; @@ -99,7 +102,7 @@ stdenv.mkDerivation rec { python3 sassc gdk-pixbuf - ] ++ setupHooks ++ lib.optionals withGtkDoc [ + ] ++ finalAttrs.setupHooks ++ lib.optionals withGtkDoc [ docbook_xml_dtd_43 docbook-xsl-nons gtk-doc @@ -212,7 +215,7 @@ stdenv.mkDerivation rec { for program in ''${demos[@]}; do wrapProgram $dev/bin/$program \ - --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH:$out/share/gsettings-schemas/${pname}-${version}" + --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH:$out/share/gsettings-schemas/${finalAttrs.pname}-${finalAttrs.version}" done '' + lib.optionalString stdenv.isDarwin '' # a comment created a cycle between outputs @@ -225,6 +228,7 @@ stdenv.mkDerivation rec { attrPath = "gtk3"; freeze = true; }; + tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; }; meta = with lib; { @@ -242,7 +246,14 @@ stdenv.mkDerivation rec { homepage = "https://www.gtk.org/"; license = licenses.lgpl2Plus; maintainers = with maintainers; [ raskin ] ++ teams.gnome.members; + pkgConfigModules = [ + "gdk-3.0" + "gtk+-3.0" + ] ++ lib.optionals x11Support [ + "gdk-x11-3.0" + "gtk+-x11-3.0" + ]; platforms = platforms.all; changelog = "https://gitlab.gnome.org/GNOME/gtk/-/raw/${version}/NEWS"; }; -} +})