Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 943164 - >=media-gfx/gimp-2.99.18-r2: Should depend on [X?] rather than [X=]
Summary: >=media-gfx/gimp-2.99.18-r2: Should depend on [X?] rather than [X=]
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Sergey Torokhov
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2024-11-10 08:59 UTC by Sebastian Hamann
Modified: 2025-06-15 03:21 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge--info.txt,6.93 KB, text/plain)
2024-11-10 09:01 UTC, Sebastian Hamann
Details
gimp-3.0.2-r1.ebuild (gimp-3.0.2-r1.ebuild,6.55 KB, text/plain)
2025-05-11 16:35 UTC, Sergey Torokhov
Details
gimp-3.0.2-r2 (gimp-3.0.2-r2.ebuild,6.48 KB, text/plain)
2025-05-18 15:00 UTC, Sergey Torokhov
Details
gimp-3.0.2-r2 (gimp-3.0.2-r2.ebuild,6.56 KB, text/plain)
2025-05-18 15:37 UTC, Sergey Torokhov
Details
gimp-3.0.2-r2 (gimp-3.0.2-r2.ebuild,6.65 KB, text/plain)
2025-05-18 15:55 UTC, Sergey Torokhov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Hamann 2024-11-10 08:59:37 UTC
I currently run media-gfx/gimp-2.99.18-r1[-X] but have x11-libs/cairo and x11-libs/gtk+ built with the X USE flag. This combination works fine for me, but as of >=media-gfx/gimp-2.99.18-r2 no longer satisfies Gimp's dependencies, since it depends on [X=] for Cairo, GTK+, Pango and libwmf.

That means I'll need to build Gimp with X (which I don't need/want) or Cairo and GTK+ without X (which breaks other packages).
Reading the discussion in bug 942358 there is no indication that Gimp built without X does not work correctly when Cairo/GTK+/Pango/libwmf are built with X.

I believe Gimp's [X=] USE dependencies should be replaced with [X?].

Reproducible: Always

Steps to Reproduce:
1. USE=X emerge x11-libs/cairo x11-libs/gtk+
2. USE=-X emerge '>=media-gfx/gimp-2.99.18-r2'

Actual Results:  
Portage refuses to build Gimp.

Expected Results:  
Gimp gets compiled.
Comment 1 Sebastian Hamann 2024-11-10 09:01:40 UTC
Created attachment 908358 [details]
emerge --info
Comment 2 Sergey Torokhov 2024-11-10 16:11:03 UTC
> I believe Gimp's [X=] USE dependencies should be replaced with [X?].

No. The gimp[-X] fails to built with gtk+[X] etc. Initially I think about [X?] flags but then gimp[-X] failed on configuration phase (pkgconfig etc) or later with others x11-libs/*[X] or its x11-libs/*[X] dependencies. To test it I switched to wayland session and remove some x11 libs that are required. Otherwise it will require to "fix" gtk+, pango, cairo, libwmf.

> I currently run media-gfx/gimp-2.99.18-r1[-X] but have x11-libs/cairo and x11-libs/gtk+ built with the X USE flag.

But why? The gimp[X] bring additionnaly xcursor library and others are already presented in the system in your case.
Comment 3 Sergey Torokhov 2024-11-10 16:25:59 UTC
> media-gfx/gimp-2.99.18-r1[-X]

I.e. this only brings libXcursor feature while gimp-2.99.18-r2 fix additional x11-libs/* optional dependensies e.g. for wayland session. I thought about separate USE="xcursor" but desides it's too tiny to split it from USE="X".
Comment 4 Sebastian Hamann 2024-11-10 16:42:38 UTC
(In reply to Sergey Torokhov from comment #2)
> > I believe Gimp's [X=] USE dependencies should be replaced with [X?].
> 
> No. The gimp[-X] fails to built with gtk+[X] etc. Initially I think about
> [X?] flags but then gimp[-X] failed on configuration phase (pkgconfig etc)
> or later with others x11-libs/*[X] or its x11-libs/*[X] dependencies. To
> test it I switched to wayland session and remove some x11 libs that are
> required. Otherwise it will require to "fix" gtk+, pango, cairo, libwmf.

Well, I suppose you did better testing than I did.
I successfully build Gimp with -X, but I'll admit that the dependencies of that flag happen to be installed on my system. Seems like I unknowingly built it with X11 support anyway.

> > I currently run media-gfx/gimp-2.99.18-r1[-X] but have x11-libs/cairo and x11-libs/gtk+ built with the X USE flag.
> 
> But why? The gimp[X] bring additionnaly xcursor library and others are
> already presented in the system in your case.

I mostly use Wayland-native applications and therefore disable the X USE flag globally. I enabled it for the few packages that actually need it. It struck me as odd that I now need to enable X on Gimp (and Pango) so that I can have it enabled on GTK+ and Cairo.

I still think this is not ideal, but if there's no way to overrule the magic in Gimp's build system, feel free to close this bug.
Comment 5 Nowa Ammerlaan gentoo-dev 2024-11-12 08:19:45 UTC
(In reply to Sebastian Hamann from comment #4)
> (In reply to Sergey Torokhov from comment #2)
> > > I believe Gimp's [X=] USE dependencies should be replaced with [X?].
> > 
> > No. The gimp[-X] fails to built with gtk+[X] etc. Initially I think about
> > [X?] flags but then gimp[-X] failed on configuration phase (pkgconfig etc)
> > or later with others x11-libs/*[X] or its x11-libs/*[X] dependencies. To
> > test it I switched to wayland session and remove some x11 libs that are
> > required. Otherwise it will require to "fix" gtk+, pango, cairo, libwmf.
> 
> Well, I suppose you did better testing than I did.
> I successfully build Gimp with -X, but I'll admit that the dependencies of
> that flag happen to be installed on my system. Seems like I unknowingly
> built it with X11 support anyway.

Have not dug into this, but this feels suspiciously similar to Bug 942352 and Bug 903707. There's some automagic stuff going on there as well that causes the build to fail if some x11-libs/* are built with +X.
Comment 6 Sergey Torokhov 2024-11-14 06:47:49 UTC
Yes, it looks similar with my case. I'm thinking about to retry build gimp that way to reproduce it and when put logs here.
Comment 7 Chris Mayo 2025-03-25 19:43:54 UTC
Seems like a two part fix:

In src_prepare():

use !X && sed -i -e 's/x11_target = /x11_target = false #/' meson.build || die


In src_configure():

use X || append-cflags -DGENTOO_GTK_HIDE_X11


(looking at the meson.build code below the x11_target line, appears there is an automagic X only dependency on x11-libs/libXfixes too)


I've only investigated with USE="-wmf" also on a machine that has all the X dependencies installed.
Comment 8 Chris Mayo 2025-03-26 19:27:03 UTC
Use of GENTOO_GTK_HIDE_X11 should also make REQUIRED_USE="xpm? ( X )" unnecessary.
Comment 9 Sergey Torokhov 2025-04-02 18:38:47 UTC
(In reply to Chris Mayo from comment #8)
> Use of GENTOO_GTK_HIDE_X11 should also make REQUIRED_USE="xpm? ( X )"
> unnecessary.

Great thanks for proposed changes and tests. Currently I want to make gimp-3.0.2 bump and then I will test with this changes.
Comment 10 Sergey Torokhov 2025-05-11 16:35:58 UTC
Created attachment 928505 [details]
gimp-3.0.2-r1.ebuild

Could anybody test attached gimp-3.0.2-r1.ebuild on wayland-based system?

I'm not sure if REQUIRED_USE="?? ( X wayland )" is really needed here but afraid the order in

> # defang automagic dependencies. Bug 943164
>        use wayland || append-flags -DGENTOO_GTK_HIDE_WAYLAND
>        use X || append-flags -DGENTOO_GTK_HIDE_X11

could affect.
Comment 11 Sebastian Hamann 2025-05-11 17:50:13 UTC
(In reply to Sergey Torokhov from comment #10)
> Created attachment 928505 [details]
> gimp-3.0.2-r1.ebuild
> 
> Could anybody test attached gimp-3.0.2-r1.ebuild on wayland-based system?

Builds and starts fine on my system with 'wayland -X'.
But I can still run Gimp in Xwayland, so I think it still builds with X support. It may be a runtime thing, though. I still have all dependencies for X support installed.
Comment 12 Chris Mayo 2025-05-12 17:55:11 UTC
Looking at the attachment it doesn't have:
use !X && sed -i -e 's/x11_target = /x11_target = false #/' meson.build || die

The line it is editing is:

x11_target = gtk3.get_variable(pkgconfig: 'targets').contains('x11')

so that won't be affected by append-flags.
Comment 13 Chris Mayo 2025-05-13 18:23:22 UTC
... or actually looks like the sed only saves some dependency checking

(In reply to Sebastian Hamann from comment #11)
> 
> Builds and starts fine on my system with 'wayland -X'.
> But I can still run Gimp in Xwayland, so I think it still builds with X
> support. It may be a runtime thing, though. I still have all dependencies
> for X support installed.

Running x11-apps/xprop and moving the cursor over an application indicates if it is running as an X application by changing to a cross (and you can also then click on it)
Comment 14 Chris Mayo 2025-05-13 18:27:34 UTC
... maybe you already meant by "running in Xwayland" that you had checked.

The only other thing I can see is that the append-flags are in src_prepare() not src_configure() - and append-cflags was enough for me. Unclear if any that would make a difference though.
Comment 15 Sebastian Hamann 2025-05-13 18:39:32 UTC
(In reply to Chris Mayo from comment #14)
> ... maybe you already meant by "running in Xwayland" that you had checked.

Yes, that's what I meant.
To be very clear: I can run gimp-3.0.2-r2 as a Wayland native application *and* as an X11 application on my system.
Comment 16 Chris Mayo 2025-05-13 18:54:28 UTC
OK. Me too (with GDK_BACKEND=x11). I think that is expected when GTK itself has X11 support - maybe some things in GIMP won't work properly.
Comment 17 Sergey Torokhov 2025-05-13 19:39:24 UTC
(In reply to Chris Mayo from comment #14)
> ... maybe you already meant by "running in Xwayland" that you had checked.
> 
> The only other thing I can see is that the append-flags are in src_prepare()
> not src_configure() - and append-cflags was enough for me. Unclear if any
> that would make a difference though.

Yes, it's my fault. I will fix and then recheck.

When initially I set gtk[X=] etc dependencies I have to rebuild the set of dependencies with USE=X to check the Gimp build within wayland system.  And the splash screen differs for me compare with Xorg system.

I need to try build with sed line mentioned by Chris Mayo too.
Comment 18 Chris Mayo 2025-05-14 18:41:04 UTC
I checked the sed and it is needed - Meson's dependency() defaults to required=true. I don't have x11-libs/libXmu installed, without the sed I get a failure:

Run-time dependency xmu found: NO (tried pkgconfig and cmake)

meson.build:707:21: ERROR: Dependency "xmu" not found, tried pkgconfig and cmake


On append-flags, meson.build has 

project('gimp',
  'c', 'cpp',

so maybe append-flags is safer after all. I really don't know.
Comment 19 Sergey Torokhov 2025-05-18 15:00:27 UTC
Created attachment 929041 [details]
gimp-3.0.2-r2

I'm not able to reproduce initial problem anymore but I prepared new Gimp revision and tested it within KDE Plasma Wayland session with x11-libs/gtk+:3[-X] x11-libs/pango[-X] and x11-libs/cairo[-X] preliminary rebuilded. The same patched ebuild I'm planing to use for Gimp-3.0.4 release.

The `use !X && sed -i -e 's/x11_target = /x11_target = false #/' meson.build || die` patch seems isn't required as `append-cflags -DGENTOO_GTK_HIDE_X11` is used.
Comment 20 Sergey Torokhov 2025-05-18 15:37:58 UTC
Created attachment 929042 [details]
gimp-3.0.2-r2

Yes, if gtk+[X] is built then libXmu is actually searched on configuration phase despite of trying to configure gimp[-X -xpm wayland]. I replace the ebuild with sed. Thanks.
Comment 21 Sergey Torokhov 2025-05-18 15:55:01 UTC
Created attachment 929043 [details]
gimp-3.0.2-r2
Comment 22 Larry the Git Cow gentoo-dev 2025-05-21 20:59:47 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=20a34f246d1cc42b98880edef15abd07de26ed5b

commit 20a34f246d1cc42b98880edef15abd07de26ed5b
Author:     Sergey Torokhov <torokhov-s-a@yandex.ru>
AuthorDate: 2025-05-19 17:59:37 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-05-21 20:58:25 +0000

    media-gfx/gimp: 3.0.2-r2 revbump, depend on [X?] instead of [X=]
    
    Compared with gimp-3.0.2-r1 add USE="wayland" with forced disabling
    of 'x11_target', add 'append-cflags -DGENTOO_GTK_HIDE_WAYLAND' or
    'append-cflags -DGENTOO_GTK_HIDE_X11' depend on USE='wayland' or 'X'
    
    Closes: https://bugs.gentoo.org/943164
    Signed-off-by: Sergey Torokhov <torokhov-s-a@yandex.ru>
    Part-of: https://github.com/gentoo/gentoo/pull/42157
    Signed-off-by: Sam James <sam@gentoo.org>

 media-gfx/gimp/gimp-3.0.2-r2.ebuild | 248 ++++++++++++++++++++++++++++++++++++
 1 file changed, 248 insertions(+)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=090e2767abb07926d6b9249bcac10833b01ee944

commit 090e2767abb07926d6b9249bcac10833b01ee944
Author:     Sergey Torokhov <torokhov-s-a@yandex.ru>
AuthorDate: 2025-05-19 18:06:44 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-05-21 20:58:26 +0000

    media-gfx/gimp: 3.0.4 version bump
    
    Bug: https://bugs.gentoo.org/936290
    Bug: https://bugs.gentoo.org/943164
    Signed-off-by: Sergey Torokhov <torokhov-s-a@yandex.ru>
    Part-of: https://github.com/gentoo/gentoo/pull/42157
    Closes: https://github.com/gentoo/gentoo/pull/42157
    Signed-off-by: Sam James <sam@gentoo.org>

 media-gfx/gimp/Manifest          |   1 +
 media-gfx/gimp/gimp-3.0.4.ebuild | 248 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 249 insertions(+)
Comment 23 Larry the Git Cow gentoo-dev 2025-05-21 23:50:59 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=279d9c96b379fbf5a037a513fdef6297193bb05c

commit 279d9c96b379fbf5a037a513fdef6297193bb05c
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2025-05-21 23:49:03 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-05-21 23:49:03 +0000

    profiles: mask new gimp versions
    
    When merging the bumps for GIMP, I'd erred on the side of "well, any automagic
    is definitely bad", but the UX of exactly-one-of X or Wayland isn't great,
    so let's discuss it more in bug #956402 first.
    
    Bug: https://bugs.gentoo.org/943164
    Bug: https://bugs.gentoo.org/956402
    Signed-off-by: Sam James <sam@gentoo.org>

 profiles/package.mask | 5 +++++
 1 file changed, 5 insertions(+)