diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2021-01-23 15:27:11 +0100 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2021-01-23 15:27:11 +0100 |
commit | 04fce1988815010ce0274a4a4e83f270b5e2cf0c (patch) | |
tree | 02593bf291605b488b9d9d447263b23512a9c30c /pkgs/development/libraries | |
parent | 1a495d604f2d82cf9f4f4d87c84c381b75d6c0a6 (diff) |
gtk3: Clean up
- Reorder the expression according to https://github.com/jtojnar/nixpkgs-hammering/blob/master/explanations/attribute-ordering.md - Do not use `with lib;` at top-level. - Use lib.optionals instead of lib.optional for cleaner style. - Replace docbook_xsl alias with docbook-xsl-nons. This will make it more in line with the incoming GTK 4 package.
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r-- | pkgs/development/libraries/gtk/3.x.nix | 106 |
1 files changed, 56 insertions, 50 deletions
diff --git a/pkgs/development/libraries/gtk/3.x.nix b/pkgs/development/libraries/gtk/3.x.nix index 21a87de4a1605..0e5c6edc96409 100644 --- a/pkgs/development/libraries/gtk/3.x.nix +++ b/pkgs/development/libraries/gtk/3.x.nix @@ -3,7 +3,7 @@ , fetchpatch , pkg-config , gettext -, docbook_xsl +, docbook-xsl-nons , docbook_xml_dtd_43 , gtk-doc , meson @@ -48,13 +48,11 @@ assert cupsSupport -> cups != null; -with 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 = [ @@ -69,12 +67,13 @@ stdenv.mkDerivation rec { 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,35 +81,6 @@ 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 @@ -120,9 +90,9 @@ stdenv.mkDerivation rec { 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 |