Skip to contentSkip to conversation

php: rework selection of interfaces

PATCH New Fabrice Fontaine 2 participants 2 messages Sep 12, 2016 – Oct 24, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 php: rework selection of interfaces

Following suggestion of Yann Morin, rework selection of php interfaces:
use booleans instead of choice to be able to select multiple interfaces as they are not exclusive

The choice was introduced in commit fcdc9f891 to make sure at least one SAPI option was selected. Here, we use an auxiliary symbol BR2_PACKAGE_PHP_HAS_SAPI and CGI will be selected if this symbol is not set.

It should be noted that previously CGI and FPM could not be selected at the same time. This is now possible. Bug that prevented compilation of CGI and FPM binaries at the same time has been fixed since PHP 5.4
(https://github.com/php-build/php-build/issues/101)

---
Changes v1 -> v2 (after review of Arnout Vandecappelle):
- Update commit message
- Add more comments on BR2_PACKAGE_PHP_HAS_SAPI
- Add "interface" to SAPI option prompt
- Explicitly reference in commit message that bug that prevented compilation of CGI and FPM binaries at the same time has been fixed since PHP 5.4
- Move user-settable option BR2_PACKAGE_PHP_SAPI_CLI_CGI and BR2_PACKAGE_PHP_SAPI_CLI_FPM to Config.in.legacy
- Explicitly set --enable-cgi and --enable-cli in php.mk

 Config.in.legacy      | 16 ++++++++++++++++
 package/php/Config.in | 47 +++++++++--------------------------------------
 package/php/php.mk    |  8 ++++----
 3 files changed, 29 insertions(+), 42 deletions(-)
Config.in.legacy +16 -0
index 60d414b..6e7b6d9 100644
@@ -169,6 +169,22 @@ config BR2_LINUX_KERNEL_CUSTOM_LOCAL
 	  In case you were using this option during development of your
 	  Linux kernel, use the override mechanism instead.
 
+config BR2_PACKAGE_PHP_SAPI_CLI_CGI
+	bool "PHP CGI and CLI option is split up"
+	select BR2_PACKAGE_PHP_SAPI_CLI
+	select BR2_PACKAGE_PHP_SAPI_CGI
+	help
+	  The PHP Interface options have been split up into a
+	  separate option for each interface.
+
+config BR2_PACKAGE_PHP_SAPI_CLI_FPM
+	bool "PHP CLI and FPM option is split up"
+	select BR2_PACKAGE_PHP_SAPI_CLI
+	select BR2_PACKAGE_PHP_SAPI_FPM
+	help
+	  The PHP Interface options have been split up into a
+	  separate option for each interface.
+
 ###############################################################################
 comment "Legacy options removed in 2016.08"
 
package/php/Config.in +9 -38

75 lines not on this page · raw message

package/php/php.mk +4 -4
index 7df10be..2a7e2cd 100644
@@ -77,9 +77,9 @@ else
 PHP_CONF_ENV += ac_cv_func_dlopen=no ac_cv_lib_dl_dlopen=no
 endif
 
-PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_CLI),,--disable-cli)
-PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_CGI),,--disable-cgi)
-PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_FPM),--enable-fpm,--disable-fpm)
+PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),--enable-cli,--disable-cli)
+PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CGI),--enable-cgi,--disable-cgi)
+PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_FPM),--enable-fpm,--disable-fpm)
 
 ### Extensions
 PHP_CONF_OPTS += \
@@ -280,7 +280,7 @@ PHP_CONF_OPTS += \
 PHP_DEPENDENCIES += jpeg libpng freetype
 endif
 
-ifeq ($(BR2_PACKAGE_PHP_FPM),y)
+ifeq ($(BR2_PACKAGE_PHP_SAPI_FPM),y)
 define PHP_INSTALL_INIT_SYSV
 	$(INSTALL) -D -m 0755 $(@D)/sapi/fpm/init.d.php-fpm \
 		$(TARGET_DIR)/etc/init.d/S49php-fpm
Signature · 1 line
2.5.0
#1 lore raw

PATCH v2 1/1 php: rework selection of interfaces

Hello,

Quoted 9 lines · Fabrice Fontaine

Following suggestion of Yann Morin, rework selection of php interfaces:
use booleans instead of choice to be able to select multiple interfaces as they are not exclusive

The choice was introduced in commit fcdc9f891 to make sure at least one SAPI option was selected. Here, we use an auxiliary symbol BR2_PACKAGE_PHP_HAS_SAPI and CGI will be selected if this symbol is not set.

Quoted 6 lines

It should be noted that previously CGI and FPM could not be selected at the same time. This is now possible. Bug that prevented compilation of CGI and FPM binaries at the same time has been fixed since PHP 5.4
(https://github.com/php-build/php-build/issues/101)

I've applied, after changing one thing, see below.

package/php/Config.in config BR2_PACKAGE_PHP · line 16

Quoted 5 lines
package/php/Config.in +3 -1
-config BR2_PACKAGE_PHP_CLI
+# Helper to make sure at least one interface is selected.
+# All SAPI options except CGI will select this symbol.
+config BR2_PACKAGE_PHP_HAS_SAPI
 	bool

This is really not needed. It was much simpler to just do:

	select BR2_PACKAGE_PHP_SAPI_CGI if \
		!BR2_PACKAGE_PHP_SAPI_CLI && \
		!BR2_PACKAGE_PHP_SAPI_FPM

in the main BR2_PACKAGE_PHP option. I've adjusted the commit log accordingly before applying.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com