Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 906585

Summary: dev-lang/php: unbundle media-libs/gd
Product: Gentoo Linux Reporter: Michael Orlitzky <mjo>
Component: Current packagesAssignee: PHP Bugs <php-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: esigra, mjo
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 912772    
Bug Blocks: 251464    

Description Michael Orlitzky gentoo-dev 2023-05-16 20:55:48 UTC
I'm not sure how I missed this for so long, but PHP (since 7.4) supports an external libgd with

  --enable-gd             Include GD support
  --with-external-gd      Use external libgd

This would eventually allow us to eliminate the following options,

  --with-avif             GD: Enable AVIF support (only for bundled libgd)
  --with-webp             GD: Enable WEBP support (only for bundled libgd)
  --with-jpeg             GD: Enable JPEG support (only for bundled libgd)
  --with-xpm              GD: Enable XPM support (only for bundled libgd)
                          libgd)
  --enable-gd-jis-conv    GD: Enable JIS-mapped Japanese font support (only
                          for bundled libgd)

In the meantime, we could propagate the existing php USE flags to media-libs/gd, and warn about the eventual migration.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-16 20:57:07 UTC
I may start grepping for unused *external* config args...
Comment 2 Brian Evans (RETIRED) gentoo-dev 2023-05-16 22:18:42 UTC
This existed several years ago but generated many bugs as exact versions are expected.  It should stay bundled.
Comment 3 Michael Orlitzky gentoo-dev 2023-05-17 01:33:57 UTC
(In reply to Brian Evans from comment #2)
> This existed several years ago but generated many bugs as exact versions are
> expected.  It should stay bundled.

Oh, that's disappointing. I found a bunch of failures in the test suite but a huge chunk of them are spurious failures due to the "gd" format being removed from gd-2.3.3. Others fail for trivial output differences. And some of course fail because real bugs were fixed and those fixes never made it upstream, but those are the most rare.

The ./configure script for php does now use pkg-config and a few PHP_CHECK_LIBRARY calls to ensure that a "suitable" version of libgd is found on the system. Do you remember what kind of failures you hit? Any hope of me fixing them upstream?
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-17 01:36:29 UTC
Given that remi has committed a bunch to the gd repo in recent years and gd development activity has slowed down a bit (it's pretty stable now), I imagine it's fine. Maybe check how different the internal copy in php is and how often it gets commits.
Comment 5 Michael Orlitzky gentoo-dev 2023-05-17 23:55:29 UTC
I've started working through the test failures at

  https://github.com/php/php-src/issues/11252

The lack of "gd" format (and temporarily IMG_BICUBIC) support is potentially annoying if you're stuck with an old codebase that tries to use one of those.
Comment 6 Michael Orlitzky gentoo-dev 2023-05-19 22:00:06 UTC
The IMG_BICUBIC bug is a trivial backport if we want to attempt this while gd-2.3.3 is still the latest stable:

https://github.com/libgd/libgd/commit/a5f5698a6832fc1f8179a9257f0b91c9a8ef496b#diff-e6f252e5a515be3a071f2a75bd00d2e69d55a1c37970da572f905c04c9b55547

Otherwise I've got it down to what look like a few minor box-sizing issues.
Comment 7 Larry the Git Cow gentoo-dev 2024-07-10 14:50:05 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0771e0a34345350b76153a1d4826dbec82e0dbea

commit 0771e0a34345350b76153a1d4826dbec82e0dbea
Author:     Michael Orlitzky <mjo@gentoo.org>
AuthorDate: 2024-07-09 19:16:23 +0000
Commit:     Michael Orlitzky <mjo@gentoo.org>
CommitDate: 2024-07-10 14:07:08 +0000

    dev-lang/php: add 8.3.9, drop 8.3.8
    
    Various improvements on top of the version bump:
    
      * The system copy of media-libs/gd is now used.
      * Autoconf cache variables are overridden to allow
        cross-compiles with external libraries.
      * New USE=opcache-jit flag to control the use of a
        JIT within the opcache extension.
    
    Closes: https://bugs.gentoo.org/857597
    Closes: https://bugs.gentoo.org/906585
    Bug: https://bugs.gentoo.org/931884
    Signed-off-by: Michael Orlitzky <mjo@gentoo.org>

 dev-lang/php/Manifest                              |    2 +-
 dev-lang/php/files/php-8.3.9-gd-cachevars.patch    |   68 ++
 .../files/php-8.3.9-optional-png-testfixen.patch   | 1277 ++++++++++++++++++++
 dev-lang/php/metadata.xml                          |    3 +
 .../php/{php-8.3.8.ebuild => php-8.3.9.ebuild}     |   89 +-
 5 files changed, 1406 insertions(+), 33 deletions(-)