summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2020-07-05 05:45:03 +0200
committerGitHub <noreply@github.com>2020-07-05 05:45:03 +0200
commit9925e909e47724a256d2edc51ef6e38a3ecc5fbd (patch)
tree065986f74dabc64e940b469c68b1897f0d96f657 /pkgs
parent07cebeffb8866d9b0bdda060e167ba72f9d67e25 (diff)
parent64ec4fd65d14d89903364048a2a8090b23a7d8ac (diff)
downloadnixpkgs-9925e909e47724a256d2edc51ef6e38a3ecc5fbd.tar
nixpkgs-9925e909e47724a256d2edc51ef6e38a3ecc5fbd.tar.gz
nixpkgs-9925e909e47724a256d2edc51ef6e38a3ecc5fbd.tar.bz2
nixpkgs-9925e909e47724a256d2edc51ef6e38a3ecc5fbd.tar.lz
nixpkgs-9925e909e47724a256d2edc51ef6e38a3ecc5fbd.tar.xz
nixpkgs-9925e909e47724a256d2edc51ef6e38a3ecc5fbd.tar.zst
nixpkgs-9925e909e47724a256d2edc51ef6e38a3ecc5fbd.zip
Merge pull request #92228 from jtojnar/gimp-interp
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/graphics/gimp/default.nix36
-rw-r--r--pkgs/applications/graphics/gimp/hardcode-plugin-interpreters.patch11
2 files changed, 30 insertions, 17 deletions
diff --git a/pkgs/applications/graphics/gimp/default.nix b/pkgs/applications/graphics/gimp/default.nix
index 9e448fa23a4..aa440f2c47a 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
@@ -28,9 +29,10 @@
 , ghostscript
 , aalib
 , shared-mime-info
-, python2Packages
+, python2
 , libexif
 , gettext
+, makeWrapper
 , xorg
 , glib-networking
 , libmypaint
@@ -47,7 +49,7 @@
 }:
 
 let
-  inherit (python2Packages) pygtk wrapPython python;
+  python = python2.withPackages (pp: [ pp.pygtk ]);
 in stdenv.mkDerivation rec {
   pname = "gimp";
   version = "2.10.20";
@@ -59,11 +61,25 @@ 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
-    wrapPython
+    makeWrapper
   ];
 
   buildInputs = [
@@ -97,7 +113,6 @@ in stdenv.mkDerivation rec {
     libwebp
     libheif
     python
-    pygtk
     libexif
     xorg.libXpm
     glib-networking
@@ -116,8 +131,6 @@ in stdenv.mkDerivation rec {
     gegl
   ];
 
-  pythonPath = [ pygtk ];
-
   # Check if librsvg was built with --disable-pixbuf-loader.
   PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = "${librsvg}/${gdk-pixbuf.moduleDir}";
 
@@ -126,19 +139,8 @@ 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 = ''
-    wrapPythonProgramsIn $out/lib/gimp/${passthru.majorVersion}/plug-ins/
     wrapProgram $out/bin/gimp-${lib.versions.majorMinor version} \
-      --prefix PYTHONPATH : "$PYTHONPATH" \
       --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 00000000000..1528404c31d
--- /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
+