Bug #76324 [Com]: [ext/gd] cannot detect recent versions of freetype with pkg-config

From: Date: Sat, 25 Apr 2020 17:28:55 +0000
Subject: Bug #76324 [Com]: [ext/gd] cannot detect recent versions of freetype with pkg-config
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226771@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76324&edit=1

 ID:                 76324
 Comment by:         calvin at cmpct dot info
 Reported by:        eschwartz at archlinux dot org
 Summary:            [ext/gd] cannot detect recent versions of freetype
                     with pkg-config
 Status:             Closed
 Type:               Bug
 Package:            Compile Failure
 Operating System:   unix-like
 PHP Version:        Irrelevant
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Could this be backported to PHP 7.3? I'm running into this on a platform where freetype got
upgraded.


Previous Comments:
------------------------------------------------------------------------
[2020-03-21 16:11:10] cmb@php.net

This is already fixed as of PHP 7.4.0.

------------------------------------------------------------------------
[2018-10-22 15:10:28] eschwartz at archlinux dot org

Also https://github.com/php/php-src/commit/cf3b852109a88a11370d0207cd3b72a53b6a64c3
helped to make it easier to submit clean patches that apply. :)

------------------------------------------------------------------------
[2018-10-22 15:02:59] eschwartz at archlinux dot org

My apologies for forgetting about this yet again -- I've submitted https://github.com/php/php-src/pull/3632 as the
original approach, which I believe is superior to ondrej's "simplest patch possible".

Note that the pkg-config program provides battle-tested autotools macros to do this in the proper,
approved way. Using these macros will properly handle e.g. PKG_CONFIG='pkg-config
--static' (handy when downstream builders wish to statically compile a program), which the
simple patch fails on two counts -- it does not do path resolution, and it assumes the content is a
possibly-whitespace-included-path, which prevents the possibility of overriding some obscure
pkg-config behavior via command-line flags.

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).

------------------------------------------------------------------------
[2018-10-22 07:00:39] ondrej@php.net

Ok, so this should be the simplest patch possible to make PHP use pkg-config for FreeType2 if
pkg-config is available:

https://github.com/php/php-src/pull/3630

------------------------------------------------------------------------
[2018-07-04 12:10:43] fred5 at originsystems dot co dot za

Hi Eli? :o)

At the outset I should acknowledge that I'm very unfamiliar with the patching process as have
never had to do before. I opened bug #76310 because our PHP build - which has always worked
perfectly - "suddenly" started applying the incorrect, older OS native freetype version
2.4.11 (instead of 2.7.1). 

I am under some pressure to get this sorted out as we need to release a new build, so have attempted
to use your provided patch as follows:

1. downloaded php-7.2.7.tar.gz release from http://uk3.php.net/distributions
2. extract
3. download your patch (called 0001.patch from now on) to the extracted PHP directory
4. cd to the extracted PHP directory
5. run the command "patch < 0001.patch"   (with no switches at all)
.... got the errors shown in previous post.

I acknowledge this may be completely wrong due to my lack of knowledge and am explaining above
simply to make sure the use case is clear when looking at the output. Thanks again for your help on
this.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=76324


--
Edit this bug report at https://bugs.php.net/bug.php?id=76324&edit=1


Thread (17 messages)

« previous php.bugs (#226771) next »