Jan Tojnar
2025-04-15 10:02:49 +02:00
co-authored by Linus Heckemann Sandro
parent bf0702f01b
commit 2eb19e227b
8 changed files with 207 additions and 92 deletions
+159 -56
View File
@@ -1,19 +1,23 @@
{
stdenv,
lib,
fetchurl,
fetchFromGitLab,
fetchpatch,
replaceVars,
autoreconfHook,
meson,
ninja,
pkg-config,
intltool,
babl,
gegl,
gtk2,
gtk3,
glib,
gdk-pixbuf,
graphviz,
isocodes,
pango,
cairo,
libarchive,
luajit,
freetype,
fontconfig,
lcms,
@@ -31,44 +35,65 @@
ghostscript,
aalib,
shared-mime-info,
python3,
libexif,
gettext,
makeWrapper,
gtk-doc,
wrapGAppsHook3,
libxslt,
gobject-introspection,
vala,
perl,
appstream-glib,
desktop-file-utils,
xorg,
glib-networking,
json-glib,
libmypaint,
gexiv2,
harfbuzz,
mypaint-brushes1,
libwebp,
libheif,
libxslt,
gjs,
libgudev,
openexr,
xvfb-run,
dbus,
adwaita-icon-theme,
alsa-lib,
desktopToDarwinBundle,
AppKit,
Cocoa,
gtk-mac-integration-gtk2,
withPython ? false,
python2,
gtk-mac-integration-gtk3,
unstableGitUpdater,
}:
let
python = python2.withPackages (pp: [ pp.pygtk ]);
python = python3.withPackages (
pp: with pp; [
pygobject3
]
);
in
stdenv.mkDerivation (finalAttrs: {
pname = "gimp";
version = "2.10.38";
version = "2.99.10-unstable-2022-06-28";
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=";
# We should not use fetchFromGitLab because the build system
# will complain and mark the build as unsupported when it cannot find
# .git directory but downloading the whole repo is jus too much.
src = fetchFromGitLab rec {
name = "gimp-dev-${rev}"; # to make sure the hash is updated
domain = "gitlab.gnome.org";
owner = "GNOME";
repo = "gimp";
rev = "256b2d9615af2ba6dfcfdc32cc34a437aee214b3";
hash = "sha256-ITL5nb8fka5Xj+6/JthGRTVVvTDd7LED49IuhZZNk4U=";
};
patches = [
@@ -80,26 +105,59 @@ stdenv.mkDerivation (finalAttrs: {
# Use absolute paths instead of relying on PATH
# to make sure plug-ins are loaded by the correct interpreter.
./hardcode-plugin-interpreters.patch
(replaceVars ./hardcode-plugin-interpreters.patch {
python_interpreter = python.interpreter;
PYTHON_PATH = null;
})
# 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
# D-Bus configuration is not available in the build sandbox
# so we need to pick up the one from the package.
(replaceVars ./tests-dbus-conf.patch {
session_conf = "${dbus.out}/share/dbus-1/session.conf";
})
# Since we pass absolute datadirs to Meson, the path is resolved incorrectly.
# What is more, even the assumption that iso-codes have the same datadir
# subdirectory as GIMP is incorrect. Though, there is not a way to obtain
# the correct directory at the moment. There is a MR against isocodes to fix that:
# https://salsa.debian.org/iso-codes-team/iso-codes/merge_requests/11
./fix-isocodes-paths.patch
# Skip broken dependency in Windows code.
# https://gitlab.gnome.org/GNOME/gimp/-/issues/7907
./skip-win.patch
# Make the babl-0.1 patch apply
(fetchpatch {
url = "https://gitlab.gnome.org/GNOME/gimp/-/commit/06b481a3ecf49563050935ad0e965a664648e450.patch";
hash = "sha256-mlYj29m1Ay9FFOCTAv01ipiK8VTdjh+Es4fnhBR/Vzs=";
})
# Fix compatibility with babl-0.1
(fetchpatch {
url = "https://gitlab.gnome.org/GNOME/gimp/-/commit/04a78154e1af5e30dcedde6dbaa321be3f0e24b1.patch";
hash = "sha256-oSfkTPJb4ai8z3o7QHgrNzwJEtJj04R9mKufXxGNWU8=";
})
];
nativeBuildInputs =
[
autoreconfHook # hardcode-plugin-interpreters.patch changes Makefile.am
meson
ninja
pkg-config
intltool
gettext
makeWrapper
gtk-doc
libxslt
wrapGAppsHook3
libxslt # for xsltproc
gobject-introspection
perl
vala
# for tests
desktop-file-utils
]
++ lib.optionals stdenv.hostPlatform.isLinux [
dbus
xvfb-run
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
desktopToDarwinBundle
@@ -107,13 +165,15 @@ stdenv.mkDerivation (finalAttrs: {
buildInputs =
[
appstream-glib # for library
babl
gegl
gtk2
gtk3
glib
gdk-pixbuf
pango
cairo
libarchive
gexiv2
harfbuzz
isocodes
@@ -135,51 +195,71 @@ stdenv.mkDerivation (finalAttrs: {
ghostscript
aalib
shared-mime-info
json-glib
libwebp
libheif
python
libexif
xorg.libXpm
xorg.libXmu
glib-networking
libmypaint
mypaint-brushes1
# New file dialogue crashes with “Icon 'image-missing' not present in theme Symbolic” without an icon theme.
adwaita-icon-theme
# for Lua plug-ins
(luajit.withPackages (pp: [
pp.lgi
]))
]
++ lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib
# for JavaScript plug-ins
gjs
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
AppKit
Cocoa
gtk-mac-integration-gtk2
gtk-mac-integration-gtk3
]
++ 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 = [
# needed by gimp-3.0.pc
gegl
];
configureFlags =
mesonFlags =
[
"--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"
"-Dbug-report-url=https://github.com/NixOS/nixpkgs/issues/new"
"-Dicc-directory=/run/current-system/sw/share/color/icc"
"-Dcheck-update=no"
(lib.mesonEnable "gudev" stdenv.hostPlatform.isLinux)
(lib.mesonEnable "headless-tests" stdenv.hostPlatform.isLinux)
(lib.mesonEnable "linux-input" stdenv.hostPlatform.isLinux)
# Not very important to do downstream, save a dependency.
"-Dappdata-test=disabled"
# Incompatible with version in nixpkgs
"-Djpeg-xl=disabled"
# Broken references
"-Dgi-docgen=disabled"
]
++ lib.optionals (!withPython) [
"--disable-python" # depends on Python2 which was EOLed on 2020-01-01
++ lib.optionals stdenv.hostPlatform.isDarwin [
"-Dalsa=disabled"
"-Djavascript=false"
];
enableParallelBuilding = true;
doCheck = true;
env = {
# The check runs before glib-networking is registered
GIO_EXTRA_MODULES = "${glib-networking}/lib/gio/modules";
NIX_CFLAGS_COMPILE = toString (
[ ]
++ lib.optionals stdenv.cc.isGNU [ "-Wno-error=incompatible-pointer-types" ]
@@ -190,29 +270,52 @@ stdenv.mkDerivation (finalAttrs: {
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"
postPatch = ''
patchShebangs \
app/tests/create_test_env.sh \
tools/gimp-mkenums
# Bypass the need for downloading git archive.
substitute app/git-version.h.in git-version.h \
--subst-var-by GIMP_GIT_VERSION "GIMP_2.99.?-g${builtins.substring 0 10 finalAttrs.src.rev}" \
--subst-var-by GIMP_GIT_VERSION_ABBREV "${builtins.substring 0 10 finalAttrs.src.rev}" \
--subst-var-by GIMP_GIT_LAST_COMMIT_YEAR "${builtins.head (builtins.match ".+\-unstable-([0-9]{4})-[0-9]{2}-[0-9]{2}" finalAttrs.version)}"
'';
postFixup = ''
wrapProgram $out/bin/gimp-${lib.versions.majorMinor finalAttrs.version} \
--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
preCheck = ''
# Avoid Error retrieving accessibility bus address
export NO_AT_BRIDGE=1
# Fix storing recent file list in tests
export HOME="$TMPDIR"
export XDG_DATA_DIRS="${glib.getSchemaDataDirPath gtk3}:$XDG_DATA_DIRS"
'';
preFixup = ''
gappsWrapperArgs+=(--prefix PATH : "${
lib.makeBinPath [
# for dot for gegl:introspect (Debug » Show Image Graph, hidden by default on stable release)
graphviz
]
}")
'';
passthru = {
# The declarations for `gimp-with-plugins` wrapper,
# used for determining plug-in installation paths
majorVersion = "${lib.versions.major finalAttrs.version}.0";
majorVersion = "2.99";
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;
gtk = gtk3;
python2Support = withPython;
updateScript = unstableGitUpdater {
stableVersion = true;
tagPrefix = "GIMP_";
tagConverter = "sed s/_/./g";
};
};
meta = with lib; {
@@ -0,0 +1,15 @@
diff --git a/meson.build b/meson.build
index a1ec1f67b6..8ce50973f7 100644
--- a/meson.build
+++ b/meson.build
@@ -864,8 +864,8 @@
isocodes = dependency('iso-codes', required: false)
if isocodes.found()
isocodes_prefix = isocodes.get_pkgconfig_variable('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())
@@ -1,22 +0,0 @@
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
@@ -1,11 +1,8 @@
--- 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
--- a/plug-ins/python/pygimp.interp.in
+++ b/plug-ins/python/pygimp.interp.in
@@ -2,4 +2,4 @@ python=@PYTHON_PATH@
python3=@PYTHON_PATH@
/usr/bin/python=@PYTHON_PATH@
/usr/bin/python3=@PYTHON_PATH@
-:Python:E::py::python3:
+:Python:E::py::@python_interpreter@:
@@ -1,8 +1,8 @@
diff --git a/app/gimp-version.c b/app/gimp-version.c
index 3d1894a036..48bb670b64 100644
index 6e311c8252..e6fd9d1d78 100644
--- a/app/gimp-version.c
+++ b/app/gimp-version.c
@@ -230,7 +230,7 @@ gimp_version (gboolean be_verbose,
@@ -231,7 +231,7 @@ gimp_version (gboolean be_verbose,
GIMP_BUILD_ID,
gimp_version_get_revision (),
GIMP_BUILD_PLATFORM_FAMILY,
@@ -0,0 +1,10 @@
diff --git a/build/windows/meson.build b/build/windows/meson.build
index 8df68256f6..9cd76ad660 100644
--- a/build/windows/meson.build
+++ b/build/windows/meson.build
@@ -1,4 +1,5 @@
# Windows specific
+subdir_done()
configure_file(
input : 'gimp-plug-ins.rc.in',
@@ -0,0 +1,13 @@
diff --git a/build/meson/run_test_env.sh b/build/meson/run_test_env.sh
index a3fda14f00..71fbdcd00d 100644
--- a/build/meson/run_test_env.sh
+++ b/build/meson/run_test_env.sh
@@ -33,7 +33,7 @@ if [ -n "${UI_TEST}" ]; then
OPT="--auto-servernum"
fi
xvfb-run $OPT --server-args="-screen 0 1280x1024x24" \
- dbus-run-session -- "$@"
+ dbus-run-session --config-file="@session_conf@" -- "$@"
else
# Run the executable directly,
-1
View File
@@ -14544,7 +14544,6 @@ with pkgs;
inherit (xorg) xlsfonts;
gimp = callPackage ../applications/graphics/gimp {
autoreconfHook = buildPackages.autoreconfHook269;
lcms = lcms2;
inherit (darwin.apple_sdk.frameworks) AppKit Cocoa;
};