diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gtk')
11 files changed, 824 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/gtk/2.x.nix b/nixpkgs/pkgs/development/libraries/gtk/2.x.nix new file mode 100644 index 000000000000..396366324d3a --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gtk/2.x.nix @@ -0,0 +1,116 @@ +{ config, lib, substituteAll, stdenv, fetchurl, pkg-config, gettext, glib, atk, pango, cairo, perl, xorg +, gdk-pixbuf, xlibsWrapper, gobject-introspection +, xineramaSupport ? stdenv.isLinux +, cupsSupport ? config.gtk2.cups or stdenv.isLinux, cups +, gdktarget ? if stdenv.isDarwin then "quartz" else "x11" +, AppKit, Cocoa +, fetchpatch, buildPackages +}: + +with lib; + +let + + gtkCleanImmodulesCache = substituteAll { + src = ./hooks/clean-immodules-cache.sh; + gtk_module_path = "gtk-2.0"; + gtk_binary_version = "2.10.0"; + }; + +in + +stdenv.mkDerivation rec { + pname = "gtk+"; + version = "2.24.33"; + + src = fetchurl { + url = "mirror://gnome/sources/gtk+/2.24/${pname}-${version}.tar.xz"; + sha256 = "rCrHV/WULTGKMRpUsMgLXvKV8pnCpzxjL2v7H/Scxto="; + }; + + outputs = [ "out" "dev" "devdoc" ]; + outputBin = "dev"; + + enableParallelBuilding = true; + + setupHooks = [ + ./hooks/drop-icon-theme-cache.sh + gtkCleanImmodulesCache + ]; + + + nativeBuildInputs = setupHooks ++ [ perl pkg-config gettext gobject-introspection ]; + + patches = [ + ./patches/2.0-immodules.cache.patch + ./patches/gtk2-theme-paths.patch + ] ++ optionals stdenv.isDarwin [ + (fetchpatch { + url = "https://bug557780.bugzilla-attachments.gnome.org/attachment.cgi?id=306776"; + sha256 = "0sp8f1r5c4j2nlnbqgv7s7nxa4cfwigvm033hvhb1ld652pjag4r"; + }) + ./patches/2.0-darwin-x11.patch + ]; + + propagatedBuildInputs = with xorg; + [ glib cairo pango gdk-pixbuf atk ] + ++ optionals (stdenv.isLinux || stdenv.isDarwin) [ + libXrandr libXrender libXcomposite libXi libXcursor + ] + ++ optionals stdenv.isDarwin [ xlibsWrapper libXdamage ] + ++ optional xineramaSupport libXinerama + ++ optionals cupsSupport [ cups ] + ++ optionals stdenv.isDarwin [ AppKit Cocoa ]; + + preConfigure = if (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11" && stdenv.isDarwin) then '' + MACOSX_DEPLOYMENT_TARGET=10.16 + '' else null; + + configureFlags = [ + "--with-gdktarget=${gdktarget}" + "--with-xinput=yes" + ] ++ optionals stdenv.isDarwin [ + "--disable-glibtest" + "--disable-introspection" + "--disable-visibility" + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + "ac_cv_path_GTK_UPDATE_ICON_CACHE=${buildPackages.gtk2}/bin/gtk-update-icon-cache" + "ac_cv_path_GDK_PIXBUF_CSOURCE=${buildPackages.gdk-pixbuf.dev}/bin/gdk-pixbuf-csource" + ]; + + doCheck = false; # needs X11 + + postInstall = '' + moveToOutput share/gtk-2.0/demo "$devdoc" + # The updater is needed for nixos env and it's tiny. + moveToOutput bin/gtk-update-icon-cache "$out" + ''; + + passthru = { + gtkExeEnvPostBuild = '' + rm $out/lib/gtk-2.0/2.10.0/immodules.cache + $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; + }; + + meta = { + description = "A multi-platform toolkit for creating graphical user interfaces"; + homepage = "https://www.gtk.org/"; + license = licenses.lgpl2Plus; + maintainers = with maintainers; [ lovek323 raskin ]; + platforms = platforms.all; + + longDescription = '' + GTK is a highly usable, feature rich toolkit for creating + graphical user interfaces which boasts cross platform + compatibility and an easy to use API. GTK it is written in C, + but has bindings to many other popular programming languages + such as C++, Python and C# among others. GTK is licensed + under the GNU LGPL 2.1 allowing development of both free and + proprietary software with GTK without any license fees or + royalties. + ''; + changelog = "https://gitlab.gnome.org/GNOME/gtk/-/raw/${version}/NEWS"; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/gtk/3.x.nix b/nixpkgs/pkgs/development/libraries/gtk/3.x.nix new file mode 100644 index 000000000000..c06aa9469937 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gtk/3.x.nix @@ -0,0 +1,247 @@ +{ lib +, stdenv +, substituteAll +, fetchurl +, pkg-config +, gettext +, docbook-xsl-nons +, docbook_xml_dtd_43 +, gtk-doc +, meson +, ninja +, python3 +, makeWrapper +, shared-mime-info +, isocodes +, expat +, glib +, cairo +, pango +, gdk-pixbuf +, atk +, at-spi2-atk +, gobject-introspection +, fribidi +, xorg +, libepoxy +, libxkbcommon +, libxml2 +, gmp +, gnome +, gsettings-desktop-schemas +, sassc +, trackerSupport ? stdenv.isLinux && (stdenv.buildPlatform == stdenv.hostPlatform) +, tracker +, x11Support ? stdenv.isLinux +, waylandSupport ? stdenv.isLinux +, libGL +, wayland +, wayland-protocols +, xineramaSupport ? stdenv.isLinux +, cupsSupport ? stdenv.isLinux +, withGtkDoc ? stdenv.isLinux && (stdenv.buildPlatform == stdenv.hostPlatform) +, cups +, AppKit +, Cocoa +, QuartzCore +, broadwaySupport ? true +, wayland-scanner +}: + +let + + gtkCleanImmodulesCache = substituteAll { + src = ./hooks/clean-immodules-cache.sh; + gtk_module_path = "gtk-3.0"; + gtk_binary_version = "3.0.0"; + }; + +in + +stdenv.mkDerivation rec { + pname = "gtk+3"; + version = "3.24.34"; + + outputs = [ "out" "dev" ] ++ lib.optional withGtkDoc "devdoc"; + outputBin = "dev"; + + setupHooks = [ + ./hooks/drop-icon-theme-cache.sh + gtkCleanImmodulesCache + ]; + + src = fetchurl { + url = "mirror://gnome/sources/gtk+/${lib.versions.majorMinor version}/gtk+-${version}.tar.xz"; + sha256 = "sha256-28afkN3IIbjRRB8AN03B2kMjour6kHjmHtvl7u+oUuw="; + }; + + patches = [ + ./patches/3.0-immodules.cache.patch + ./patches/3.0-Xft-setting-fallback-compute-DPI-properly.patch + ] ++ 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 + # https://gitlab.gnome.org/GNOME/gtk/merge_requests/536 + ./patches/3.0-darwin-x11.patch + ]; + + depsBuildBuild = [ + pkg-config + ]; + nativeBuildInputs = [ + gettext + gobject-introspection + makeWrapper + meson + ninja + pkg-config + python3 + sassc + gdk-pixbuf + ] ++ setupHooks ++ lib.optionals withGtkDoc [ + docbook_xml_dtd_43 + docbook-xsl-nons + gtk-doc + # For xmllint + libxml2 + ] ++ lib.optionals waylandSupport [ + wayland-scanner + ]; + + buildInputs = [ + gobject-introspection + libxkbcommon + (libepoxy.override { inherit x11Support; }) + isocodes + ] ++ lib.optionals stdenv.isDarwin [ + AppKit + ] ++ lib.optionals trackerSupport [ + tracker + ]; + #TODO: colord? + + propagatedBuildInputs = with xorg; [ + at-spi2-atk + atk + cairo + expat + fribidi + gdk-pixbuf + glib + gsettings-desktop-schemas + libICE + libSM + libXcomposite + libXcursor + libXi + libXrandr + libXrender + pango + ] ++ lib.optionals stdenv.isDarwin [ + # explicitly propagated, always needed + Cocoa + QuartzCore + ] ++ lib.optionals waylandSupport [ + libGL + 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}" + "-Dx11_backend=${lib.boolToString x11Support}" + "-Dquartz_backend=${lib.boolToString (stdenv.isDarwin && !x11Support)}" + ]; + + doCheck = false; # needs X11 + + 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 = '' + # See https://github.com/NixOS/nixpkgs/issues/132259 + substituteInPlace meson.build \ + --replace "x11_enabled = false" "" + + 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 + moveToOutput bin/gtk-launch "$out" + # Broadway daemon + moveToOutput bin/broadwayd "$out" + + # TODO: patch glib directly + for f in $dev/bin/gtk-encode-symbolic-svg; do + wrapProgram $f --prefix XDG_DATA_DIRS : "${shared-mime-info}/share" + done + '' + lib.optionalString (stdenv.buildPlatform == stdenv.hostPlatform) '' + GTK_PATH="''${out:?}/lib/gtk-3.0/3.0.0/immodules/" ''${dev:?}/bin/gtk-query-immodules-3.0 > "''${out:?}/lib/gtk-3.0/3.0.0/immodules.cache" + ''; + + # Wrap demos + postFixup = lib.optionalString (!stdenv.isDarwin) '' + demos=(gtk3-demo gtk3-demo-application gtk3-icon-browser gtk3-widget-factory) + + for program in ''${demos[@]}; do + wrapProgram $dev/bin/$program \ + --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH:$out/share/gsettings-schemas/${pname}-${version}" + done + '' + lib.optionalString stdenv.isDarwin '' + # a comment created a cycle between outputs + sed '/^# ModulesPath =/d' -i "$out"/lib/gtk-*/*/immodules.cache + ''; + + passthru = { + updateScript = gnome.updateScript { + packageName = "gtk+"; + attrPath = "gtk3"; + freeze = true; + }; + }; + + meta = with lib; { + description = "A multi-platform toolkit for creating graphical user interfaces"; + longDescription = '' + GTK is a highly usable, feature rich toolkit for creating + graphical user interfaces which boasts cross platform + compatibility and an easy to use API. GTK it is written in C, + but has bindings to many other popular programming languages + such as C++, Python and C# among others. GTK is licensed + under the GNU LGPL 2.1 allowing development of both free and + proprietary software with GTK without any license fees or + royalties. + ''; + homepage = "https://www.gtk.org/"; + license = licenses.lgpl2Plus; + maintainers = with maintainers; [ raskin ] ++ teams.gnome.members; + platforms = platforms.all; + changelog = "https://gitlab.gnome.org/GNOME/gtk/-/raw/${version}/NEWS"; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/gtk/4.x.nix b/nixpkgs/pkgs/development/libraries/gtk/4.x.nix new file mode 100644 index 000000000000..fc3e39b02261 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gtk/4.x.nix @@ -0,0 +1,249 @@ +{ lib +, stdenv +, substituteAll +, fetchurl +, pkg-config +, gettext +, graphene +, gi-docgen +, meson +, ninja +, python3 +, makeWrapper +, shared-mime-info +, isocodes +, glib +, cairo +, pango +, pandoc +, gdk-pixbuf +, gobject-introspection +, fribidi +, harfbuzz +, xorg +, libepoxy +, libxkbcommon +, libpng +, libtiff +, libjpeg +, libxml2 +, gnome +, gsettings-desktop-schemas +, gst_all_1 +, sassc +, trackerSupport ? stdenv.isLinux +, tracker +, x11Support ? stdenv.isLinux +, waylandSupport ? stdenv.isLinux +, libGL +# experimental and can cause crashes in inspector +, vulkanSupport ? false +, vulkan-loader +, vulkan-headers +, wayland +, wayland-protocols +, xineramaSupport ? stdenv.isLinux +, cupsSupport ? stdenv.isLinux +, cups +, AppKit +, Cocoa +, broadwaySupport ? true +}: + +let + + gtkCleanImmodulesCache = substituteAll { + src = ./hooks/clean-immodules-cache.sh; + gtk_module_path = "gtk-4.0"; + gtk_binary_version = "4.0.0"; + }; + +in + +stdenv.mkDerivation rec { + pname = "gtk4"; + version = "4.6.6"; + + outputs = [ "out" "dev" ] ++ lib.optionals x11Support [ "devdoc" ]; + outputBin = "dev"; + + setupHooks = [ + ./hooks/drop-icon-theme-cache.sh + gtkCleanImmodulesCache + ]; + + src = fetchurl { + url = "mirror://gnome/sources/gtk/${lib.versions.majorMinor version}/gtk-${version}.tar.xz"; + sha256 = "e7/k0TVp98KX7UmDSscmPjGLe/EC0ycctGbVlx9ZrnA="; + }; + + nativeBuildInputs = [ + gettext + gobject-introspection + makeWrapper + meson + ninja + pkg-config + python3 + sassc + gi-docgen + libxml2 # for xmllint + ] ++ setupHooks; + + buildInputs = [ + libxkbcommon + libpng + libtiff + libjpeg + (libepoxy.override { inherit x11Support; }) + isocodes + ] ++ lib.optionals vulkanSupport [ + vulkan-headers + ] ++ [ + gst_all_1.gst-plugins-base + gst_all_1.gst-plugins-bad + fribidi + harfbuzz + ] ++ (with xorg; [ + libICE + libSM + libXcursor + libXdamage + libXi + libXrandr + libXrender + ]) ++ lib.optionals stdenv.isDarwin [ + AppKit + ] ++ lib.optionals trackerSupport [ + tracker + ] ++ lib.optionals waylandSupport [ + libGL + wayland + wayland-protocols + ] ++ lib.optionals xineramaSupport [ + xorg.libXinerama + ] ++ lib.optionals cupsSupport [ + cups + ] ++ lib.optionals stdenv.isDarwin [ + Cocoa + ]; + #TODO: colord? + + propagatedBuildInputs = [ + # Required by pkg-config files. + cairo + gdk-pixbuf + glib + graphene + pango + ] ++ lib.optionals waylandSupport [ + wayland + ] ++ lib.optionals vulkanSupport [ + vulkan-loader + ] ++ [ + # Required for GSettings schemas at runtime. + # Will be picked up by wrapGAppsHook. + gsettings-desktop-schemas + ]; + + mesonFlags = [ + # ../docs/tools/shooter.c:4:10: fatal error: 'cairo-xlib.h' file not found + "-Dgtk_doc=${lib.boolToString x11Support}" + "-Dbuild-tests=false" + "-Dtracker=${if trackerSupport then "enabled" else "disabled"}" + "-Dbroadway-backend=${lib.boolToString broadwaySupport}" + ] ++ lib.optionals vulkanSupport [ + "-Dvulkan=enabled" + ] ++ lib.optionals (!cupsSupport) [ + "-Dprint-cups=disabled" + ] ++ lib.optionals stdenv.isDarwin [ + "-Dmedia-gstreamer=disabled" # requires gstreamer-gl + ] ++ lib.optionals (!x11Support) [ + "-Dx11-backend=false" + ]; + + doCheck = false; # needs X11 + + 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 + build-aux/meson/gen-demo-header.py + demos/gtk-demo/geninclude.py + gdk/broadway/gen-c-array.py + gdk/gen-gdk-gresources-xml.py + gtk/gen-gtk-gresources-xml.py + gtk/gentypefuncs.py + ) + + chmod +x ''${files[@]} + patchShebangs ''${files[@]} + ''; + + preInstall = '' + OLD_PATH="$PATH" + PATH="$PATH:$dev/bin" # so the install script finds gtk4-update-icon-cache + ''; + + postInstall = '' + PATH="$OLD_PATH" + '' + lib.optionalString (!stdenv.isDarwin) '' + # The updater is needed for nixos env and it's tiny. + moveToOutput bin/gtk4-update-icon-cache "$out" + # Launcher + moveToOutput bin/gtk-launch "$out" + + # TODO: patch glib directly + for f in $dev/bin/gtk4-encode-symbolic-svg; do + wrapProgram $f --prefix XDG_DATA_DIRS : "${shared-mime-info}/share" + done + '' + lib.optionalString broadwaySupport '' + # Broadway daemon + moveToOutput bin/gtk4-broadwayd "$out" + ''; + + # Wrap demos + postFixup = lib.optionalString (!stdenv.isDarwin) '' + demos=(gtk4-demo gtk4-demo-application gtk4-icon-browser gtk4-widget-factory) + + for program in ''${demos[@]}; do + wrapProgram $dev/bin/$program \ + --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH:$out/share/gsettings-schemas/${pname}-${version}" + done + '' + lib.optionalString x11Support '' + # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. + moveToOutput "share/doc" "$devdoc" + ''; + + passthru = { + updateScript = gnome.updateScript { + packageName = "gtk"; + versionPolicy = "odd-unstable"; + attrPath = "gtk4"; + }; + }; + + meta = with lib; { + description = "A multi-platform toolkit for creating graphical user interfaces"; + longDescription = '' + GTK is a highly usable, feature rich toolkit for creating + graphical user interfaces which boasts cross platform + compatibility and an easy to use API. GTK it is written in C, + but has bindings to many other popular programming languages + such as C++, Python and C# among others. GTK is licensed + under the GNU LGPL 2.1 allowing development of both free and + proprietary software with GTK without any license fees or + royalties. + ''; + homepage = "https://www.gtk.org/"; + license = licenses.lgpl2Plus; + maintainers = teams.gnome.members ++ (with maintainers; [ raskin ]); + platforms = platforms.all; + changelog = "https://gitlab.gnome.org/GNOME/gtk/-/raw/${version}/NEWS"; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/gtk/hooks/clean-immodules-cache.sh b/nixpkgs/pkgs/development/libraries/gtk/hooks/clean-immodules-cache.sh new file mode 100644 index 000000000000..0868a4a39101 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gtk/hooks/clean-immodules-cache.sh @@ -0,0 +1,15 @@ +# shellcheck shell=bash + +fixupOutputHooks+=(_gtkCleanImmodulesCache) + +# Clean comments that link to generator of the file +_gtkCleanImmodulesCache() { + # gtk_module_path is where the modules are installed + # https://gitlab.gnome.org/GNOME/gtk/-/blob/3.24.24/gtk/gtkmodules.c#L68 + # gtk_binary_version can be retrived with: + # pkg-config --variable=gtk_binary_version gtk+-3.0 + local f="${prefix:?}/lib/@gtk_module_path@/@gtk_binary_version@/immodules.cache" + if [ -f "$f" ]; then + sed 's|Created by .*bin/gtk-query-|Created by bin/gtk-query-|' -i "$f" + fi +} diff --git a/nixpkgs/pkgs/development/libraries/gtk/hooks/drop-icon-theme-cache.sh b/nixpkgs/pkgs/development/libraries/gtk/hooks/drop-icon-theme-cache.sh new file mode 100644 index 000000000000..f28a856c4f50 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gtk/hooks/drop-icon-theme-cache.sh @@ -0,0 +1,19 @@ +# shellcheck shell=bash + +# Packages often run gtk-update-icon-cache to include their icons in themes’ icon cache. +# However, since each package is installed to its own prefix, the files will only collide. +dropIconThemeCache() { + if [[ -z "${dontDropIconThemeCache:-}" ]]; then + local icondir="${out:?}/share/icons" + if [[ -d "${icondir}" ]]; then + # App icons are supposed to go to hicolor theme, since it is a fallback theme as per [icon-theme-spec], but some might still choose to install stylized icons to other themes. + find "${icondir}" -name 'icon-theme.cache' -print0 \ + | while IFS= read -r -d '' file; do + echo "Removing ${file}" + rm -f "${file}" + done + fi + fi +} + +preFixupPhases="${preFixupPhases-} dropIconThemeCache" diff --git a/nixpkgs/pkgs/development/libraries/gtk/patches/2.0-darwin-x11.patch b/nixpkgs/pkgs/development/libraries/gtk/patches/2.0-darwin-x11.patch new file mode 100644 index 000000000000..9725cfb84260 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gtk/patches/2.0-darwin-x11.patch @@ -0,0 +1,22 @@ +--- a/gdk/x11/gdkapplaunchcontext-x11.c ++++ b/gdk/x11/gdkapplaunchcontext-x11.c +@@ -26,7 +26,6 @@ + #include <unistd.h> + + #include <glib.h> +-#include <gio/gdesktopappinfo.h> + + #include "gdkx.h" + #include "gdkapplaunchcontext.h" +@@ -363,10 +362,7 @@ + else + workspace_str = NULL; + +- if (G_IS_DESKTOP_APP_INFO (info)) +- application_id = g_desktop_app_info_get_filename (G_DESKTOP_APP_INFO (info)); +- else +- application_id = NULL; ++ application_id = NULL; + + startup_id = g_strdup_printf ("%s-%lu-%s-%s-%d_TIME%lu", + g_get_prgname (), diff --git a/nixpkgs/pkgs/development/libraries/gtk/patches/2.0-immodules.cache.patch b/nixpkgs/pkgs/development/libraries/gtk/patches/2.0-immodules.cache.patch new file mode 100644 index 000000000000..1b8231756e71 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gtk/patches/2.0-immodules.cache.patch @@ -0,0 +1,27 @@ +--- a/gtk/gtkrc.c 2014-09-30 05:02:17.000000000 +0900 ++++ b/gtk/gtkrc.c 2016-04-09 17:39:51.363288355 +0900 +@@ -445,5 +445,23 @@ + if (var) + result = g_strdup (var); + ++ // check NIX_PROFILES paths. ++ const gchar *nixProfilesEnv = g_getenv ("NIX_PROFILES"); ++ gchar *cachePath; ++ guint i; ++ ++ if(nixProfilesEnv && !result){ ++ gchar **paths = g_strsplit(nixProfilesEnv, " ", -1); ++ for (i = 0; paths[i] != NULL; i++){ ++ cachePath = g_build_filename(paths[i], "etc", "gtk-2.0", "immodules.cache", NULL); ++ if( g_file_test( cachePath, G_FILE_TEST_EXISTS) ){ ++ if(result) g_free(result); ++ result = g_strdup(cachePath); ++ } ++ g_free(cachePath); ++ } ++ g_strfreev(paths); ++ } ++ + if (!result) + { + diff --git a/nixpkgs/pkgs/development/libraries/gtk/patches/3.0-Xft-setting-fallback-compute-DPI-properly.patch b/nixpkgs/pkgs/development/libraries/gtk/patches/3.0-Xft-setting-fallback-compute-DPI-properly.patch new file mode 100644 index 000000000000..247dd3ea8456 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gtk/patches/3.0-Xft-setting-fallback-compute-DPI-properly.patch @@ -0,0 +1,34 @@ +From 269f2d80ea41cde17612600841fbdc32e99010f5 Mon Sep 17 00:00:00 2001 +From: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> +Date: Tue, 24 Jan 2017 12:30:08 +0100 +Subject: [PATCH] Xft setting fallback: compute DPI properly + +This is a partial revert of bdf0820c501437a2150d8ff0d5340246e713f73f. If +the Xft DPI settings are not explicitly set, use the values provided by +the X server rather than hard-coding the fallback value of 96. + +While an auto-configured Xorg already reports 96, this value can be +overriden by the user, and we should respect the user choice in this +case. There is no need to require them to set the same value in +different places (the Xorg DPI settings and Xft.dpi). +--- + gdk/x11/gdkxftdefaults.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gdk/x11/gdkxftdefaults.c b/gdk/x11/gdkxftdefaults.c +index fa1cfde2ec..c462b78c4b 100644 +--- a/gdk/x11/gdkxftdefaults.c ++++ b/gdk/x11/gdkxftdefaults.c +@@ -174,7 +174,8 @@ init_xft_settings (GdkScreen *screen) + x11_screen->xft_rgba = FC_RGBA_UNKNOWN; + + if (!get_double_default (xdisplay, "dpi", &dpi_double)) +- dpi_double = 96.0; ++ dpi_double = (DisplayHeight(xdisplay, x11_screen->screen_num)*25.4)/ ++ DisplayHeightMM(xdisplay, x11_screen->screen_num); + + x11_screen->xft_dpi = (int)(0.5 + PANGO_SCALE * dpi_double); + } +-- +2.11.0.616.gd72966cf44.dirty + diff --git a/nixpkgs/pkgs/development/libraries/gtk/patches/3.0-darwin-x11.patch b/nixpkgs/pkgs/development/libraries/gtk/patches/3.0-darwin-x11.patch new file mode 100644 index 000000000000..86631634b5bd --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gtk/patches/3.0-darwin-x11.patch @@ -0,0 +1,28 @@ +--- a/gdk/x11/gdkapplaunchcontext-x11.c ++++ b/gdk/x11/gdkapplaunchcontext-x11.c +@@ -27,7 +27,9 @@ + #include "gdkprivate-x11.h" + + #include <glib.h> ++#if defined(HAVE_GIO_UNIX) && !defined(__APPLE__) + #include <gio/gdesktopappinfo.h> ++#endif + + #include <string.h> + #include <unistd.h> +@@ -352,10 +354,15 @@ + else + workspace_str = NULL; + ++#if defined(HAVE_GIO_UNIX) && !defined(__APPLE__) + if (G_IS_DESKTOP_APP_INFO (info)) + application_id = g_desktop_app_info_get_filename (G_DESKTOP_APP_INFO (info)); + else + application_id = NULL; ++#else ++ application_id = NULL; ++#warning Please add support for creating AppInfo from id for your OS ++#endif + + startup_id = g_strdup_printf ("%s-%lu-%s-%s-%d_TIME%lu", + g_get_prgname (), diff --git a/nixpkgs/pkgs/development/libraries/gtk/patches/3.0-immodules.cache.patch b/nixpkgs/pkgs/development/libraries/gtk/patches/3.0-immodules.cache.patch new file mode 100644 index 000000000000..bbe5f28dbd3e --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gtk/patches/3.0-immodules.cache.patch @@ -0,0 +1,27 @@ +--- a/gtk/deprecated/gtkrc.c 2016-04-02 18:43:08.401663112 +0900 ++++ b/gtk/deprecated/gtkrc.c 2016-04-02 18:29:19.927608592 +0900 +@@ -774,5 +774,23 @@ + if (var) + result = g_strdup (var); + ++ // check NIX_PROFILES paths. ++ const gchar *nixProfilesEnv = g_getenv ("NIX_PROFILES"); ++ gchar *cachePath; ++ guint i; ++ ++ if(nixProfilesEnv && !result){ ++ gchar **paths = g_strsplit(nixProfilesEnv, " ", -1); ++ for (i = 0; paths[i] != NULL; i++){ ++ cachePath = g_build_filename(paths[i], "etc", "gtk-3.0", "immodules.cache", NULL); ++ if( g_file_test( cachePath, G_FILE_TEST_EXISTS) ){ ++ if(result) g_free(result); ++ result = g_strdup(cachePath); ++ } ++ g_free(cachePath); ++ } ++ g_strfreev(paths); ++ } ++ + if (!result) + { + diff --git a/nixpkgs/pkgs/development/libraries/gtk/patches/gtk2-theme-paths.patch b/nixpkgs/pkgs/development/libraries/gtk/patches/gtk2-theme-paths.patch new file mode 100644 index 000000000000..edd69b078076 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gtk/patches/gtk2-theme-paths.patch @@ -0,0 +1,40 @@ +Subject: [PATCHv2] gtk: Patch GTK+ to look for themes in profiles. +To: guix-devel@gnu.org +Date: Sun, 13 Mar 2016 15:17:37 +1100 +Url: https://lists.gnu.org/archive/html/guix-devel/2016-03/msg00492.html + +diff -Naur gtk+-2.24.28.new/gtk/gtkrc.c gtk+-2.24.28/gtk/gtkrc.c +--- gtk+-2.24.28.new/gtk/gtkrc.c 2016-03-13 10:31:14.413644362 +1100 ++++ gtk+-2.24.28/gtk/gtkrc.c 2016-03-13 12:51:34.723398423 +1100 +@@ -808,6 +808,8 @@ + gchar *path = NULL; + const gchar *home_dir; + gchar *subpath; ++ const gchar * const *xdg_data_dirs; ++ gint i; + + if (type) + subpath = g_strconcat ("gtk-2.0-", type, +@@ -830,6 +832,22 @@ + } + + if (!path) ++ { ++ xdg_data_dirs = g_get_system_data_dirs (); ++ for (i = 0; xdg_data_dirs[i]; i++) ++ { ++ path = g_build_filename (xdg_data_dirs[i], "themes", name, subpath, NULL); ++ if (g_file_test (path, G_FILE_TEST_EXISTS)) ++ break; ++ else ++ { ++ g_free (path); ++ path = NULL; ++ } ++ } ++ } ++ ++ if (!path) + { + gchar *theme_dir = gtk_rc_get_theme_dir (); + path = g_build_filename (theme_dir, name, subpath, NULL); |