about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gtk/3.x.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gtk/3.x.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/gtk/3.x.nix114
1 files changed, 60 insertions, 54 deletions
diff --git a/nixpkgs/pkgs/development/libraries/gtk/3.x.nix b/nixpkgs/pkgs/development/libraries/gtk/3.x.nix
index 59685ca07ccb..0e5c6edc9640 100644
--- a/nixpkgs/pkgs/development/libraries/gtk/3.x.nix
+++ b/nixpkgs/pkgs/development/libraries/gtk/3.x.nix
@@ -1,9 +1,9 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
-, pkgconfig
+, pkg-config
 , gettext
-, docbook_xsl
+, docbook-xsl-nons
 , docbook_xml_dtd_43
 , gtk-doc
 , meson
@@ -48,13 +48,11 @@
 
 assert cupsSupport -> cups != null;
 
-with stdenv.lib;
-
 stdenv.mkDerivation rec {
   pname = "gtk+3";
   version = "3.24.24";
 
-  outputs = [ "out" "dev" ] ++ optional withGtkDoc "devdoc";
+  outputs = [ "out" "dev" ] ++ lib.optional withGtkDoc "devdoc";
   outputBin = "dev";
 
   setupHooks = [
@@ -63,18 +61,19 @@ stdenv.mkDerivation rec {
   ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gtk+/${stdenv.lib.versions.majorMinor version}/gtk+-${version}.tar.xz";
+    url = "mirror://gnome/sources/gtk+/${lib.versions.majorMinor version}/gtk+-${version}.tar.xz";
     sha256 = "12ipk1d376bai9v820qzhxba93kkh5abi6mhyqr4hwjvqmkl77fc";
   };
 
   patches = [
     ./patches/3.0-immodules.cache.patch
+
     (fetchpatch {
       name = "Xft-setting-fallback-compute-DPI-properly.patch";
       url = "https://bug757142.bugzilla-attachments.gnome.org/attachment.cgi?id=344123";
       sha256 = "0g6fhqcv8spfy3mfmxpyji93k8d4p4q4fz1v9a1c1cgcwkz41d7p";
     })
-  ] ++ optionals stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     # X11 module requires <gio/gdesktopappinfo.h> which is not installed on Darwin
     # let’s drop that dependency in similar way to how other parts of the library do it
     # e.g. https://gitlab.gnome.org/GNOME/gtk/blob/3.24.4/gtk/gtk-launch.c#L31-33
@@ -82,47 +81,18 @@ stdenv.mkDerivation rec {
     ./patches/3.0-darwin-x11.patch
   ];
 
-  separateDebugInfo = stdenv.isLinux;
-
-  mesonFlags = [
-    "-Dgtk_doc=${boolToString withGtkDoc}"
-    "-Dtests=false"
-    "-Dtracker3=${boolToString trackerSupport}"
-    "-Dbroadway_backend=${boolToString broadwaySupport}"
-  ];
-
-  # These are the defines that'd you'd get with --enable-debug=minimum (default).
-  # See: https://developer.gnome.org/gtk3/stable/gtk-building.html#extra-configuration-options
-  NIX_CFLAGS_COMPILE = "-DG_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS";
-
-  postPatch = ''
-    files=(
-      build-aux/meson/post-install.py
-      demos/gtk-demo/geninclude.py
-      gdk/broadway/gen-c-array.py
-      gdk/gen-gdk-gresources-xml.py
-      gtk/cursor/dnd-copy.png
-      gtk/gen-gtk-gresources-xml.py
-      gtk/gen-rc.py
-      gtk/gentypefuncs.py
-    )
-
-    chmod +x ''${files[@]}
-    patchShebangs ''${files[@]}
-  '';
-
   nativeBuildInputs = [
     gettext
     gobject-introspection
     makeWrapper
     meson
     ninja
-    pkgconfig
+    pkg-config
     python3
     sassc
-  ] ++ setupHooks ++ optionals withGtkDoc [
+  ] ++ setupHooks ++ lib.optionals withGtkDoc [
     docbook_xml_dtd_43
-    docbook_xsl
+    docbook-xsl-nons
     gtk-doc
     # For xmllint
     libxml2
@@ -133,10 +103,12 @@ stdenv.mkDerivation rec {
     epoxy
     json-glib
     isocodes
-  ]
-  ++ optional stdenv.isDarwin AppKit
-  ++ optional trackerSupport tracker
-  ;
+  ] ++ lib.optionals stdenv.isDarwin [
+    AppKit
+  ] ++ lib.optionals trackerSupport [
+    tracker
+  ];
+  #TODO: colord?
 
   propagatedBuildInputs = with xorg; [
     at-spi2-atk
@@ -155,17 +127,51 @@ stdenv.mkDerivation rec {
     libXrandr
     libXrender
     pango
-  ]
-  ++ optional stdenv.isDarwin Cocoa  # explicitly propagated, always needed
-  ++ optionals waylandSupport [ mesa wayland wayland-protocols ]
-  ++ optional xineramaSupport libXinerama
-  ++ optional cupsSupport cups
-  ;
-  #TODO: colord?
+  ] ++ lib.optionals stdenv.isDarwin [
+    # explicitly propagated, always needed
+    Cocoa
+  ] ++ lib.optionals waylandSupport [
+    mesa
+    wayland
+    wayland-protocols
+  ] ++ lib.optionals xineramaSupport [
+    libXinerama
+  ] ++ lib.optionals cupsSupport [
+    cups
+  ];
+
+  mesonFlags = [
+    "-Dgtk_doc=${lib.boolToString withGtkDoc}"
+    "-Dtests=false"
+    "-Dtracker3=${lib.boolToString trackerSupport}"
+    "-Dbroadway_backend=${lib.boolToString broadwaySupport}"
+  ];
 
   doCheck = false; # needs X11
 
-  postInstall = optionalString (!stdenv.isDarwin) ''
+  separateDebugInfo = stdenv.isLinux;
+
+  # These are the defines that'd you'd get with --enable-debug=minimum (default).
+  # See: https://developer.gnome.org/gtk3/stable/gtk-building.html#extra-configuration-options
+  NIX_CFLAGS_COMPILE = "-DG_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS";
+
+  postPatch = ''
+    files=(
+      build-aux/meson/post-install.py
+      demos/gtk-demo/geninclude.py
+      gdk/broadway/gen-c-array.py
+      gdk/gen-gdk-gresources-xml.py
+      gtk/cursor/dnd-copy.png
+      gtk/gen-gtk-gresources-xml.py
+      gtk/gen-rc.py
+      gtk/gentypefuncs.py
+    )
+
+    chmod +x ''${files[@]}
+    patchShebangs ''${files[@]}
+  '';
+
+  postInstall = lib.optionalString (!stdenv.isDarwin) ''
     # The updater is needed for nixos env and it's tiny.
     moveToOutput bin/gtk-update-icon-cache "$out"
     # Launcher
@@ -178,7 +184,7 @@ stdenv.mkDerivation rec {
   '';
 
   # Wrap demos
-  postFixup =  optionalString (!stdenv.isDarwin) ''
+  postFixup =  lib.optionalString (!stdenv.isDarwin) ''
     demos=(gtk3-demo gtk3-demo-application gtk3-icon-browser gtk3-widget-factory)
 
     for program in ''${demos[@]}; do
@@ -194,7 +200,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = {
+  meta = with lib; {
     description = "A multi-platform toolkit for creating graphical user interfaces";
     longDescription = ''
       GTK is a highly usable, feature rich toolkit for creating