buildroot.buildroot.org archive mirror
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 8/8] package/php: Add Apache support
Date: Sun, 5 Oct 2014 17:56:38 +0200	[thread overview]
Message-ID: <20141005155638.GM4220@free.fr> (raw)
In-Reply-To: <1412516718-12597-8-git-send-email-bernd.kuhls@t-online.de>

Bernd, All,

On 2014-10-05 15:45 +0200, Bernd Kuhls spake thusly:
> 
> Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
> ---
>  package/php/Config.in                            |   17 +++
>  package/php/php-04-cross-compile.only-for-apache |  131 ++++++++++++++++++++++
>  package/php/php.mk                               |   16 +++
>  3 files changed, 164 insertions(+)
>  create mode 100644 package/php/php-04-cross-compile.only-for-apache
> 
> diff --git a/package/php/Config.in b/package/php/Config.in
> index 32faa32..db4e647 100644
> --- a/package/php/Config.in
> +++ b/package/php/Config.in
> @@ -11,6 +11,9 @@ if BR2_PACKAGE_PHP
>  
>  source "package/php/Config.ext"
>  
> +config BR2_PACKAGE_PHP_APACHE
> +	bool
> +
>  config BR2_PACKAGE_PHP_CLI
>  	bool
>  
> @@ -26,6 +29,20 @@ choice
>  	help
>  	  Select the PHP interface(s).
>  
> +config BR2_PACKAGE_PHP_SAPI_APACHE
> +	bool "Apache"
> +	select BR2_PACKAGE_APACHE
> +	select BR2_PACKAGE_PHP_APACHE
> +	depends on !BR2_PREFER_STATIC_LIB # apache
> +	depends on BR2_TOOLCHAIN_HAS_THREADS # apache
> +	depends on BR2_USE_MMU # apr
> +	help
> +	  Apache module
> +
> +comment "apache module needs a toolchain w/ dynamic library, threads"
> +	depends on BR2_USE_MMU
> +	depends on BR2_PREFER_STATIC_LIB || !BR2_TOOLCHAIN_HAS_THREADS
> +

Unrelated to your patch, but this choice is getting ugly. Maybe we should
switch to something like:

    config BR2_PACKAGE_PHP
        bool "php"
        select BR2_PACKAGE_PHP_SAPI_CGI if !BR2_PACKAGE_PHP_HAS_SAPI

    config BR2_PACKAGE_PHP_HAS_SAPI
        bool

    config BR2_PACKAGE_PHP_SAPI_CGI
        bool "CGI"

    config BR2_PACKAGE_PHP_SAPI_CLI
        bool "CLI"
        select BR2_PACKAGE_PHP_HAS_SAPI

    config BR2_PACKAGE_PHP_SAPI_APACHE
        bool "Apache"
        select BR2_PACKAGE_PHP_HAS_SAPI

    config BR2_PACKAGE_PHP_SAPI_FPM
        bool "FPM"
        select BR2_PACKAGE_PHP_HAS_SAPI

That way, we ensure at least one is selected, which was the initial
reason for the choice, while stil allowing multiple to be selected.

Then, if some are incompatible, we could do, for example:

    config BR2_PACKAGE_PHP_SAPI_APACHE
        bool "Apache"
        depends on !BR2_PACKAGE_PHP_SAPI_CLI
        select BR2_PACKAGE_PHP_HAS_SAPI

>  config BR2_PACKAGE_PHP_SAPI_CGI
>  	bool "CGI"
>  	# CGI uses fork()
> diff --git a/package/php/php-04-cross-compile.only-for-apache b/package/php/php-04-cross-compile.only-for-apache
> new file mode 100644
> index 0000000..a72befc
> --- /dev/null
> +++ b/package/php/php-04-cross-compile.only-for-apache
> @@ -0,0 +1,131 @@
> +Fix cross-compilation when used as Apache module.
> +
> +Apache is configured to use the worker MPM which depends on threads.
> +As PHP?s phtread detection is broken in a cross-compile environment, it is not
> +possible to apply this patch unconditionally, since php itself works without
> +thread support,

I have to say I do not like this much. How complex would it be to have a
proper patch that would work both with apache enabled or disabled?

We should try to have such a patch, and push it upstream.

[--SNIP--]
> diff --git a/package/php/php.mk b/package/php/php.mk
> index 2e97c9a..0b32bca 100644
> --- a/package/php/php.mk
> +++ b/package/php/php.mk
> @@ -50,6 +50,22 @@ 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)
>  
> +ifeq ($(BR2_PACKAGE_PHP_APACHE),y)
> +# this patchset is only needed when cross-compiling mod_php for Apache
> +define PHP_PATCH_FOR_APACHE
> +	patch -d $(@D) -p1 -E -i $(TOPDIR)/$(PKGDIR)php-04-cross-compile.only-for-apache

Yes, $(PKGDIR) already has a trailing '/', for for readability, I'd
prefer we add one here. Multiple '/' in a path are innocuous.

Regards,
Yann E. MORIN.

> +endef
> +PHP_POST_PATCH_HOOKS += PHP_PATCH_FOR_APACHE
> +PHP_CONF_OPTS += \
> +	--with-apxs2=$(STAGING_DIR)/usr/bin/apxs \
> +	--with-config-file-path=/etc/apache2 \
> +	--with-config-file-scan-dir=/etc/apache2/php \
> +	--oldincludedir=$(STAGING_DIR)/usr/include \
> +	--enable-pthreads \
> +	--localstatedir=/var
> +PHP_DEPENDENCIES += apache
> +endif
> +
>  ### Extensions
>  PHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_EXT_SOCKETS),--enable-sockets) \
>  		$(if $(BR2_PACKAGE_PHP_EXT_POSIX),--enable-posix) \
> -- 
> 1.7.10.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2014-10-05 15:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-05 13:45 [Buildroot] [PATCH 1/8] package/apr: Bump version to 1.5.1 Bernd Kuhls
2014-10-05 13:45 ` [Buildroot] [PATCH 2/8] package/apr: Fix detection of rlimit and large file support Bernd Kuhls
2014-10-05 14:48   ` Yann E. MORIN
2014-10-05 13:45 ` [Buildroot] [PATCH 3/8] package/apr-util: Add comment to describe toolchain dependencies Bernd Kuhls
2014-10-05 14:45   ` Yann E. MORIN
2014-10-05 16:01   ` Thomas Petazzoni
2014-10-05 13:45 ` [Buildroot] [PATCH 4/8] package/apr-util: Bump version to 1.5.4 Bernd Kuhls
2014-10-05 13:45 ` [Buildroot] [PATCH 5/8] package/apr-util: Rework dependencies Bernd Kuhls
2014-10-05 15:00   ` Yann E. MORIN
2014-10-05 13:45 ` [Buildroot] [PATCH 6/8] package/apr: Fix for Apache when listening to multiple ports Bernd Kuhls
2014-10-05 15:04   ` Yann E. MORIN
2014-10-05 13:45 ` [Buildroot] [PATCH 7/8] Apache: New package Bernd Kuhls
2014-10-05 15:23   ` Yann E. MORIN
2014-10-05 13:45 ` [Buildroot] [PATCH 8/8] package/php: Add Apache support Bernd Kuhls
2014-10-05 15:56   ` Yann E. MORIN [this message]
2014-10-05 16:48     ` Gustavo Zacarias
2014-10-05 14:42 ` [Buildroot] [PATCH 1/8] package/apr: Bump version to 1.5.1 Yann E. MORIN
2014-10-05 16:16   ` Thomas Petazzoni
2014-10-05 16:30     ` Bernd Kuhls

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141005155638.GM4220@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).