gimp2: re-init at 2.10.38

Keep around for a while for legacy plug-in support.

Re-introducing it in a separate commit so that `gimp` expression retains continuous git history.
This commit is contained in:
Jan Tojnar 2025-03-27 23:21:38 +01:00
parent 79e6d159bf
commit 38a5039f8c
6 changed files with 290 additions and 1 deletions

View file

@ -62,7 +62,7 @@
- [testers.shellcheck](https://nixos.org/manual/nixpkgs/unstable/#tester-shellcheck) now warns when `name` is not provided. - [testers.shellcheck](https://nixos.org/manual/nixpkgs/unstable/#tester-shellcheck) now warns when `name` is not provided.
The `name` argument will become mandatory in a future release. The `name` argument will become mandatory in a future release.
- `gimp` has been upgraded to [GIMP 3.0](https://www.gimp.org/news/2025/03/16/gimp-3-0-released/). - `gimp` has been upgraded to [GIMP 3.0](https://www.gimp.org/news/2025/03/16/gimp-3-0-released/). Most plug-ins are not compatible so the old version has been preserved as `gimp2`, `gimp2Plugins` and `gimp2-with-plugins`.
- `grafana-agent` and `services.grafana-agent` have been removed in favor of - `grafana-agent` and `services.grafana-agent` have been removed in favor of
Grafana Alloy (`grafana-alloy` and `services.alloy`), as they depend on an EOL compiler version Grafana Alloy (`grafana-alloy` and `services.alloy`), as they depend on an EOL compiler version

View file

@ -0,0 +1,226 @@
{
stdenv,
lib,
fetchurl,
replaceVars,
autoreconfHook,
pkg-config,
intltool,
babl,
gegl,
gtk2,
glib,
gdk-pixbuf,
isocodes,
pango,
cairo,
freetype,
fontconfig,
lcms,
libpng,
libjpeg,
libjxl,
poppler,
poppler_data,
libtiff,
libmng,
librsvg,
libwmf,
zlib,
libzip,
ghostscript,
aalib,
shared-mime-info,
libexif,
gettext,
makeWrapper,
gtk-doc,
xorg,
glib-networking,
libmypaint,
gexiv2,
harfbuzz,
mypaint-brushes1,
libwebp,
libheif,
libxslt,
libgudev,
openexr,
desktopToDarwinBundle,
AppKit,
Cocoa,
gtk-mac-integration-gtk2,
withPython ? false,
python2,
}:
let
python = python2.withPackages (pp: [ pp.pygtk ]);
in
stdenv.mkDerivation (finalAttrs: {
pname = "gimp";
version = "2.10.38";
outputs = [
"out"
"dev"
];
src = fetchurl {
url = "http://download.gimp.org/pub/gimp/v${lib.versions.majorMinor finalAttrs.version}/gimp-${finalAttrs.version}.tar.bz2";
sha256 = "sha256-UKhF7sEciDH+hmFweVD1uERuNfMO37ms+Y+FwRM/hW4=";
};
patches = [
# to remove compiler from the runtime closure, reference was retained via
# gimp --version --verbose output
(replaceVars ./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
# GIMP queries libheif.pc for builtin encoder/decoder support to determine if AVIF/HEIC files are supported
# (see https://gitlab.gnome.org/GNOME/gimp/-/blob/a8b1173ca441283971ee48f4778e2ffd1cca7284/configure.ac?page=2#L1846-1852)
# These variables have been removed since libheif 1.18.0
# (see https://github.com/strukturag/libheif/commit/cf0d89c6e0809427427583290547a7757428cf5a)
# This has already been fixed for the upcoming GIMP 3, but the fix has not been backported to 2.x yet
# (see https://gitlab.gnome.org/GNOME/gimp/-/issues/9080)
./force-enable-libheif.patch
];
nativeBuildInputs =
[
autoreconfHook # hardcode-plugin-interpreters.patch changes Makefile.am
pkg-config
intltool
gettext
makeWrapper
gtk-doc
libxslt
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
desktopToDarwinBundle
];
buildInputs =
[
babl
gegl
gtk2
glib
gdk-pixbuf
pango
cairo
gexiv2
harfbuzz
isocodes
freetype
fontconfig
lcms
libpng
libjpeg
libjxl
poppler
poppler_data
libtiff
openexr
libmng
librsvg
libwmf
zlib
libzip
ghostscript
aalib
shared-mime-info
libwebp
libheif
libexif
xorg.libXpm
glib-networking
libmypaint
mypaint-brushes1
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
AppKit
Cocoa
gtk-mac-integration-gtk2
]
++ lib.optionals stdenv.hostPlatform.isLinux [
libgudev
]
++ lib.optionals withPython [
python
# Duplicated here because python.withPackages does not expose the dev output with pkg-config files
python2.pkgs.pygtk
];
# 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"
]
++ lib.optionals (!withPython) [
"--disable-python" # depends on Python2 which was EOLed on 2020-01-01
];
enableParallelBuilding = true;
doCheck = true;
env = {
NIX_CFLAGS_COMPILE = toString (
[ ]
++ lib.optionals stdenv.cc.isGNU [ "-Wno-error=incompatible-pointer-types" ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ "-DGDK_OSX_BIG_SUR=16" ]
);
# 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 finalAttrs.version} \
--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
'';
passthru = {
# The declarations for `gimp-with-plugins` wrapper,
# used for determining plug-in installation paths
majorVersion = "${lib.versions.major finalAttrs.version}.0";
targetLibDir = "lib/gimp/${finalAttrs.passthru.majorVersion}";
targetDataDir = "share/gimp/${finalAttrs.passthru.majorVersion}";
targetPluginDir = "${finalAttrs.passthru.targetLibDir}/plug-ins";
targetScriptDir = "${finalAttrs.passthru.targetDataDir}/scripts";
# probably its a good idea to use the same gtk in plugins ?
gtk = gtk2;
python2Support = withPython;
};
meta = with lib; {
description = "GNU Image Manipulation Program";
homepage = "https://www.gimp.org/";
maintainers = with maintainers; [ jtojnar ];
license = licenses.gpl3Plus;
platforms = platforms.unix;
mainProgram = "gimp";
};
})

View file

@ -0,0 +1,22 @@
diff --git a/configure.ac b/configure.ac
index 48c3c77892..3189781817 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1843,13 +1843,13 @@ can_export_heic=no
can_import_avif=no
can_export_avif=no
if test "x$have_libheif" = xyes; then
- can_import_heic=`$PKG_CONFIG --variable=builtin_h265_decoder libheif`
- can_export_heic=`$PKG_CONFIG --variable=builtin_h265_encoder libheif`
+ can_import_heic=yes
+ can_export_heic=yes
if test "x$can_import_heic" = xyes; then
MIME_TYPES="$MIME_TYPES;image/heif;image/heic"
fi
- can_import_avif=`$PKG_CONFIG --variable=builtin_avif_decoder libheif`
- can_export_avif=`$PKG_CONFIG --variable=builtin_avif_encoder libheif`
+ can_import_avif=yes
+ can_export_avif=yes
if test "x$can_import_avif" = xyes; then
MIME_TYPES="$MIME_TYPES;image/avif"
fi

View file

@ -0,0 +1,11 @@
--- a/plug-ins/pygimp/Makefile.am
+++ b/plug-ins/pygimp/Makefile.am
@@ -157,7 +157,7 @@ install-interp-file:
echo 'python=$(PYBIN_PATH)' > '$(DESTDIR)$(pyinterpfile)'
echo 'python2=$(PYBIN_PATH)' >> '$(DESTDIR)$(pyinterpfile)'
echo '/usr/bin/python=$(PYBIN_PATH)' >> '$(DESTDIR)$(pyinterpfile)'
- echo ":Python:E::py::`basename $(PYTHON)`:" >> '$(DESTDIR)$(pyinterpfile)'
+ echo ":Python:E::py::$(PYTHON):" >> '$(DESTDIR)$(pyinterpfile)'
install-data-local: install-env-file install-interp-file

View file

@ -0,0 +1,13 @@
diff --git a/app/gimp-version.c b/app/gimp-version.c
index 3d1894a036..48bb670b64 100644
--- a/app/gimp-version.c
+++ b/app/gimp-version.c
@@ -230,7 +230,7 @@ gimp_version (gboolean be_verbose,
GIMP_BUILD_ID,
gimp_version_get_revision (),
GIMP_BUILD_PLATFORM_FAMILY,
- CC_VERSION,
+ "@cc_version@",
lib_versions);
g_free (lib_versions);

View file

@ -14554,6 +14554,23 @@ with pkgs;
gimpPlugins = recurseIntoAttrs (callPackage ../applications/graphics/gimp/plugins { }); gimpPlugins = recurseIntoAttrs (callPackage ../applications/graphics/gimp/plugins { });
gimp2 = callPackage ../applications/graphics/gimp/2.0 {
autoreconfHook = buildPackages.autoreconfHook269;
lcms = lcms2;
inherit (darwin.apple_sdk.frameworks) AppKit Cocoa;
};
gimp2-with-plugins = callPackage ../applications/graphics/gimp/wrapper.nix {
gimpPlugins = gimp2Plugins;
plugins = null; # All packaged plugins enabled, if not explicit plugin list supplied
};
gimp2Plugins = recurseIntoAttrs (
callPackage ../applications/graphics/gimp/plugins {
gimp = gimp2;
}
);
girara = callPackage ../applications/misc/girara { girara = callPackage ../applications/misc/girara {
gtk = gtk3; gtk = gtk3;
}; };