Patchwork [3/6] php-zmq: new package

login
register
mail settings
Submitter Gustavo Zacarias
Date Jan. 28, 2014, 9:26 p.m.
Message ID <1390944391-3892-3-git-send-email-gustavo@zacarias.com.ar>
Download mbox | patch
Permalink /patch/314838/
State Accepted
Commit efeda1bc487339beeeb9a1b58ab1fb241da6f548
Headers show

Comments

Gustavo Zacarias - Jan. 28, 2014, 9:26 p.m.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 package/Config.in          | 10 ++++++++++
 package/php-zmq/Config.in  | 17 +++++++++++++++++
 package/php-zmq/php-zmq.mk | 25 +++++++++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100644 package/php-zmq/Config.in
 create mode 100644 package/php-zmq/php-zmq.mk
Thomas Petazzoni - Jan. 28, 2014, 10:05 p.m.
Dear Gustavo Zacarias,

On Tue, 28 Jan 2014 18:26:28 -0300, Gustavo Zacarias wrote:
> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
> ---
>  package/Config.in          | 10 ++++++++++
>  package/php-zmq/Config.in  | 17 +++++++++++++++++
>  package/php-zmq/php-zmq.mk | 25 +++++++++++++++++++++++++
>  3 files changed, 52 insertions(+)
>  create mode 100644 package/php-zmq/Config.in
>  create mode 100644 package/php-zmq/php-zmq.mk

Just curious, how many potential PHP packages could we add? The build
logic for the four packages you submitted looks highly similar, maybe
it calls a php-package infrastructure?

The only "difficulty" is that it would have to inherit from
autotools-package, which itself already inherits from generic-package.
So it would be the first package infrastructure to inherit from a
package infra that already inherits from generic-package. I'm sure it
can work, but it might raise issues with some missing quoting.

Thomas
Gustavo Zacarias - Jan. 28, 2014, 10:11 p.m.
On 01/28/2014 07:05 PM, Thomas Petazzoni wrote:

> Just curious, how many potential PHP packages could we add? The build
> logic for the four packages you submitted looks highly similar, maybe
> it calls a php-package infrastructure?
> 
> The only "difficulty" is that it would have to inherit from
> autotools-package, which itself already inherits from generic-package.
> So it would be the first package infrastructure to inherit from a
> package infra that already inherits from generic-package. I'm sure it
> can work, but it might raise issues with some missing quoting.

Not that many that are useful, many are abandonware, that being the
reason i opted for the autotools infra with the tweak.
PECL packages are compiled (these ones are), PEAR packages are normally
interpreted so it's just a matter of just installing them.
Arguably we could also enable PEAR installs in the target itself but i
don't think it's the spirit of buildroot, like CPAN for perl.
But we don't have any PEAR packages at the moment.
Regards.
Thomas Petazzoni - Jan. 28, 2014, 10:16 p.m.
Dear Gustavo Zacarias,

On Tue, 28 Jan 2014 19:11:55 -0300, Gustavo Zacarias wrote:

> > Just curious, how many potential PHP packages could we add? The build
> > logic for the four packages you submitted looks highly similar, maybe
> > it calls a php-package infrastructure?
> > 
> > The only "difficulty" is that it would have to inherit from
> > autotools-package, which itself already inherits from generic-package.
> > So it would be the first package infrastructure to inherit from a
> > package infra that already inherits from generic-package. I'm sure it
> > can work, but it might raise issues with some missing quoting.
> 
> Not that many that are useful, many are abandonware, that being the
> reason i opted for the autotools infra with the tweak.
> PECL packages are compiled (these ones are), PEAR packages are normally
> interpreted so it's just a matter of just installing them.
> Arguably we could also enable PEAR installs in the target itself but i
> don't think it's the spirit of buildroot, like CPAN for perl.
> But we don't have any PEAR packages at the moment.

Ok. Then I guess we should go ahead with what you proposed, and only
introduce a PHP package infra if we get over 10 PHP packages or so.

Thanks!

Thomas

Patch

diff --git a/package/Config.in b/package/Config.in
index f4c1c17..5c91d9a 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -395,6 +395,16 @@  source "package/cpanminus/Config.in"
 endmenu
 endif
 source "package/php/Config.in"
+if BR2_PACKAGE_PHP
+if !BR2_PREFER_STATIC_LIB
+menu "External php extensions"
+source "package/php-zmq/Config.in"
+endmenu
+endif
+if BR2_PREFER_STATIC_LIB
+comment "External PHP extensions need a toolchain w/ dynamic library"
+endif
+endif
 source "package/python/Config.in"
 if BR2_PACKAGE_PYTHON
 menu "external python modules"
diff --git a/package/php-zmq/Config.in b/package/php-zmq/Config.in
new file mode 100644
index 0000000..f32b5a3
--- /dev/null
+++ b/package/php-zmq/Config.in
@@ -0,0 +1,17 @@ 
+comment "php-zmq needs a toolchain w/ C++, IPv6, largefile, wchar, threads"
+	depends on !(BR2_INSTALL_LIBSTDCPP && BR2_INET_IPV6 && BR2_LARGEFILE \
+		&& BR2_USE_WCHAR && BR2_TOOLCHAIN_HAS_THREADS)
+
+config BR2_PACKAGE_PHP_ZMQ
+	bool "php-zmq"
+	depends on BR2_PACKAGE_PHP
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_INET_IPV6
+	depends on BR2_LARGEFILE # util-linux
+	depends on BR2_USE_WCHAR # util-linux
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	select BR2_PACKAGE_ZEROMQ
+	help
+	  ZeroMQ messaging bindings for PHP
+
+	  http://pecl.php.net/package/zmq
diff --git a/package/php-zmq/php-zmq.mk b/package/php-zmq/php-zmq.mk
new file mode 100644
index 0000000..2b48a63
--- /dev/null
+++ b/package/php-zmq/php-zmq.mk
@@ -0,0 +1,25 @@ 
+################################################################################
+#
+# php-zmq
+#
+################################################################################
+
+PHP_ZMQ_VERSION = 1.1.2
+PHP_ZMQ_SOURCE = zmq-$(PHP_ZMQ_VERSION).tgz
+PHP_ZMQ_SITE = http://pecl.php.net/get
+# phpize does the autoconf magic
+PHP_ZMQ_DEPENDENCIES = php zeromq host-autoconf host-pkgconf
+PHP_ZMQ_CONF_OPT = --with-php-config=$(STAGING_DIR)/usr/bin/php-config
+PHP_ZMQ_LICENSE = BSD-3c
+PHP_ZMQ_LICENSE_FILES = LICENSE
+
+define PHP_ZMQ_PHPIZE
+	(cd $(@D); \
+		PHP_AUTOCONF=$(HOST_DIR)/usr/bin/autoconf \
+		PHP_AUTOHEADER=$(HOST_DIR)/usr/bin/autoheader \
+		$(STAGING_DIR)/usr/bin/phpize)
+endef
+
+PHP_ZMQ_PRE_CONFIGURE_HOOKS += PHP_ZMQ_PHPIZE
+
+$(eval $(autotools-package))