lol
1{ stdenv, fetchurl, pkgconfig, gettext, perl
2, expat, glib, cairo, pango, gdk_pixbuf, atk, at_spi2_atk, gobjectIntrospection
3, xlibs, x11, wayland, libxkbcommon, epoxy
4, xineramaSupport ? stdenv.isLinux
5, cupsSupport ? stdenv.isLinux, cups ? null
6}:
7
8assert xineramaSupport -> xlibs.libXinerama != null;
9assert cupsSupport -> cups != null;
10
11let
12 ver_maj = "3.16";
13 ver_min = "6";
14 version = "${ver_maj}.${ver_min}";
15in
16stdenv.mkDerivation rec {
17 name = "gtk+3-${version}";
18
19 src = fetchurl {
20 url = "mirror://gnome/sources/gtk+/${ver_maj}/gtk+-${version}.tar.xz";
21 sha256 = "1gpzlnfrifc17yfk0zki6b2vmsfpf5cmrbh232s6iaan11np44jd";
22 };
23
24 nativeBuildInputs = [ pkgconfig gettext gobjectIntrospection perl ];
25
26 buildInputs = [ libxkbcommon epoxy ];
27 propagatedBuildInputs = with xlibs; with stdenv.lib;
28 [ expat glib cairo pango gdk_pixbuf atk at_spi2_atk libXrandr libXrender libXcomposite libXi libXcursor ]
29 ++ optionals stdenv.isLinux [ wayland ]
30 ++ optional xineramaSupport libXinerama
31 ++ optional cupsSupport cups;
32
33 NIX_LDFLAGS = if stdenv.isDarwin then "-lintl" else null;
34
35 # demos fail to install, no idea where's the problem
36 preConfigure = "sed '/^SRC_SUBDIRS /s/demos//' -i Makefile.in";
37
38 enableParallelBuilding = true;
39
40 postInstall = "rm -rf $out/share/gtk-doc";
41
42 passthru = {
43 gtkExeEnvPostBuild = ''
44 rm $out/lib/gtk-3.0/3.0.0/immodules.cache
45 $out/bin/gtk-query-immodules-3.0 $out/lib/gtk-3.0/3.0.0/immodules/*.so > $out/lib/gtk-3.0/3.0.0/immodules.cache
46 ''; # workaround for bug of nix-mode for Emacs */ '';
47 };
48
49 meta = {
50 description = "A multi-platform toolkit for creating graphical user interfaces";
51
52 longDescription = ''
53 GTK+ is a highly usable, feature rich toolkit for creating
54 graphical user interfaces which boasts cross platform
55 compatibility and an easy to use API. GTK+ it is written in C,
56 but has bindings to many other popular programming languages
57 such as C++, Python and C# among others. GTK+ is licensed
58 under the GNU LGPL 2.1 allowing development of both free and
59 proprietary software with GTK+ without any license fees or
60 royalties.
61 '';
62
63 homepage = http://www.gtk.org/;
64
65 license = stdenv.lib.licenses.lgpl2Plus;
66
67 maintainers = with stdenv.lib.maintainers; [ urkud raskin vcunat lethalman ];
68 platforms = stdenv.lib.platforms.all;
69 };
70}