Patchwork [1/1] pyrex: new package

login
register
mail settings
Submitter Matt Weber
Date Sept. 20, 2013, 6:09 p.m.
Message ID <1379700560-10738-1-git-send-email-mlweber1@rockwellcollins.com>
Download mbox | patch
Permalink /patch/276585/
State Superseded
Headers show

Comments

Matt Weber - Sept. 20, 2013, 6:09 p.m.
Signed-off-by: Matt Weber <mlweber1@rockwellcollins.com>
---
 package/Config.in                    |    1 +
 package/python-pyrex/Config.in       |    7 ++++++
 package/python-pyrex/python-pyrex.mk |   37 ++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 0 deletions(-)
 create mode 100644 package/python-pyrex/Config.in
 create mode 100644 package/python-pyrex/python-pyrex.mk
Thomas Petazzoni - March 3, 2014, 9:04 p.m.
Dear Matt Weber,

On Fri, 20 Sep 2013 13:09:20 -0500, Matt Weber wrote:

> index 0000000..551c15c
> --- /dev/null
> +++ b/package/python-pyrex/Config.in
> @@ -0,0 +1,7 @@
> +config BR2_PACKAGE_PYTHON_PYREX
> +	bool "pyrex"
> +	depends on BR2_PACKAGE_PYTHON
> +	help
> +	  Pyrex is a language for writing Python extension modules
> +
> +	  http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/

If I understand correctly what Pyrex is, it is a tool that generates C
code that then needs to be compiled with gcc. At least that's what I
understand from http://ldots.org/pyrex-guide/2-compiling.html.

Therefore, I am wondering how useful it is to support the installation
of python-pyrex to the target, while we don't have the support for
providing a compiler on the target.

Is there something I have missed about Pyrex?

Thanks,

Thomas
Matt Weber - March 4, 2014, 3:16 p.m.
Hi Thomas, 

> From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> To: Matt Weber <mlweber1@rockwellcollins.com>
> Cc: buildroot@busybox.net, "Ryan Barnett" <rjbarnet@rockwellcollins.com>
> Date: 03/03/2014 03:04 PM
> Subject: Re: [Buildroot] [PATCH 1/1] pyrex: new package
> 
> Dear Matt Weber,
> 
> On Fri, 20 Sep 2013 13:09:20 -0500, Matt Weber wrote:
> 
> > index 0000000..551c15c
> > --- /dev/null
> > +++ b/package/python-pyrex/Config.in
> > @@ -0,0 +1,7 @@
> > +config BR2_PACKAGE_PYTHON_PYREX
> > +   bool "pyrex"
> > +   depends on BR2_PACKAGE_PYTHON
> > +   help
> > +     Pyrex is a language for writing Python extension modules
> > +
> > +     http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
> 
> If I understand correctly what Pyrex is, it is a tool that generates C
> code that then needs to be compiled with gcc. At least that's what I
> understand from http://ldots.org/pyrex-guide/2-compiling.html.
> 
> Therefore, I am wondering how useful it is to support the installation
> of python-pyrex to the target, while we don't have the support for
> providing a compiler on the target.
> 
You are correct.  Our use case was just as a host tool to aid in our
application build using the sysroot and not on target.

Thanks,
Matt Weber
Thomas Petazzoni - March 4, 2014, 3:23 p.m.
Matt,

On Tue, 4 Mar 2014 09:16:20 -0600, mlweber1@rockwellcollins.com wrote:

> > If I understand correctly what Pyrex is, it is a tool that generates C
> > code that then needs to be compiled with gcc. At least that's what I
> > understand from http://ldots.org/pyrex-guide/2-compiling.html.
> > 
> > Therefore, I am wondering how useful it is to support the installation
> > of python-pyrex to the target, while we don't have the support for
> > providing a compiler on the target.
> > 
> You are correct.  Our use case was just as a host tool to aid in our
> application build using the sysroot and not on target.

Ok, but then python-pyrex should be packaged as a host package, not as
a target package as you did, no?

Do you intend to resend an updated version which packages python-pyrex
as a host tool instead?

Thanks,

Thomas
Matt Weber - March 4, 2014, 3:27 p.m.
Thomas, 

> From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> To: mlweber1@rockwellcollins.com
> Cc: buildroot@busybox.net, "Ryan Barnett" <rjbarnet@rockwellcollins.com>
> Date: 03/04/2014 09:23 AM
> Subject: Re: [Buildroot] [PATCH 1/1] pyrex: new package
> 
<snip>
> 
> Ok, but then python-pyrex should be packaged as a host package, not as
> a target package as you did, no?
> 
> Do you intend to resend an updated version which packages python-pyrex
> as a host tool instead?
No problem, I'll resend with it updated as a host tool!

Thanks
Matt

Patch

diff --git a/package/Config.in b/package/Config.in
index e187aa3..1dc46c3 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -395,6 +395,7 @@  source "package/python-nfc/Config.in"
 source "package/python-protobuf/Config.in"
 source "package/python-pygame/Config.in"
 source "package/python-pyparsing/Config.in"
+source "package/python-pyrex/Config.in"
 source "package/python-pyro/Config.in"
 source "package/python-pyzmq/Config.in"
 source "package/python-serial/Config.in"
diff --git a/package/python-pyrex/Config.in b/package/python-pyrex/Config.in
new file mode 100644
index 0000000..551c15c
--- /dev/null
+++ b/package/python-pyrex/Config.in
@@ -0,0 +1,7 @@ 
+config BR2_PACKAGE_PYTHON_PYREX
+	bool "pyrex"
+	depends on BR2_PACKAGE_PYTHON
+	help
+	  Pyrex is a language for writing Python extension modules
+
+	  http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
diff --git a/package/python-pyrex/python-pyrex.mk b/package/python-pyrex/python-pyrex.mk
new file mode 100644
index 0000000..28eb8ae
--- /dev/null
+++ b/package/python-pyrex/python-pyrex.mk
@@ -0,0 +1,37 @@ 
+################################################################################
+#
+# python-pyrex
+#
+################################################################################
+
+PYTHON_PYREX_VERSION = 0.9.9
+PYTHON_PYREX_SOURCE = Pyrex-$(PYTHON_PYREX_VERSION).tar.gz
+PYTHON_PYREX_SITE = http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
+PYTHON_PYREX_DEPENDENCIES = python host-python
+PYTHON_PYREX_LICENSE = Apache-v2
+PYTHON_PYREX_LICENSE_FILES = LICENSE.txt
+
+PYTHON_PYREX_PARAMS = CC="$(TARGET_CC)" \
+		CFLAGS="$(TARGET_CFLAGS)" \
+		LDSHARED="$(TARGET_CC) -shared" \
+		CROSS_COMPILING=yes \
+		_python_sysroot=$(STAGING_DIR) \
+		_python_srcdir=$(PYTHON_DIR) \
+		_python_prefix=/usr \
+		_python_exec_prefix=/usr
+
+define PYTHON_PYREX_BUILD_CMDS
+	(cd $(@D); $(PYTHON_PYREX_PARAMS) \
+		$(HOST_DIR)/usr/bin/python setup.py build \
+	)
+endef
+
+define PYTHON_PYREX_INSTALL_TARGET_CMDS
+	(cd $(@D); \
+		$(PYTHON_PYREX_PARAMS) \
+		$(HOST_DIR)/usr/bin/python setup.py install \
+		--prefix=$(TARGET_DIR)/usr; \
+		$(SED) "s:$(HOST_DIR)/usr:/usr:g" $(TARGET_DIR)/usr/bin/pyrexc )
+endef
+
+$(eval $(generic-package))