gimp: 2.99.14-unstable-2023-03-17 → 3.0.0-RC1

https://www.gimp.org/news/2023/07/09/gimp-2-99-16-released/
https://www.gimp.org/news/2024/02/21/gimp-2-99-18-released/
https://www.gimp.org/news/2024/11/06/gimp-3-0-RC1-released/
ad7a2e53eb...GIMP_3_0_0_RC1

- gtk-mac-integration dependency removed df4ed9c1ec
- Python plug-in mandatory 93cc81281c
- Only Lua 5.1 is supported 7037297526
- Fixes gi-docgen and libjxl.

Had to add `adwaita-icon-theme` to `XDG_DATA_DIRS` at check time, or tests would fail:

    Gtk:ERROR:../gtk/gtkiconhelper.c:495:ensure_surface_for_gicon: assertion failed (error == NULL): Icon 'image-missing' not present in theme Default (gtk-icon-theme-error-quark, 0)

No longer builds on Darwin.

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
Jan Tojnar 2024-12-27 02:41:29 +01:00
parent d65529fcdf
commit 328415ccd6
6 changed files with 77 additions and 66 deletions

View file

@ -1,12 +1,14 @@
{ {
stdenv, stdenv,
lib, lib,
fetchFromGitLab, fetchurl,
fetchpatch,
replaceVars, replaceVars,
meson, meson,
ninja, ninja,
pkg-config, pkg-config,
babl, babl,
cfitsio,
gegl, gegl,
gtk3, gtk3,
glib, glib,
@ -21,6 +23,8 @@
fontconfig, fontconfig,
lcms, lcms,
libpng, libpng,
libiff,
libilbm,
libjpeg, libjpeg,
libjxl, libjxl,
poppler, poppler,
@ -41,6 +45,7 @@
libxslt, libxslt,
gobject-introspection, gobject-introspection,
vala, vala,
gi-docgen,
perl, perl,
appstream-glib, appstream-glib,
desktop-file-utils, desktop-file-utils,
@ -48,6 +53,7 @@
glib-networking, glib-networking,
json-glib, json-glib,
libmypaint, libmypaint,
llvmPackages,
gexiv2, gexiv2,
harfbuzz, harfbuzz,
mypaint-brushes1, mypaint-brushes1,
@ -63,8 +69,6 @@
desktopToDarwinBundle, desktopToDarwinBundle,
AppKit, AppKit,
Cocoa, Cocoa,
gtk-mac-integration-gtk3,
unstableGitUpdater,
}: }:
let let
@ -76,23 +80,17 @@ let
in in
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "gimp"; pname = "gimp";
version = "2.99.14-unstable-2023-03-17"; version = "3.0.0-RC1";
outputs = [ outputs = [
"out" "out"
"dev" "dev"
"devdoc"
]; ];
# We should not use fetchFromGitLab because the build system src = fetchurl {
# will complain and mark the build as unsupported when it cannot find url = "https://download.gimp.org/gimp/v${lib.versions.majorMinor finalAttrs.version}/gimp-${finalAttrs.version}.tar.xz";
# .git directory but downloading the whole repo is jus too much. hash = "sha256-s9CyZMXjjnifqvNBcAM5fzJAAUxZx/QX+co705xf+2Y=";
src = fetchFromGitLab rec {
name = "gimp-dev-${rev}"; # to make sure the hash is updated
domain = "gitlab.gnome.org";
owner = "GNOME";
repo = "gimp";
rev = "ad7a2e53eb72ef471566fa2d0ce9faeec929fbcf";
hash = "sha256-IJMUJc817EDWIRqqkCuwAcSw7gcgCkXxPan5fEq1AO0=";
}; };
patches = [ patches = [
@ -104,6 +102,7 @@ stdenv.mkDerivation (finalAttrs: {
# Use absolute paths instead of relying on PATH # Use absolute paths instead of relying on PATH
# to make sure plug-ins are loaded by the correct interpreter. # to make sure plug-ins are loaded by the correct interpreter.
# TODO: This now only appears to be used on Windows.
(replaceVars ./hardcode-plugin-interpreters.patch { (replaceVars ./hardcode-plugin-interpreters.patch {
python_interpreter = python.interpreter; python_interpreter = python.interpreter;
PYTHON_PATH = null; PYTHON_PATH = null;
@ -115,12 +114,12 @@ stdenv.mkDerivation (finalAttrs: {
session_conf = "${dbus.out}/share/dbus-1/session.conf"; session_conf = "${dbus.out}/share/dbus-1/session.conf";
}) })
# Since we pass absolute datadirs to Meson, the path is resolved incorrectly. # Fix pkg-config file.
# What is more, even the assumption that iso-codes have the same datadir # https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/2037
# subdirectory as GIMP is incorrect. Though, there is not a way to obtain (fetchpatch {
# the correct directory at the moment. There is a MR against isocodes to fix that: url = "https://gitlab.gnome.org/GNOME/gimp/-/commit/a18e1806dbc9b180aefabb2c0fae43493f1ef14a.patch";
# https://salsa.debian.org/iso-codes-team/iso-codes/merge_requests/11 hash = "sha256-BUrPm9lB/aiybB2Sd3TKlJ+59ITMZlNUBXJP5ZdLQ44=";
./fix-isocodes-paths.patch })
]; ];
nativeBuildInputs = nativeBuildInputs =
@ -135,6 +134,9 @@ stdenv.mkDerivation (finalAttrs: {
perl perl
vala vala
# for docs
gi-docgen
# for tests # for tests
desktop-file-utils desktop-file-utils
] ]
@ -150,6 +152,7 @@ stdenv.mkDerivation (finalAttrs: {
[ [
appstream-glib # for library appstream-glib # for library
babl babl
cfitsio
gegl gegl
gtk3 gtk3
glib glib
@ -164,6 +167,8 @@ stdenv.mkDerivation (finalAttrs: {
fontconfig fontconfig
lcms lcms
libpng libpng
libiff
libilbm
libjpeg libjpeg
libjxl libjxl
poppler poppler
@ -204,9 +209,9 @@ stdenv.mkDerivation (finalAttrs: {
gjs gjs
] ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ ++ lib.optionals stdenv.hostPlatform.isDarwin [
llvmPackages.openmp
AppKit AppKit
Cocoa Cocoa
gtk-mac-integration-gtk3
] ]
++ lib.optionals stdenv.hostPlatform.isLinux [ ++ lib.optionals stdenv.hostPlatform.isLinux [
libgudev libgudev
@ -215,6 +220,9 @@ stdenv.mkDerivation (finalAttrs: {
propagatedBuildInputs = [ propagatedBuildInputs = [
# needed by gimp-3.0.pc # needed by gimp-3.0.pc
gegl gegl
cairo
pango
gexiv2
]; ];
mesonFlags = mesonFlags =
@ -227,14 +235,10 @@ stdenv.mkDerivation (finalAttrs: {
(lib.mesonEnable "linux-input" stdenv.hostPlatform.isLinux) (lib.mesonEnable "linux-input" stdenv.hostPlatform.isLinux)
# Not very important to do downstream, save a dependency. # Not very important to do downstream, save a dependency.
"-Dappdata-test=disabled" "-Dappdata-test=disabled"
# Incompatible with version in nixpkgs
"-Djpeg-xl=disabled"
# Broken references
"-Dgi-docgen=disabled"
] ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ ++ lib.optionals stdenv.hostPlatform.isDarwin [
"-Dalsa=disabled" "-Dalsa=disabled"
"-Djavascript=false" "-Djavascript=disabled"
]; ];
doCheck = true; doCheck = true;
@ -243,11 +247,7 @@ stdenv.mkDerivation (finalAttrs: {
# The check runs before glib-networking is registered # The check runs before glib-networking is registered
GIO_EXTRA_MODULES = "${glib-networking}/lib/gio/modules"; GIO_EXTRA_MODULES = "${glib-networking}/lib/gio/modules";
NIX_CFLAGS_COMPILE = toString ( NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-DGDK_OSX_BIG_SUR=16";
[ ]
++ 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. # Check if librsvg was built with --disable-pixbuf-loader.
PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = "${librsvg}/${gdk-pixbuf.moduleDir}"; PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = "${librsvg}/${gdk-pixbuf.moduleDir}";
@ -258,11 +258,38 @@ stdenv.mkDerivation (finalAttrs: {
app/tests/create_test_env.sh \ app/tests/create_test_env.sh \
tools/gimp-mkenums tools/gimp-mkenums
# Bypass the need for downloading git archive. # GIMP is executed at build time so we need to fix this.
substitute app/git-version.h.in git-version.h \ # TODO: Look into if we can fix the interp thing.
--subst-var-by GIMP_GIT_VERSION "GIMP_2.99.?-g${builtins.substring 0 10 finalAttrs.src.rev}" \ chmod +x plug-ins/python/{colorxhtml,file-openraster,foggify,gradients-save-as-css,histogram-export,palette-offset,palette-sort,palette-to-gradient,python-eval,spyro-plus}.py
--subst-var-by GIMP_GIT_VERSION_ABBREV "${builtins.substring 0 10 finalAttrs.src.rev}" \ patchShebangs \
--subst-var-by GIMP_GIT_LAST_COMMIT_YEAR "${builtins.head (builtins.match ".+\-unstable-([0-9]{4})-[0-9]{2}-[0-9]{2}" finalAttrs.version)}" plug-ins/python/{colorxhtml,file-openraster,foggify,gradients-save-as-css,histogram-export,palette-offset,palette-sort,palette-to-gradient,python-eval,spyro-plus}.py
'';
preBuild =
let
librarySuffix =
if stdenv.hostPlatform.extensions.library == ".so" then
"3.0.so.0"
else if stdenv.hostPlatform.extensions.library == ".dylib" then
"3.0.0.dylib"
else
throw "Unsupported library extension ${stdenv.hostPlatform.extensions.library}";
in
''
# Our gobject-introspection patches make the shared library paths absolute
# in the GIR files. When running GIMP in build or check phase, it will try
# to use plug-ins, which import GIMP introspection files which will try
# to load the GIMP libraries which will not be installed yet.
# So we need to replace the absolute path with a local one.
# We are using a symlink that will be overridden during installation.
mkdir -p "$out/lib"
ln -s "$PWD/libgimp/libgimp-${librarySuffix}" \
"$PWD/libgimpbase/libgimpbase-${librarySuffix}" \
"$PWD/libgimpcolor/libgimpcolor-${librarySuffix}" \
"$PWD/libgimpconfig/libgimpconfig-${librarySuffix}" \
"$PWD/libgimpmath/libgimpmath-${librarySuffix}" \
"$PWD/libgimpmodule/libgimpmodule-${librarySuffix}" \
"$out/lib/"
''; '';
preCheck = '' preCheck = ''
@ -270,7 +297,7 @@ stdenv.mkDerivation (finalAttrs: {
export NO_AT_BRIDGE=1 export NO_AT_BRIDGE=1
# Fix storing recent file list in tests # Fix storing recent file list in tests
export HOME="$TMPDIR" export HOME="$TMPDIR"
export XDG_DATA_DIRS="${glib.getSchemaDataDirPath gtk3}:$XDG_DATA_DIRS" export XDG_DATA_DIRS="${glib.getSchemaDataDirPath gtk3}:${adwaita-icon-theme}/share:$XDG_DATA_DIRS"
''; '';
preFixup = '' preFixup = ''
@ -284,10 +311,15 @@ stdenv.mkDerivation (finalAttrs: {
}") }")
''; '';
postFixup = ''
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
moveToOutput "share/doc" "$devdoc"
'';
passthru = { passthru = {
# The declarations for `gimp-with-plugins` wrapper, # The declarations for `gimp-with-plugins` wrapper,
# used for determining plug-in installation paths # used for determining plug-in installation paths
majorVersion = "2.99"; majorVersion = "${lib.versions.major finalAttrs.version}.0";
targetLibDir = "lib/gimp/${finalAttrs.passthru.majorVersion}"; targetLibDir = "lib/gimp/${finalAttrs.passthru.majorVersion}";
targetDataDir = "share/gimp/${finalAttrs.passthru.majorVersion}"; targetDataDir = "share/gimp/${finalAttrs.passthru.majorVersion}";
targetPluginDir = "${finalAttrs.passthru.targetLibDir}/plug-ins"; targetPluginDir = "${finalAttrs.passthru.targetLibDir}/plug-ins";
@ -295,12 +327,6 @@ stdenv.mkDerivation (finalAttrs: {
# probably its a good idea to use the same gtk in plugins ? # probably its a good idea to use the same gtk in plugins ?
gtk = gtk3; gtk = gtk3;
updateScript = unstableGitUpdater {
stableVersion = true;
tagPrefix = "GIMP_";
tagConverter = "sed s/_/./g";
};
}; };
meta = with lib; { meta = with lib; {
@ -308,7 +334,7 @@ stdenv.mkDerivation (finalAttrs: {
homepage = "https://www.gimp.org/"; homepage = "https://www.gimp.org/";
maintainers = with maintainers; [ jtojnar ]; maintainers = with maintainers; [ jtojnar ];
license = licenses.gpl3Plus; license = licenses.gpl3Plus;
platforms = platforms.unix; platforms = platforms.linux;
mainProgram = "gimp"; mainProgram = "gimp";
}; };
}) })

View file

@ -1,15 +0,0 @@
diff --git a/meson.build b/meson.build
index 6a19df48a1..3fd77077c1 100644
--- a/meson.build
+++ b/meson.build
@@ -924,8 +924,8 @@ endif
isocodes = dependency('iso-codes', required: false)
if isocodes.found()
isocodes_prefix = isocodes.get_variable(pkgconfig: 'prefix')
- isocodes_location = isocodes_prefix / get_option('datadir') / 'xml' / 'iso-codes'
- isocodes_localedir= isocodes_prefix / get_option('datadir') / 'locale'
+ isocodes_location = isocodes_prefix / 'share' / 'xml' / 'iso-codes'
+ isocodes_localedir= isocodes_prefix / 'share' / 'locale'
endif
conf.set('HAVE_ISO_CODES', isocodes.found())

View file

@ -1,8 +1,8 @@
--- a/plug-ins/python/pygimp.interp.in --- a/plug-ins/python/pygimp.interp.in
+++ b/plug-ins/python/pygimp.interp.in +++ b/plug-ins/python/pygimp.interp.in
@@ -2,4 +2,4 @@ python=@PYTHON_PATH@ @@ -2,4 +2,4 @@ python=@PYTHON_PATH@
python3=@PYTHON_PATH@ python3=@PYTHON_PATH@python.exe
/usr/bin/python=@PYTHON_PATH@ /usr/bin/python=@PYTHON_PATH@python.exe
/usr/bin/python3=@PYTHON_PATH@ /usr/bin/python3=@PYTHON_PATH@python.exe
-:Python:E::py::python3: -:Python:E::py::python3:
+:Python:E::py::@python_interpreter@: +:Python:E::py::@python_interpreter@:

View file

@ -37,7 +37,7 @@ lib.makeScope pkgs.newScope (
attrs: attrs:
let let
name = attrs.name or "${attrs.pname}-${attrs.version}"; name = attrs.name or "${attrs.pname}-${attrs.version}";
pkgConfigMajorVersion = if gimp.majorVersion == "2.0" then "2" else "3"; pkgConfigMajorVersion = lib.versions.major gimp.version;
in in
stdenv.mkDerivation ( stdenv.mkDerivation (
{ {

View file

@ -20,7 +20,7 @@ let
]; ];
exeVersion = exeVersion =
if gimp.majorVersion == "2.0" then lib.versions.majorMinor gimp.version else gimp.majorVersion; if gimp.majorVersion == "2.0" then lib.versions.majorMinor gimp.version else gimp.majorVersion;
majorVersion = if gimp.majorVersion == "2.0" then "2" else "3"; majorVersion = lib.versions.major gimp.version;
in in
symlinkJoin { symlinkJoin {

View file

@ -103,7 +103,7 @@ stdenv.mkDerivation (finalAttrs: {
(lib.cmakeFeature "GMIC_QT_HOST" ( (lib.cmakeFeature "GMIC_QT_HOST" (
if variant == "standalone" then if variant == "standalone" then
"none" "none"
else if variant == "gimp" && gimp.majorVersion == "2.99" then else if variant == "gimp" && gimp.majorVersion == "3.0" then
"gimp3" "gimp3"
else else
variant variant