-
Notifications
You must be signed in to change notification settings - Fork 7.8k
ext/gd: Use pkg-config to detect the availability of freetype2 #3632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest version of freetype2 does not install freetype-config by default, but pkg-config support has been there for approximately 15 years. In order to reliably detect freetype2, pkg-config *must* be used. See: https://savannah.nongnu.org/bugs/?53093 https://bugs.php.net/bug.php?id=76324
PHP_ARG_WITH(freetype-dir, for FreeType 2, | ||
[ --with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix], no, no) | ||
PHP_ARG_ENABLE(freetype, for FreeType 2, | ||
[ --enable-freetype GD: Enable FreeType 2 support], no, no) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to change the switch name. It's related to an external dependency, so it's definitely a with
switch.
Thanks.
I agree with @eli-schwartz and would accept this PR as-is for master. We should not retain support for custom It might me useful to include a note in UPGRADING about the new way to specify a custom libfreetype2 (or other checks that will hopefully be migrated to pkg-config as well). |
This could be used as a followup to this PR. |
Is this really necessary though? Part of the reason it's good to consistently use the standard macro, is because it even comes with useful
And the actual error message the configure script uses when freetype cannot be found is even more elucidative:
It would be odd if a Unix system did not have pkg-config, but if it doesn't, then it instead emits the error:
|
Those error messages do look quite informative. I've applied the PR as 2d03197 with tweaks to also distribute pkg.m4 with phpize and add a small note in UPGRADING regarding the changed name for the configure option. Can you please also submit a PR for the work you did on porting pkg-config use in other extensions? |
JFTR: documentation update. |
Cf. <php/php-src#3632>. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@345963 c90b9560-bf6c-de11-be94-00142212c4b1
If My question in the other ticket was not answered unfortunately #3630 (comment), so not sure there were no other implications with other libs, if a custom lib needs to be linked. Thanks. |
I specified in your comment here:
|
@eli-schwartz yep, that's what the doc tells. What it doesnt is - in case like Thanks. |
Huh? Are you asking whether Because the docs say yes: https://linux.die.net/man/1/pkg-config or https://man.openbsd.org/pkg-config.1#PKG_CONFIG_PATH Are you asking whether it will only use the first directory listed? I'm not sure why you'd think that. |
I think the question is whether, if a package is present in multiple directories in PKG_CONFIG_PATH, whether it will pick up the first one. |
Logic were of course, that it does the usual path resolution and looks for the libraries according to the given path order. The world is not always as logic as one would want ;) I had no time to test it, thus asked. Thanks for explaining. |
@nikic yeah, exactly. I guess it's answered now. Thanks. |
Okay, great. :) Answer is that it just loops through each directory on the search path (that is to say, |
Followup to fix travis config in 50e7e3a. |
Maybe also updating the UPGRADING.INTERNALS file anyway should be done because removing/adding/refactoring a configure option is important change for automated builds for packages and similar... |
By convention it probably makes sense to stick with this even when dropping the *-dir=DIR part. Fix the travis script, which is either way using the wrong version, with *-dir See: php#3632 (comment) https://autotools.io/autoconf/arguments.html
By convention it probably makes sense to stick with this even when dropping the *-dir=DIR part. Fix the travis script, which is either way using the wrong version, with *-dir See: php#3632 (comment) https://autotools.io/autoconf/arguments.html
Cf. <php/php-src#3632>. git-svn-id: http://svn.php.net/repository/phpdoc/en@345963 c90b9560-bf6c-de11-be94-00142212c4b1
By convention it probably makes sense to stick with this even when dropping the *-dir=DIR part. Fix the travis script, which is either way using the wrong version, with *-dir See: php#3632 (comment) https://autotools.io/autoconf/arguments.html
By convention it probably makes sense to stick with this even when dropping the *-dir=DIR part. See: #3632 (comment) https://autotools.io/autoconf/arguments.html
…on buster See: - docker-library#865 - https://bugs.php.net/bug.php?id=76324 - php/php-src#3632 - php/php-src@2d03197 This is not necessary for Debian Stretch (where `freetype-config` still exists) nor PHP 7.4+ (where `pkg-config` is used instead/in addition).
Cf. <php/php-src#3632>. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@345963 c90b9560-bf6c-de11-be94-00142212c4b1
Cf. <php/php-src#3632>. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@345963 c90b9560-bf6c-de11-be94-00142212c4b1
…on buster See: - docker-library/php#865 - https://bugs.php.net/bug.php?id=76324 - php/php-src#3632 - php/php-src@2d03197 This is not necessary for Debian Stretch (where `freetype-config` still exists) nor PHP 7.4+ (where `pkg-config` is used instead/in addition).
…on buster See: - docker-library/php#865 - https://bugs.php.net/bug.php?id=76324 - php/php-src#3632 - php/php-src@2d03197 This is not necessary for Debian Stretch (where `freetype-config` still exists) nor PHP 7.4+ (where `pkg-config` is used instead/in addition).
…on buster See: - docker-library/php#865 - https://bugs.php.net/bug.php?id=76324 - php/php-src#3632 - php/php-src@2d03197 This is not necessary for Debian Stretch (where `freetype-config` still exists) nor PHP 7.4+ (where `pkg-config` is used instead/in addition).
The latest version of freetype2 does not install freetype-config by default, but pkg-config support has been there for approximately 15 years. In order to reliably detect freetype2, pkg-config must be used.
See:
https://savannah.nongnu.org/bugs/?53093
https://bugs.php.net/bug.php?id=76324
This PR contains my original changes which prompted #3630