2023-07-15 17:15:38 +00:00
|
|
|
{ config
|
|
|
|
, lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, atk
|
|
|
|
, buildPackages
|
|
|
|
, cairo
|
|
|
|
, cups
|
|
|
|
, gdk-pixbuf
|
|
|
|
, gettext
|
|
|
|
, glib
|
|
|
|
, gobject-introspection
|
|
|
|
, libXcomposite
|
|
|
|
, libXcursor
|
|
|
|
, libXdamage
|
|
|
|
, libXi
|
|
|
|
, libXinerama
|
|
|
|
, libXrandr
|
|
|
|
, libXrender
|
|
|
|
, pango
|
|
|
|
, perl
|
|
|
|
, pkg-config
|
|
|
|
, substituteAll
|
2023-02-16 17:41:37 +00:00
|
|
|
, testers
|
2023-07-15 17:15:38 +00:00
|
|
|
, AppKit
|
|
|
|
, Cocoa
|
|
|
|
, gdktarget ? if stdenv.isDarwin then "quartz" else "x11"
|
|
|
|
, cupsSupport ? config.gtk2.cups or stdenv.isLinux
|
|
|
|
, xineramaSupport ? stdenv.isLinux
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
let
|
|
|
|
gtkCleanImmodulesCache = substituteAll {
|
|
|
|
src = ./hooks/clean-immodules-cache.sh;
|
|
|
|
gtk_module_path = "gtk-2.0";
|
|
|
|
gtk_binary_version = "2.10.0";
|
|
|
|
};
|
|
|
|
in
|
2023-02-16 17:41:37 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-11-19 00:13:47 +00:00
|
|
|
pname = "gtk+";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "2.24.33";
|
2020-10-20 17:27:49 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchurl {
|
2023-07-15 17:15:38 +00:00
|
|
|
url = "mirror://gnome/sources/gtk+/2.24/gtk+-${finalAttrs.version}.tar.xz";
|
|
|
|
hash = "sha256-rCrHV/WULTGKMRpUsMgLXvKV8pnCpzxjL2v7H/Scxto=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" "devdoc" ];
|
|
|
|
outputBin = "dev";
|
|
|
|
|
|
|
|
setupHooks = [
|
|
|
|
./hooks/drop-icon-theme-cache.sh
|
2021-03-19 17:17:44 +00:00
|
|
|
gtkCleanImmodulesCache
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
nativeBuildInputs = finalAttrs.setupHooks ++ [
|
2023-07-15 17:15:38 +00:00
|
|
|
gettext
|
|
|
|
gobject-introspection
|
|
|
|
perl
|
|
|
|
pkg-config
|
2023-02-16 17:41:37 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
./patches/2.0-immodules.cache.patch
|
|
|
|
./patches/gtk2-theme-paths.patch
|
2023-02-02 18:25:31 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2023-04-29 16:46:19 +00:00
|
|
|
./patches/2.0-gnome_bugzilla_557780_306776_freeciv_darwin.patch
|
2020-04-24 23:36:52 +00:00
|
|
|
./patches/2.0-darwin-x11.patch
|
2023-11-16 04:20:00 +00:00
|
|
|
# Fixes an incompatible function pointer conversion and implicit int errors with clang 16.
|
|
|
|
./patches/2.0-clang.patch
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
atk
|
|
|
|
cairo
|
|
|
|
gdk-pixbuf
|
|
|
|
glib
|
|
|
|
pango
|
|
|
|
] ++ lib.optionals (stdenv.isLinux || stdenv.isDarwin) [
|
|
|
|
libXcomposite
|
|
|
|
libXcursor
|
|
|
|
libXi
|
|
|
|
libXrandr
|
|
|
|
libXrender
|
|
|
|
] ++ lib.optional xineramaSupport libXinerama
|
|
|
|
++ lib.optional cupsSupport cups
|
|
|
|
++ lib.optionals stdenv.isDarwin [
|
|
|
|
libXdamage
|
|
|
|
AppKit
|
|
|
|
Cocoa
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
preConfigure =
|
|
|
|
lib.optionalString (stdenv.isDarwin
|
|
|
|
&& lib.versionAtLeast
|
|
|
|
stdenv.hostPlatform.darwinMinVersion "11")
|
|
|
|
"MACOSX_DEPLOYMENT_TARGET=10.16";
|
2021-05-28 09:39:13 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
configureFlags = [
|
2023-03-27 19:17:25 +00:00
|
|
|
"--sysconfdir=/etc"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-gdktarget=${gdktarget}"
|
|
|
|
"--with-xinput=yes"
|
2023-02-02 18:25:31 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2020-04-24 23:36:52 +00:00
|
|
|
"--disable-glibtest"
|
|
|
|
"--disable-introspection"
|
|
|
|
"--disable-visibility"
|
2021-12-19 01:06:50 +00:00
|
|
|
] ++ 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"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2023-03-27 19:17:25 +00:00
|
|
|
installFlags = [
|
|
|
|
"sysconfdir=${placeholder "out"}/etc"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
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;
|
2023-02-16 17:41:37 +00:00
|
|
|
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
meta = {
|
|
|
|
homepage = "https://www.gtk.org/";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A multi-platform toolkit for creating graphical user interfaces";
|
2023-07-15 17:15:38 +00:00
|
|
|
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/${finalAttrs.version}/NEWS";
|
|
|
|
license = lib.licenses.lgpl2Plus;
|
|
|
|
maintainers = with lib.maintainers; [ lovek323 raskin ];
|
|
|
|
platforms = lib.platforms.all;
|
2023-02-16 17:41:37 +00:00
|
|
|
pkgConfigModules = [
|
|
|
|
"gdk-2.0"
|
|
|
|
"gtk+-2.0"
|
|
|
|
] ++ lib.optionals (gdktarget == "x11") [
|
|
|
|
"gdk-x11-2.0"
|
|
|
|
"gtk+-x11-2.0"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-02-16 17:41:37 +00:00
|
|
|
})
|