@@ -3,7 +3,7 @@
33, fetchpatch
44, pkg-config
55, gettext
6−, docbook_xsl
6+, docbook-xsl-nons
77, docbook_xml_dtd_43
88, gtk-doc
99, meson
@@ -48,13 +48,11 @@
4848
4949assert cupsSupport -> cups != null;
5050
51−with lib;
52−
5351stdenv.mkDerivation rec {
5452 pname = "gtk+3";
5553 version = "3.24.24";
5654
57− outputs = [ "out" "dev" ] ++ optional withGtkDoc "devdoc";
55+ outputs = [ "out" "dev" ] ++ lib.optional withGtkDoc "devdoc";
5856 outputBin = "dev";
5957
6058 setupHooks = [
@@ -69,12 +67,13 @@ stdenv.mkDerivation rec {
6967
7068 patches = [
7169 ./patches/3.0-immodules.cache.patch
70+
7271 (fetchpatch {
7372 name = "Xft-setting-fallback-compute-DPI-properly.patch";
7473 url = "https://bug757142.bugzilla-attachments.gnome.org/attachment.cgi?id=344123";
7574 sha256 = "0g6fhqcv8spfy3mfmxpyji93k8d4p4q4fz1v9a1c1cgcwkz41d7p";
7675 })
77− ] ++ optionals stdenv.isDarwin [
76+ ] ++ lib.optionals stdenv.isDarwin [
7877 # X11 module requires <gio/gdesktopappinfo.h> which is not installed on Darwin
7978 # let’s drop that dependency in similar way to how other parts of the library do it
8079 # e.g. https://gitlab.gnome.org/GNOME/gtk/blob/3.24.4/gtk/gtk-launch.c#L31-33
@@ -82,35 +81,6 @@ stdenv.mkDerivation rec {
8281 ./patches/3.0-darwin-x11.patch
8382 ];
8483
85− separateDebugInfo = stdenv.isLinux;
86−
87− mesonFlags = [
88− "-Dgtk_doc=${boolToString withGtkDoc}"
89− "-Dtests=false"
90− "-Dtracker3=${boolToString trackerSupport}"
91− "-Dbroadway_backend=${boolToString broadwaySupport}"
92− ];
93−
94− # These are the defines that'd you'd get with --enable-debug=minimum (default).
95− # See: https://developer.gnome.org/gtk3/stable/gtk-building.html#extra-configuration-options
96− NIX_CFLAGS_COMPILE = "-DG_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS";
97−
98− postPatch = ''
99− files=(
100− build-aux/meson/post-install.py
101− demos/gtk-demo/geninclude.py
102− gdk/broadway/gen-c-array.py
103− gdk/gen-gdk-gresources-xml.py
104− gtk/cursor/dnd-copy.png
105− gtk/gen-gtk-gresources-xml.py
106− gtk/gen-rc.py
107− gtk/gentypefuncs.py
108− )
109−
110− chmod +x ''${files[@]}
111− patchShebangs ''${files[@]}
112− '';
113−
11484 nativeBuildInputs = [
11585 gettext
11686 gobject-introspection
@@ -120,9 +90,9 @@ stdenv.mkDerivation rec {
12090 pkg-config
12191 python3
12292 sassc
123− ] ++ setupHooks ++ optionals withGtkDoc [
93+ ] ++ setupHooks ++ lib.optionals withGtkDoc [
12494 docbook_xml_dtd_43
125− docbook_xsl
95+ docbook-xsl-nons
12696 gtk-doc
12797 # For xmllint
12898 libxml2
@@ -133,10 +103,12 @@ stdenv.mkDerivation rec {
133103 epoxy
134104 json-glib
135105 isocodes
136− ]
137− ++ optional stdenv.isDarwin AppKit
138− ++ optional trackerSupport tracker
139− ;
106+ ] ++ lib.optionals stdenv.isDarwin [
107+ AppKit
108+ ] ++ lib.optionals trackerSupport [
109+ tracker
110+ ];
111+ #TODO: colord?
140112
141113 propagatedBuildInputs = with xorg; [
142114 at-spi2-atk
@@ -155,17 +127,51 @@ stdenv.mkDerivation rec {
155127 libXrandr
156128 libXrender
157129 pango
158− ]
159− ++ optional stdenv.isDarwin Cocoa # explicitly propagated, always needed
160− ++ optionals waylandSupport [ mesa wayland wayland-protocols ]
161− ++ optional xineramaSupport libXinerama
162− ++ optional cupsSupport cups
163− ;
164− #TODO: colord?
130+ ] ++ lib.optionals stdenv.isDarwin [
131+ # explicitly propagated, always needed
132+ Cocoa
133+ ] ++ lib.optionals waylandSupport [
134+ mesa
135+ wayland
136+ wayland-protocols
137+ ] ++ lib.optionals xineramaSupport [
138+ libXinerama
139+ ] ++ lib.optionals cupsSupport [
140+ cups
141+ ];
142+
143+ mesonFlags = [
144+ "-Dgtk_doc=${lib.boolToString withGtkDoc}"
145+ "-Dtests=false"
146+ "-Dtracker3=${lib.boolToString trackerSupport}"
147+ "-Dbroadway_backend=${lib.boolToString broadwaySupport}"
148+ ];
165149
166150 doCheck = false; # needs X11
167151
168− postInstall = optionalString (!stdenv.isDarwin) ''
152+ separateDebugInfo = stdenv.isLinux;
153+
154+ # These are the defines that'd you'd get with --enable-debug=minimum (default).
155+ # See: https://developer.gnome.org/gtk3/stable/gtk-building.html#extra-configuration-options
156+ NIX_CFLAGS_COMPILE = "-DG_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS";
157+
158+ postPatch = ''
159+ files=(
160+ build-aux/meson/post-install.py
161+ demos/gtk-demo/geninclude.py
162+ gdk/broadway/gen-c-array.py
163+ gdk/gen-gdk-gresources-xml.py
164+ gtk/cursor/dnd-copy.png
165+ gtk/gen-gtk-gresources-xml.py
166+ gtk/gen-rc.py
167+ gtk/gentypefuncs.py
168+ )
169+
170+ chmod +x ''${files[@]}
171+ patchShebangs ''${files[@]}
172+ '';
173+
174+ postInstall = lib.optionalString (!stdenv.isDarwin) ''
169175 # The updater is needed for nixos env and it's tiny.
170176 moveToOutput bin/gtk-update-icon-cache "$out"
171177 # Launcher
@@ -178,7 +184,7 @@ stdenv.mkDerivation rec {
178184 '';
179185
180186 # Wrap demos
181− postFixup = optionalString (!stdenv.isDarwin) ''
187+ postFixup = lib.optionalString (!stdenv.isDarwin) ''
182188 demos=(gtk3-demo gtk3-demo-application gtk3-icon-browser gtk3-widget-factory)
183189
184190 for program in ''${demos[@]}; do
@@ -194,7 +200,7 @@ stdenv.mkDerivation rec {
194200 };
195201 };
196202
197− meta = {
203+ meta = with lib; {
198204 description = "A multi-platform toolkit for creating graphical user interfaces";
199205 longDescription = ''
200206 GTK is a highly usable, feature rich toolkit for creating