summary refs log tree commit diff
path: root/pkgs/applications/graphics/glimpse/default.nix
blob: 01271f53b5722a492e8ec922d3f06971d3a4e1a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
{ stdenv
, lib
, fetchFromGitHub
, substituteAll
, pkg-config
, intltool
, babl
, gegl
, gtk2
, glib
, gdk-pixbuf
, isocodes
, pango
, cairo
, freetype
, fontconfig
, lcms
, libpng
, libjpeg
, poppler
, poppler_data
, libtiff
, libmng
, librsvg
, libwmf
, zlib
, libzip
, ghostscript
, aalib
, shared-mime-info
, python2
, libexif
, gettext
, xorg
, glib-networking
, libmypaint
, gexiv2
, harfbuzz
, mypaint-brushes1
, libwebp
, libheif
, libgudev
, openexr
, AppKit
, Cocoa
, gtk-mac-integration-gtk2
, libxslt
, automake
, autoconf
, libtool
, makeWrapper
, autoreconfHook
, gtk-doc
, graphviz
}:
let
  python = python2.withPackages (pp: [ pp.pygtk ]);
in
stdenv.mkDerivation rec {
  pname = "glimpse";
  version = "0.2.0";

  outputs = [ "out" "dev" ];

  src = fetchFromGitHub {
    owner = "glimpse-editor";
    repo = "Glimpse";
    rev = "v${version}";
    sha256 = "sha256-qbZQmAo7fuJWWbn0QTyxAwAenZOdsGueUq5/3IV8Njc=";
  };

  patches = [
    # to remove compiler from the runtime closure, reference was retained via
    # gimp --version --verbose output
    (substituteAll {
      src = ./remove-cc-reference.patch;
      cc_version = stdenv.cc.cc.name;
    })
    ../gimp/hardcode-plugin-interpreters.patch
  ];

  postPatch = ''
    ln -s ${gtk-doc}/share/gtk-doc/data/gtk-doc.make .
  '';

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
    intltool
    gettext
    automake
    autoconf
    makeWrapper
    gtk-doc
    libxslt
    libtool
  ];

  buildInputs = [
    babl
    gegl
    gtk2
    glib
    gdk-pixbuf
    pango
    cairo
    gexiv2
    harfbuzz
    isocodes
    freetype
    fontconfig
    lcms
    libpng
    libjpeg
    poppler
    poppler_data
    libtiff
    openexr
    libmng
    librsvg
    libwmf
    zlib
    libzip
    ghostscript
    aalib
    shared-mime-info
    libwebp
    libheif
    python
    libexif
    xorg.libXpm
    glib-networking
    libmypaint
    mypaint-brushes1
  ] ++ lib.optionals stdenv.isDarwin [
    AppKit
    Cocoa
    gtk-mac-integration-gtk2
  ] ++ lib.optionals stdenv.isLinux [
    libgudev
  ];

  # needed by gimp-2.0.pc
  propagatedBuildInputs = [
    gegl
  ];

  # Check if librsvg was built with --disable-pixbuf-loader.
  PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = "${librsvg}/${gdk-pixbuf.moduleDir}";

  preAutoreconf = ''
    # The check runs before glib-networking is registered
    export GIO_EXTRA_MODULES="${glib-networking}/lib/gio/modules:$GIO_EXTRA_MODULES"
  '';

  postFixup = ''
    wrapProgram $out/bin/glimpse-${lib.versions.majorMinor version} \
      --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
      --prefix PATH ":" ${ lib.makeBinPath [ graphviz ] }
  '';

  passthru = rec {
    # The declarations for `glimpse-with-plugins` wrapper,
    # used for determining plug-in installation paths
    majorVersion = "2.0";
    targetPluginDir = "lib/glimpse/${majorVersion}/plug-ins";
    targetScriptDir = "share/glimpse/${majorVersion}/scripts";
    targetDataDir = "share/gimp/${majorVersion}";
    targetLibDir = "lib/gimp/${majorVersion}";

    # probably its a good idea to use the same gtk in plugins ?
    gtk = gtk2;
  };

  configureFlags = [
    "--without-webkit" # old version is required
    "--with-bug-report-url=https://github.com/NixOS/nixpkgs/issues/new"
    "--with-icc-directory=/run/current-system/sw/share/color/icc"
    # fix libdir in pc files (${exec_prefix} needs to be passed verbatim)
    "--libdir=\${exec_prefix}/lib"
  ];

  # on Darwin,
  # test-eevl.c:64:36: error: initializer element is not a compile-time constant
  doCheck = !stdenv.isDarwin;

  enableParallelBuilding = true;

  meta = with lib; {
    description = "An open source image editor based on the GNU Image Manipulation Program";
    longDescription = ''
      Glimpse is an open source image editor based on the GNU Image Manipulation Program (GIMP). The goal is to experiment with new ideas and expand the use of free software.
    '';
    homepage = "https://glimpse-editor.org";
    maintainers = with maintainers; [ ashkitten erictapen ];
    license = licenses.gpl3Plus;
    platforms = platforms.unix;
  };
}