Created attachment 207902 [details] patch php74 introduced C11 requirement and all optional PHP modules available in the ports tree need a patch like this: .include <bsd.port.options.mk> .if ${FLAVOR} == php74 USES+=compiler:c11 .endif With over 400 ports that need, it's not feasible to fix. And there will be php75 (or 80) next year which will require all those ports to be fixed again. Change php.mk to fix it in one place. Additionally, fix a typo.
Don't commit it yet, it looks like the ports that I was testing it for were inheriting compiler:c11 from lang/php74. It doesn't seem to work for ports that don't. root@talos:$/usr/ports/security/pecl-mcrypt$ make FLAVOR=php74 -V USES php:pecl compiler:c11 root@talos:$/usr/ports/security/pecl-mcrypt$ make FLAVOR=php74 -V CC cc
Created attachment 207931 [details] v2 This seems to work, but powerpc* switches to LLVM when LLVM9 is merged to head, so it will need some modifications in the coming weeks.
Why the previous patch doesn't work and why do we not have USE_GCC for those archs in lang/php74 Makefile?
(In reply to Alex Dupre from comment #3) "Why the previous patch doesn't work" It's probably because USES is added too late, it should be in the Makefile instead. When added to Mk/Uses, USES value is actually changed, but CC doesn't change. Look at Mk/Uses/qt-dist.mk, it's done the same way. "why do we not have USE_GCC for those archs in lang/php74 Makefile" We do have USES=compiler:c11 (which sets USE_GCC on GCC platforms), but that only works for php74 and the ports that include lang/php74/Makefile (all */php74-* ports, e.g. archivers/php74-bz2).
Approved as mentor (builds on ppcports and a generic x86 system) pending portmgr approval.
I think the patch is not good, it should be PHP_FLAVOR, not FLAVOR.
(In reply to Antoine Brodin from comment #6) PHP_FLAVOR causes: make: "/usr/home/pkubaj/ports/Mk/Uses/php.mk" line 162: Malformed conditional (${PHP_FLAVOR} == php74 && (${ARCH:Mmips*} || ${A RCH:Mpowerpc*} || ${ARCH} == sparc64)) FLAVOR works.
(In reply to Piotr Kubaj from comment #7) sure, because you have to put it line 165 or something
I also tried that, but didn't report, because it didn't change the behaviour. pkubaj@talos:$/usr/home/pkubaj/ports$ make FLAVOR=php74 -C archivers/pecl-rar -V CC cc
Also, putting FLAVOR works, I'm just finishing a bulk -a build with this patch: https://talos.anongoth.pl/build.html?mastername=powerpc64-default&build=2019-10-18_09h28m35s
Using FLAVOR is probably wrong. It should check that the current PHP version is 7.4. For example, if a PHP module does not have flavors for some reason, it still need to change compiler if the default PHP version is 7.4.
(In reply to Mathieu Arnold from comment #11) It should be enough to replace: .if ${FLAVOR} == php74 with .if ${PHP_VER} == 74 in the pkubaj patch.
Created attachment 208875 [details] v3 Yes, this seems enough: root@talos:$/usr/ports$ make -C archivers/pecl-rar -V CC gcc9 Thanks for pointing it out.
As a side note, do you keep track of all thoses places you added ".if powerpc/sparc/mips -> USE_GCC" in case one day llvm works on one of those architectures one day?
(In reply to Mathieu Arnold from comment #14) In Mk there's only one such file (qt-dist.mk). I don't keep track of those .ifs put into ports' Makefiles, but they are very easy to find. I always keep those architectures listed in the same order, so "find /usr/ports -depth 3 -name Makefile -exec grep ...." will find it.
(In reply to Mathieu Arnold from comment #14) Since you're in this bug anyway, do you accept this patch as a mentor?
Sure, go ahead.
A commit references this bug: Author: pkubaj Date: Wed Nov 6 17:01:40 UTC 2019 New revision: 516904 URL: https://svnweb.freebsd.org/changeset/ports/516904 Log: Mk/Uses/php.mk: fix build of all PHP modules when using php74 on GCC architectures php74 introduced C11 requirement and all optional PHP modules available in the ports tree need to use C11 compiler. PR: 240883 Approved by: portmgr Changes: head/Mk/Uses/php.mk