Bug 239156 - graphics/ImageMagick6-nox11 pulls in a lot of x11 stuff via graphics/cairo
Summary: graphics/ImageMagick6-nox11 pulls in a lot of x11 stuff via graphics/cairo
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Koop Mast
URL:
Keywords: patch
Depends on: 239662
Blocks:
  Show dependency treegraph
 
Reported: 2019-07-12 08:06 UTC by Martin Waschbüsch
Modified: 2020-08-17 07:00 UTC (History)
6 users (show)

See Also:
martin: maintainer-feedback?


Attachments
Add RAQM to excluded options (617 bytes, patch)
2019-07-21 11:44 UTC, Martin Waschbüsch
martin: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Waschbüsch 2019-07-12 08:06:41 UTC
I just upgraded packages on a system and a number of additional libraries were needed, among them:

xorgproto
libxcb
libXdmcp
libXau
libXrender
libX11
libXext
libxshmfence
libXxf86vm
libXfixes
libXdamage
wayland

I did not immediately understand where that came from (how the heck did I end up having wayland installed on a webserver?) as I have no need for x11 stuff.

It turns out that the graphics/ImageMagick6-nox11 (deliberately chosen for excluding x11 stuff) by default depends on graphics/cairo which in turn has its X11 option enabled by default.

I do not know what the right solution is here. Maybe there needs to be a cairo-nox11 package, but at any rate, the current situation seems like a contradiction to me and certainly does not result in what you would expect when installing a -nox11 package (e.g. no x11 stuff pulled in).

PS: Same applies to ImageMagick7-nox11.
Comment 1 Ting-Wei Lan 2019-07-12 08:38:07 UTC
(In reply to Martin Waschbüsch from comment #0)
I think you will have to disable OPENGL, X11, XCB options on cairo. Wayland is likely to be pulled in by mesa-libs with USES=gl.
Comment 2 Martin Waschbüsch 2019-07-13 23:43:06 UTC
(In reply to Ting-Wei Lan from comment #1)
Thank you for the suggestion. I do know how to work around it when building the package myself. My point was about expectations:

Someone installing  a -nox11 package will expect it to do just that. Instead, x11 + wayland gets installed. That just seems wrong to me.

Also, someone using pkg (official packages, not poudriere) instead of ports does not have much of a choice.

Thus, as I see it, there are three options to solve this:

1) Can the -nox11 ImageMagick packages as they pull in x11 stuff anyway. That way at least no false expectations are raised.

2) Disable OPENGL, X11 and XCB per default for graphics/cairo since they result in these dependencies. However, hoping that these options are set by default for a reason, that might break other packages depending on graphics/cairo providing these features.

3) Create a graphics/cairo-nox11 port with appropriate options unset so that the -nox11 ImageMagick packages can depend on that instead of graphics/cairo. That way other packages are left untouched while being able to provide -nox11 ImageMagic packages that actually behave as advertised. 

My preference would be for 3).

One could leave it as is, however I tend to finding that unacceptable seeing as you do not get what you expected when installing one of the -nox11 ImageMagic packages.
Comment 3 Ting-Wei Lan 2019-07-14 06:17:24 UTC
(In reply to Martin Waschbüsch from comment #2)

(1) I don't know what is the policy of nox11 packages, but I agree that it doesn't look right for nox11 packages to end up pulling in X11 libraries.

(2) This isn't possible because GTK requires X11 and WebKitGTK requires OPENGL. I am not sure what is the status of XCB, but I think it makes sense to enable it by default because libX11 itself already depends on XCB.

(3) I agree that this is the best solution as long as you don't have other packages depending on cairo.
Comment 4 Gary 2019-07-14 13:09:17 UTC
Note that a recent update to graphics/ImageMagick6 and graphics/ImageMagick6-nox11 to add RAQM support seemed to pull in a bunch of X11 libraries also.  RAQM appears to be on by default.
Comment 5 Martin Waschbüsch 2019-07-20 13:46:38 UTC
I created a PR for a new cairo-nox11 slave port (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239343) that might be a starting point to reduce dependencies. I'll attach a patch for ImageMagick{6,7}-nox11 later to make use of that slave port.
Comment 6 Martin Waschbüsch 2019-07-20 14:03:40 UTC
(In reply to Gary from comment #4)
I just looked at libraqm and it seems this is the only thing that makes ImageMagick6-nox11 pull in X:

ImageMagick6-nox11 => libraqm => harfbuzz => cairo => X11 stuff

I have no idea if harfbuzz (which depends on cairo) can be made to work without the x11 components of cairo, but in this light, it seems easier to add RAQM option to OPTIONS_EXCLUDE in ImageMagick6-nox11's Makefile.

I'll add a patch to that effect and scrap the cairo-nox11 stuff.
Comment 7 Ting-Wei Lan 2019-07-20 14:11:06 UTC
(In reply to Martin Waschbüsch from comment #6)
Cairo is an optional dependency of Harfbuzz. Harfbuzz library itself doesn't need Cairo. It is one of its utility, hb-view, that depends on Cairo.
Comment 8 Martin Waschbüsch 2019-07-20 14:18:55 UTC
(In reply to Ting-Wei Lan from comment #7)

Good to know. So far, though, harfbuzz does not seem go have a config option, but simply pulls cairo in via

USE_GNOME = cairo glib20 introspection:build

without asking questions.


A question for the sake of people using pkg instead of ports:

If there *was* a config option for hardbuzz, would there be a way to ensure, from within ImageMagick6-nox11 Makefile, that this option be unset?

Cause if there is no straightforward way to pass down the impact that -nox11 implies to dependencies, it might be best to stick with removing RAQM from ImageMagick6-nox11?

Obviously, using ports you can fine-tune dependencies per package and dependency, but for pkg repo this is more about some sort of sane default I guess?
Comment 9 Ting-Wei Lan 2019-07-20 14:24:37 UTC
(In reply to Martin Waschbüsch from comment #8)
I guess the answer is no. If it is possible, www/webkit2-gtk3 wouldn't need this kind of code to check whether cairo is built with OPENGL enabled.

pre-configure:
# .if !exists() evaluates too early before cairo has a chance to be installed   
        @if ! pkg-config --exists cairo-egl; then \
                ${ECHO_MSG} "${PKGNAME}: Needs cairo with OPENGL support enabled."; \
                ${FALSE}; \
        fi
Comment 10 Martin Waschbüsch 2019-07-21 11:44:38 UTC
Created attachment 205970 [details]
Add RAQM to excluded options

Adding RAQM to OPTIONS_EXCLUDE prevents cairo and X11 stuff eventually being pulled in.
Comment 11 commit-hook freebsd_committer freebsd_triage 2019-08-05 16:25:17 UTC
A commit references this bug:

Author: kwm
Date: Mon Aug  5 16:24:49 UTC 2019
New revision: 508192
URL: https://svnweb.freebsd.org/changeset/ports/508192

Log:
  Update ImageMagick to 6.9.10.57.

  Temperarly disable RAQM support in the -nox11 port since it pulls in X libraries (via harfbuzz->cairo->X) [1].

  Thanks to the reportes for tracking down where  the extra dependancies came from.

  PR:		239156 [1]
  Reported by:	Martin Waschb?sch <martin@waschbuesch.de>
  		Ting-Wei Lan <lantw44@gmail.com>
  		Gary <freebsd-bugzilla@in-addr.com>

Changes:
  head/graphics/ImageMagick6/Makefile
  head/graphics/ImageMagick6/distinfo
  head/graphics/ImageMagick6-nox11/Makefile
Comment 12 commit-hook freebsd_committer freebsd_triage 2019-08-05 16:26:19 UTC
A commit references this bug:

Author: kwm
Date: Mon Aug  5 16:25:46 UTC 2019
New revision: 508193
URL: https://svnweb.freebsd.org/changeset/ports/508193

Log:
  Update ImageMagick to 7.0.8.57.

  Temperarly disable RAQM support in the -nox11 port since it pulls in X libraries (via harfbuzz->cairo->X) [1].

  Thanks to the reportes for tracking down where  the extra dependancies came from.

  PR:		239156
  Reported by:	Martin Waschb?sch <martin@waschbuesch.de>
  		Ting-Wei Lan <lantw44@gmail.com>
  		Gary <freebsd-bugzilla@in-addr.com>

Changes:
  head/graphics/ImageMagick7/Makefile
  head/graphics/ImageMagick7/distinfo
  head/graphics/ImageMagick7/pkg-plist
  head/graphics/ImageMagick7-nox11/Makefile
Comment 13 Koop Mast freebsd_committer freebsd_triage 2019-08-05 16:53:02 UTC
Thanks for looking where the extra dependencies came from. The bug I linked earlier removes the cairo dependency form harfbuzz which should allow ImageMagick -nox11 to support RAQM by default without extra X deps.
Comment 14 Walter Schwarzenfeld freebsd_triage 2020-01-29 05:31:06 UTC
Is there anything to do here or is it only forgotten to close?
Comment 15 Mark Linimon freebsd_committer freebsd_triage 2020-08-17 07:00:54 UTC
Committed Aug  5 16:25:46 UTC 2019 as r508193.

^Triage: assign to committer that resolved.