nixpkgs-suyu/pkgs/applications/graphics/gimp/default.nix
Jan Tojnar 39bc2f7abe
gimp: Fix crash without dot
GEGL 0.4.28 started marking introspect action as unavailable when dot is not present.
But GIMP previously required the action to be present at startup, even though it was only ever used in dev builds.
Let’s apply an upstream patch that removes this strict requirement.
2021-03-18 22:18:51 +01:00

189 lines
4 KiB
Nix

{ stdenv
, lib
, fetchurl
, fetchpatch
, substituteAll
, autoreconfHook
, 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
, makeWrapper
, xorg
, glib-networking
, libmypaint
, gexiv2
, harfbuzz
, mypaint-brushes1
, libwebp
, libheif
, libgudev
, openexr
, AppKit
, Cocoa
, gtk-mac-integration-gtk2
}:
let
python = python2.withPackages (pp: [ pp.pygtk ]);
in stdenv.mkDerivation rec {
pname = "gimp";
version = "2.10.22";
outputs = [ "out" "dev" ];
src = fetchurl {
url = "http://download.gimp.org/pub/gimp/v${lib.versions.majorMinor version}/${pname}-${version}.tar.bz2";
sha256 = "1fqqyshakvdarf1jipk2n33ibqr23ni22z3d8srq13bpydblpf1d";
};
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;
})
# Use absolute paths instead of relying on PATH
# to make sure plug-ins are loaded by the correct interpreter.
./hardcode-plugin-interpreters.patch
# Fix crash without dot.
(fetchpatch {
url = "https://gitlab.gnome.org/GNOME/gimp/-/commit/f83fd22c4b8701ffc4ce14383e5e22756a4bce04.patch";
sha256 = "POuvBhOSStO7hBGp4HgNx5F9pElFRoqN3W+i3u4zOnk=";
})
];
nativeBuildInputs = [
autoreconfHook # hardcode-plugin-interpreters.patch changes Makefile.am
pkg-config
intltool
gettext
makeWrapper
];
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
];
configureFlags = [
"--without-webkit" # old version is required
"--disable-check-update"
"--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"
];
enableParallelBuilding = true;
# on Darwin,
# test-eevl.c:64:36: error: initializer element is not a compile-time constant
doCheck = !stdenv.isDarwin;
# Check if librsvg was built with --disable-pixbuf-loader.
PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = "${librsvg}/${gdk-pixbuf.moduleDir}";
preConfigure = ''
# The check runs before glib-networking is registered
export GIO_EXTRA_MODULES="${glib-networking}/lib/gio/modules:$GIO_EXTRA_MODULES"
'';
postFixup = ''
wrapProgram $out/bin/gimp-${lib.versions.majorMinor version} \
--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
'';
passthru = rec {
# The declarations for `gimp-with-plugins` wrapper,
# used for determining plug-in installation paths
majorVersion = "${lib.versions.major version}.0";
targetLibDir = "lib/gimp/${majorVersion}";
targetDataDir = "share/gimp/${majorVersion}";
targetPluginDir = "${targetLibDir}/plug-ins";
targetScriptDir = "${targetDataDir}/scripts";
# probably its a good idea to use the same gtk in plugins ?
gtk = gtk2;
};
meta = with lib; {
description = "The GNU Image Manipulation Program";
homepage = "https://www.gimp.org/";
maintainers = with maintainers; [ jtojnar ];
license = licenses.gpl3Plus;
platforms = platforms.unix;
};
}