Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use pkg-config for FreeType2 detection #3630

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

Closed
wants to merge 1 commit into from
Closed

Conversation

oerdnj
Copy link
Contributor

@oerdnj oerdnj commented Oct 22, 2018

SImple patch that uses pkg-config for FreeType2 library detection if pkg-config is available.

@KalleZ
Copy link
Member

KalleZ commented Oct 22, 2018

cc @remicollet

@eli-schwartz
Copy link
Contributor

eli-schwartz commented Oct 22, 2018

It's fatally broken if you actually do try to set $PKG_CONFIG (to something other than a fully-qualified path), instead, the extremely well-tested pkg.m4 macro provided by pkg-config itself, which forms the autotools standard, should be used.

Please use #3632 instead. Apologies for not submitting it much, much sooner.

@eli-schwartz
Copy link
Contributor

Using the pkg-config macros is also preferable, because it will add ./configure --help hints for the PKG_CONFIG* variables available to use, and additionally it will allow using FREETYPE2_CFLAGS/FREETYPE2_LIBS to override pkg-config detection (and hint about that too).

@oerdnj
Copy link
Contributor Author

oerdnj commented Oct 22, 2018

@eli-schwartz Sure, but there are several other cases where pkg-config is used like this, so I would rather suggest to separate these two issues and have a quick fix for freetype2 and then fix pkg-config throughout the whole source tree.

@eli-schwartz
Copy link
Contributor

eli-schwartz commented Oct 22, 2018

I could work on porting the other uses of pkg-config over. :)
(A proper fix for freetype which pulls in pkg.m4 does not need to state anything about the rest of the tree, so I see no reason to separate this.)

I started on curl, pushed to a new branch to avoid forcing it in my PR, see https://github.com/eli-schwartz/php-src/commits/pkg-config-everywhere

@eli-schwartz
Copy link
Contributor

Also your PR leaves the configure help slightly confusing, e.g. what does --with-freetype-dir do when pkg-config is in use?

@cmb69
Copy link
Member

cmb69 commented Oct 22, 2018

Also your PR leaves the configure help slightly confusing, e.g. what does --with-freetype-dir do when pkg-config is in use?

Well, the patch could be rewritten so that an explicitly given --with-freetype-dir would be used like before (i.e. no pkg-config involvement).

@weltling
Copy link
Contributor

--with-freetype-dir should be preferred, if passed. That allows to link to a custom lib version even the system one is installed and registered to pkg-config. Otherwise users will be forced to uninstall the system lib and some unrelated packages might depend on it. It gives also more flexibility for developers on adopting new lib versions. IMO that's the only point the current patch should take care about.

The migration to the pkg-config macro makes sense but probably should be done as a separate effort. When the macro is added and all the relevant places are migrated, new PRs can use it.

Thanks.

@oerdnj
Copy link
Contributor Author

oerdnj commented Oct 30, 2018

Usually, it’s better (and enough) to pass correct directory in PKG_CONFIG_PATH for a custom installation.

@weltling
Copy link
Contributor

Would the path order in PKG_CONFIG_PATH be respected? Fe a lib is in both system and a custom prefix, would export PKG_CONFIG_PATH=/my/lib/prefix:$PKG_CONFIG_PATH mean pkg-config would check in /my/lib/prefix first?

Thanks.

@cmb69
Copy link
Member

cmb69 commented Oct 30, 2018

If --with-freetype-dir would ignore its argument, the option should better be changed to --enable-freetype – otherwise it would rather be confusing.

@nikic
Copy link
Member

nikic commented Nov 7, 2018

I've merged the variant at #3632 for master. Do we maybe still want to land this PR (which is less intrusive and essentially backwards compatible) for older versions?

@cmb69
Copy link
Member

cmb69 commented Nov 7, 2018

IMO fine for PHP-7.3 (at least), iff we resolve the issue that --with-freetype-dir ignores the passed directory (so either rename to --enable-freetype or prefer the passed directory over pkg-config).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants