Bug 230234 - graphics/php72-gd: Fails to build with ports libgd without XPM support
Summary: graphics/php72-gd: Fails to build with ports libgd without XPM support
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: Torsten Zuehlsdorff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-31 10:18 UTC by Guido Falsi
Modified: 2018-07-31 13:35 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (tz)


Attachments
Patch pgp-gd ports to correctly detect XPM availability in libgd (16.97 KB, patch)
2018-07-31 12:21 UTC, Guido Falsi
madpilot: maintainer-approval? (tz)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Guido Falsi freebsd_committer freebsd_triage 2018-07-31 10:18:50 UTC
Hi,

If one has disabled XPM support in graphics/gd php php-gd ports fail to build

This is the error I'm getting:

/wrkdirs/usr/ports/graphics/php72-gd/work/php-7.2.8/ext/gd/gd.c:57:11: fatal error: 'X11/xpm.h' file not found
# include <X11/xpm.h>
          ^~~~~~~~~~~
1 error generated.
*** [gd.lo] Error code 1

make[1]: stopped in /wrkdirs/usr/ports/graphics/php72-gd/work/php-7.2.8/ext/gd
1 error

make[1]: stopped in /wrkdirs/usr/ports/graphics/php72-gd/work/php-7.2.8/ext/gd
===> Compilation failed unexpectedly.

Simply adding a LIB_DEPENDS on libxpm makes it compile, but adds a bunch of unwanted X11 dependencies.

I don't have a patch to really fix the issue at hand.

php configure script first checks if GD has XPM support, but does not define anything in that phase. Then it tests for a gdImageCreateFromXpm() function, which is defined anyway as a stub returning an error message.

After this defines HAVE_GD_XPM, which causes the above error.

I'm trying to make a patch fixing the configure script.
Comment 1 Guido Falsi freebsd_committer freebsd_triage 2018-07-31 12:21:28 UTC
Created attachment 195686 [details]
Patch pgp-gd ports to correctly detect XPM availability in libgd

I have made a patch taking advantage of existing code.

I added a define to the check if xpm is present, and added another ifdef in the affected file.

This works for me with php 7.2.

It also works fine in poudriere for other php versions.
Comment 2 commit-hook freebsd_committer freebsd_triage 2018-07-31 12:56:25 UTC
A commit references this bug:

Author: tz
Date: Tue Jul 31 12:55:44 UTC 2018
New revision: 475998
URL: https://svnweb.freebsd.org/changeset/ports/475998

Log:
  graphics/php7*-gd: fix broken build when XPM option is disabled

  The switch from bundled gd to graphics/gd broke the port
  if a user disabled the XPM option.

  PR:		230234 217222
  Submitted by:	Guido Falsi <madpilot@FreeBSD.org>
  Reported by:	Guido Falsi <madpilot@FreeBSD.org>,  Dani <i.dani@outlook.com>

Changes:
  head/graphics/php70-gd/files/patch-config.m4
  head/graphics/php70-gd/files/patch-gd.c
  head/graphics/php71-gd/files/patch-config.m4
  head/graphics/php71-gd/files/patch-gd.c
  head/graphics/php72-gd/files/patch-config.m4
  head/graphics/php72-gd/files/patch-gd.c
Comment 3 Torsten Zuehlsdorff freebsd_committer freebsd_triage 2018-07-31 12:58:57 UTC
Hello Guido,

good catch und thank for the patch! 

I'm a little bit irritated since i tested with XPM option off, but after deleting my option-files and resetting it, i could reproduce the issue. And that your patch fixes it. My bad!

Thanks,
Torsten
Comment 4 Guido Falsi freebsd_committer freebsd_triage 2018-07-31 13:35:34 UTC
Thanks for the quick commit.

Don't worry, this was a non trivial interaction between two ports, it's easy to miss this kind of things.