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

From: Date: Mon, 22 Oct 2018 15:02:59 +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-217653@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:         eschwartz at archlinux dot org
 Reported by:        eschwartz at archlinux dot org
 Summary:            [ext/gd] cannot detect recent versions of freetype
                     with pkg-config
 Status:             Open
 Type:               Bug
 Package:            Compile Failure
 Operating System:   unix-like
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[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.

------------------------------------------------------------------------
[2018-07-03 23:27:13] cmb@php.net

Yeah, I'd prefer a PR for visibility and mergability (I've tried
to git -am the patch, but that failed for PHP-7.1, PHP-7.2 and
master).

Regarding the target branch: if in doubt, target master – this can
still be adjusted.  In this case it might have been a good idea to
switch to pkg-config long ago (see also PR 3341[1]), so treating
this as bug fix and targeting PHP-7.1 accordingly, might be
sensible as well.

Anyway, thanks for your efforts, Eli! :)

[1] <https://github.com/php/php-src/pull/3341>

------------------------------------------------------------------------
[2018-07-03 23:04:01] eschwartz at archlinux dot org

@cmb, if you'd prefer a pull request to a patch, I can open a pull request on Github... which
branch should I target? CONTRIBUTING.md suggests, since I'm fixing a bug, I should submit it to
PHP-7.1 and let it be cherry-picked upwards? Or is it an RFC which should be submitted to master?

I'm used to projects where everything is always submitted to master, no matter what, and only
afterward will commits be cherry-picked for older branches, so I'm not really sure what I
should do here as the CONTRIBUTING.md is giving me mixed messages.

------------------------------------------------------------------------
[2018-07-03 22:23:27] eschwartz at archlinux dot org

I have no idea what that was...

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


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 (#217653) next »