Merge pull request #221660 from jtojnar/gimp-break-python2

gimpPlugins.resynthesizer: Mark as broken for GIMP without Python 2 support
This commit is contained in:
Jan Tojnar 2023-03-17 16:37:58 +01:00 committed by GitHub
commit a869e4849c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 37 deletions

View File

@ -53,14 +53,14 @@
let
python = python2.withPackages (pp: [ pp.pygtk ]);
in stdenv.mkDerivation rec {
in stdenv.mkDerivation (finalAttrs: {
pname = "gimp";
version = "2.10.34";
outputs = [ "out" "dev" ];
src = fetchurl {
url = "http://download.gimp.org/pub/gimp/v${lib.versions.majorMinor version}/${pname}-${version}.tar.bz2";
url = "http://download.gimp.org/pub/gimp/v${lib.versions.majorMinor finalAttrs.version}/gimp-${finalAttrs.version}.tar.bz2";
sha256 = "hABGQtNRs5ikKTzX/TWSBEqUTwW7UoUO5gaPJHxleqM=";
};
@ -154,10 +154,12 @@ in stdenv.mkDerivation rec {
doCheck = true;
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-DGDK_OSX_BIG_SUR=16";
env = {
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.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}";
# 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
@ -165,21 +167,23 @@ in stdenv.mkDerivation rec {
'';
postFixup = ''
wrapProgram $out/bin/gimp-${lib.versions.majorMinor version} \
wrapProgram $out/bin/gimp-${lib.versions.majorMinor finalAttrs.version} \
--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
'';
passthru = rec {
passthru = {
# The declarations for `gimp-with-plugins` wrapper,
# used for determining plug-in installation paths
majorVersion = "${lib.versions.major version}.0";
targetLibDir = "lib/gimp/${majorVersion}";
targetDataDir = "share/gimp/${majorVersion}";
targetPluginDir = "${targetLibDir}/plug-ins";
targetScriptDir = "${targetDataDir}/scripts";
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; {
@ -190,4 +194,4 @@ in stdenv.mkDerivation rec {
platforms = platforms.unix;
mainProgram = "gimp";
};
}
})

View File

@ -31,26 +31,27 @@ let
install -Dt "$pluginDir" "$@"
}
'';
# Override installation paths.
PKG_CONFIG_GIMP_2_0_GIMPLIBDIR = "${placeholder "out"}/${gimp.targetLibDir}";
PKG_CONFIG_GIMP_2_0_GIMPDATADIR = "${placeholder "out"}/${gimp.targetDataDir}";
}
// attrs
// {
name = "${gimp.pname}-plugin-${name}";
buildInputs = [
gimp
gimp.gtk
glib
] ++ (attrs.buildInputs or []);
name = "${gimp.pname}-plugin-${name}";
buildInputs = [
gimp
gimp.gtk
glib
] ++ (attrs.buildInputs or []);
nativeBuildInputs = [
pkg-config
intltool
] ++ (attrs.nativeBuildInputs or []);
}
);
nativeBuildInputs = [
pkg-config
intltool
] ++ (attrs.nativeBuildInputs or []);
# Override installation paths.
env = {
PKG_CONFIG_GIMP_2_0_GIMPLIBDIR = "${placeholder "out"}/${gimp.targetLibDir}";
PKG_CONFIG_GIMP_2_0_GIMPDATADIR = "${placeholder "out"}/${gimp.targetDataDir}";
} // attrs.env or { };
});
scriptDerivation = {src, ...}@attrs : pluginDerivation ({
prePhases = "extraLib";
@ -116,8 +117,13 @@ in
url = "https://ftp.gimp.org/pub/gimp/plug-ins/v2.6/gap/gimp-gap-2.6.0.tar.bz2";
sha256 = "1jic7ixcmsn4kx2cn32nc5087rk6g8xsrz022xy11yfmgvhzb0ql";
};
NIX_LDFLAGS = "-lm";
hardeningDisable = [ "format" ];
env = {
NIX_LDFLAGS = "-lm";
};
meta = with lib; {
description = "The GIMP Animation Package";
homepage = "https://www.gimp.org";
@ -208,6 +214,10 @@ in
rev = "v${version}";
sha256 = "1jwc8bhhm21xhrgw56nzbma6fwg59gc8anlmyns7jdiw83y0zx3j";
};
meta = {
broken = !gimp.python2Support;
};
};
texturize = pluginDerivation {
@ -233,15 +243,19 @@ in
pname = "wavelet-sharpen";
version = "0.1.2";
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: interface.o:(.bss+0xe0): multiple definition of `fimg'; plugin.o:(.bss+0x40): first defined here
env.NIX_CFLAGS_COMPILE = "-fcommon";
NIX_LDFLAGS = "-lm";
src = fetchurl {
url = "https://github.com/pixlsus/registry.gimp.org_static/raw/master/registry.gimp.org/files/wavelet-sharpen-0.1.2.tar.gz";
sha256 = "0vql1k67i21g5ivaa1jh56rg427m0icrkpryrhg75nscpirfxxqw";
};
env = {
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: interface.o:(.bss+0xe0): multiple definition of `fimg'; plugin.o:(.bss+0x40): first defined here
NIX_CFLAGS_COMPILE = "-fcommon";
NIX_LDFLAGS = "-lm";
};
installPhase = "installPlugin src/wavelet-sharpen"; # TODO translations are not copied .. How to do this on nix?
};

View File

@ -1,8 +1,9 @@
{ lib, symlinkJoin, gimp, makeWrapper, gimpPlugins, gnome, plugins ? null}:
{ lib, symlinkJoin, makeWrapper, gimpPlugins, gnome, plugins ? null}:
let
inherit (gimpPlugins) gimp;
allPlugins = lib.filter (pkg: lib.isDerivation pkg && !pkg.meta.broken or false) (lib.attrValues gimpPlugins);
selectedPlugins = lib.filter (pkg: pkg != gimpPlugins.gimp) (if plugins == null then allPlugins else plugins);
selectedPlugins = lib.filter (pkg: pkg != gimp) (if plugins == null then allPlugins else plugins);
extraArgs = map (x: x.wrapArgs or "") selectedPlugins;
versionBranch = lib.versions.majorMinor gimp.version;