From 64ec4fd65d14d89903364048a2a8090b23a7d8ac Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 3 Jul 2020 21:03:26 +0200 Subject: [PATCH] gimp: Hardcode interpreter paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The E (extension) line in pygimp.interp prints the following warnings: GIMP-Warning: Bad interpreter referenced in interpreter file /nix/store/5c91dah385gn70blsn6i5rzncqj3ks0y-gimp-with-plugins-2.10.18/lib/gimp/2.0/interpreters/pygimp.interp: python2 GIMP-Warning: Bad binary format string in interpreter file /nix/store/5c91dah385gn70blsn6i5rzncqj3ks0y-gimp-with-plugins-2.10.18/lib/gimp/2.0/interpreters/pygimp.interp This means that the py extension will not be registered when python2 is not in PATH. To prevent this, let’s hardcode the absolute python2 path. https://github.com/NixOS/nixpkgs/issues/60937#issuecomment-653652093 Closes: https://github.com/NixOS/nixpkgs/issues/60937 --- pkgs/applications/graphics/gimp/default.nix | 24 ++++++++++++------- .../gimp/hardcode-plugin-interpreters.patch | 11 +++++++++ 2 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 pkgs/applications/graphics/gimp/hardcode-plugin-interpreters.patch diff --git a/pkgs/applications/graphics/gimp/default.nix b/pkgs/applications/graphics/gimp/default.nix index 1eee37223f1c..aa440f2c47a1 100644 --- a/pkgs/applications/graphics/gimp/default.nix +++ b/pkgs/applications/graphics/gimp/default.nix @@ -2,6 +2,7 @@ , lib , fetchurl , substituteAll +, autoreconfHook , pkgconfig , intltool , babl @@ -60,7 +61,21 @@ in stdenv.mkDerivation rec { sha256 = "4S+fh0saAHxCd7YKqB4LZzML5+YVPldJ6tg5uQL8ezw="; }; + 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 + ]; + nativeBuildInputs = [ + autoreconfHook # hardcode-plugin-interpreters.patch changes Makefile.am pkgconfig intltool gettext @@ -124,15 +139,6 @@ in stdenv.mkDerivation rec { export GIO_EXTRA_MODULES="${glib-networking}/lib/gio/modules:$GIO_EXTRA_MODULES" ''; - 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; - }) - ]; - postFixup = '' wrapProgram $out/bin/gimp-${lib.versions.majorMinor version} \ --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" diff --git a/pkgs/applications/graphics/gimp/hardcode-plugin-interpreters.patch b/pkgs/applications/graphics/gimp/hardcode-plugin-interpreters.patch new file mode 100644 index 000000000000..1528404c31d2 --- /dev/null +++ b/pkgs/applications/graphics/gimp/hardcode-plugin-interpreters.patch @@ -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 +