12 , gobject-introspection
27 , gdktarget ? if stdenv.isDarwin then "quartz" else "x11"
28 , cupsSupport ? config.gtk2.cups or stdenv.isLinux
29 , xineramaSupport ? stdenv.isLinux
33 gtkCleanImmodulesCache = substituteAll {
34 src = ./hooks/clean-immodules-cache.sh;
35 gtk_module_path = "gtk-2.0";
36 gtk_binary_version = "2.10.0";
39 stdenv.mkDerivation (finalAttrs: {
44 url = "mirror://gnome/sources/gtk+/2.24/gtk+-${finalAttrs.version}.tar.xz";
45 hash = "sha256-rCrHV/WULTGKMRpUsMgLXvKV8pnCpzxjL2v7H/Scxto=";
48 outputs = [ "out" "dev" "devdoc" ];
52 ./hooks/drop-icon-theme-cache.sh
53 gtkCleanImmodulesCache
56 nativeBuildInputs = finalAttrs.setupHooks ++ [
64 ./patches/2.0-immodules.cache.patch
65 ./patches/gtk2-theme-paths.patch
66 ] ++ lib.optionals stdenv.isDarwin [
67 ./patches/2.0-gnome_bugzilla_557780_306776_freeciv_darwin.patch
68 ./patches/2.0-darwin-x11.patch
69 # Fixes an incompatible function pointer conversion and implicit int errors with clang 16.
70 ./patches/2.0-clang.patch
73 propagatedBuildInputs = [
79 ] ++ lib.optionals (stdenv.isLinux || stdenv.isDarwin) [
85 ] ++ lib.optional xineramaSupport libXinerama
86 ++ lib.optional cupsSupport cups
87 ++ lib.optionals stdenv.isDarwin [
94 lib.optionalString (stdenv.isDarwin
96 stdenv.hostPlatform.darwinMinVersion "11")
97 "MACOSX_DEPLOYMENT_TARGET=10.16";
101 "--with-gdktarget=${gdktarget}"
103 ] ++ lib.optionals stdenv.isDarwin [
105 "--disable-introspection"
106 "--disable-visibility"
107 ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
108 "ac_cv_path_GTK_UPDATE_ICON_CACHE=${buildPackages.gtk2}/bin/gtk-update-icon-cache"
109 "ac_cv_path_GDK_PIXBUF_CSOURCE=${buildPackages.gdk-pixbuf.dev}/bin/gdk-pixbuf-csource"
112 enableParallelBuilding = true;
115 "sysconfdir=${placeholder "out"}/etc"
118 doCheck = false; # needs X11
121 moveToOutput share/gtk-2.0/demo "$devdoc"
122 # The updater is needed for nixos env and it's tiny.
123 moveToOutput bin/gtk-update-icon-cache "$out"
127 gtkExeEnvPostBuild = ''
128 rm $out/lib/gtk-2.0/2.10.0/immodules.cache
129 $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
130 ''; # workaround for bug of nix-mode for Emacs */ '';
132 tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
136 homepage = "https://www.gtk.org/";
137 description = "A multi-platform toolkit for creating graphical user interfaces";
139 GTK is a highly usable, feature rich toolkit for creating graphical user
140 interfaces which boasts cross platform compatibility and an easy to use
141 API. GTK it is written in C, but has bindings to many other popular
142 programming languages such as C++, Python and C# among others. GTK is
143 licensed under the GNU LGPL 2.1 allowing development of both free and
144 proprietary software with GTK without any license fees or royalties.
146 changelog = "https://gitlab.gnome.org/GNOME/gtk/-/raw/${finalAttrs.version}/NEWS";
147 license = lib.licenses.lgpl2Plus;
148 maintainers = with lib.maintainers; [ lovek323 raskin ];
149 platforms = lib.platforms.all;
153 ] ++ lib.optionals (gdktarget == "x11") [