Repository navigation
Enable bundled GD with JPEG and FreeType configure options - #782
Merged
Merged
Conversation
…both configure option autodetection and runtime validation
asgrim
self-requested a review
November 10, 2026 22:14
asgrim
marked this pull request as ready for review
November 10, 2026 22:15
asgrim
approved these changes
Nov 11, 2026
asgrim
left a comment
Contributor
There was a problem hiding this comment.
Thanks @andr2k - sorry it took a while to get to. I had to work out the original issue with ft2build.h being missing; it was all to do with the flags the target PHP build has; Ondrej repos for example don't have the HAVE_GD_FREETYPE flag; I added some detection to look into php_config.h to figure out the flags, and as a result add the effective --with-... configure options which is why your PR worked originally; just now it has some evidence to support the change 😁
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pie install php/gdcurrently fails during package resolution because GD is excluded from the bundled-extension repository. This registersphp/gdand builds it with the same image features as the target PHP.Behaviour
Detected features. On Unix builds PIE reads
main/php_config.hfromphp-config --include-dirand adds the matching configure flag for each feature the target PHP was built with:php_config.hdefineHAVE_GD_FREETYPE--with-freetypeHAVE_GD_JPG--with-jpegHAVE_GD_XPM--with-xpmHAVE_GD_WEBP--with-webpHAVE_GD_AVIF--with-avifUser-supplied flags. The same five flags are declared as configure options, so they can be passed explicitly, e.g. when the header has no GD defines (the official Docker images). A flag the user passes is never duplicated, and a value form such as
--with-jpeg=/opt/jpegis left as given.No header, no change. If
php-configorphp_config.his unavailable, nothing is added.The development libraries for every enabled feature must be installed, whether the flag was detected or passed.
The existing build-provider refusal and
--forceoverride are unchanged.The package requires PHP 7.4+, when these configure flag names were introduced.
Implementation
BundledPhpExtensionsRepository: registersgdwith itsconfigure-options, and addsaugmentConfigureOptionsForPhpBundledExtensions(), which applies the mapping above forphp/gdonly.PhpBinaryPath::phpConfigHeader(): returns the contents ofphp_config.h, ornull.UnixBuild: calls the augmentation after the libdir detection, beforeconfigure.Tests
#undef, existing options kept first, no duplicate, user value not overridden, no header, other extension untouched);phpConfigHeader()with and without the header file.test/end-to-end/Dockerfile):pie install --force php/gdagainst Alpine's and Homebrew's PHP, each first asserting the header definesHAVE_GD_FREETYPE; the Alpine target also checks the built extension loads withLD_BIND_NOW=1.libjpeg-devis added to the bundled-extension job, wheretest/install-bundled-php-exts.phpnow installsphp/gdwith the rest.The historical
ft2build.hfailure recorded in the original GD review thread does not occur in these builds. This PR does not claim to establish its original cause.Discussion: #781.
PR submitter checklist