diff mbox

[v2,3/3] python-cffi: add host variant

Message ID 1451978244-15878-4-git-send-email-yegorslists@googlemail.com
State Accepted
Headers show

Commit Message

Yegor Yefremov Jan. 5, 2016, 7:17 a.m. UTC
From: Yegor Yefremov <yegorslists@googlemail.com>

Host variant is needed to cross-compile CFFI based C library wrappers.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
Changes:
	v2: add host-libffi dependency

 package/python-cffi/python-cffi.mk | 2 ++
 1 file changed, 2 insertions(+)

Comments

Yegor Yefremov Jan. 5, 2016, 3:40 p.m. UTC | #1
Hello Thomas, Yann,

On Tue, Jan 5, 2016 at 8:17 AM,  <yegorslists@googlemail.com> wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
>
> Host variant is needed to cross-compile CFFI based C library wrappers.
>
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
> Changes:
>         v2: add host-libffi dependency
>
>  package/python-cffi/python-cffi.mk | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/package/python-cffi/python-cffi.mk b/package/python-cffi/python-cffi.mk
> index 70fbe02..02c969b 100644
> --- a/package/python-cffi/python-cffi.mk
> +++ b/package/python-cffi/python-cffi.mk
> @@ -11,5 +11,7 @@ PYTHON_CFFI_SETUP_TYPE = setuptools
>  PYTHON_CFFI_DEPENDENCIES = host-pkgconf libffi
>  PYTHON_CFFI_LICENSE = MIT
>  PYTHON_CFFI_LICENSE_FILES = LICENSE
> +HOST_PYTHON_CFFI_DEPENDENCIES = host-python-pycparser host-libffi
>
>  $(eval $(python-package))
> +$(eval $(host-python-package))
> --

I have now following theory regarding checking dependencies in target
and host variant.

If you look at python-tornado's setup.py file [1], you see, that they
say, install_requires will be checked only for setuptools. This is
also the case for host-python-cffi. The target variant will be
installed with --single-version-externally-managed option, that
performs "old-style" install [2] [3], i.e. without checking
install_requires.

That's my understanding for now.

[1] https://github.com/tornadoweb/tornado/blob/master/setup.py#L126
[2] https://pythonhosted.org/setuptools/setuptools.html
[3] https://bitbucket.org/pypa/setuptools/src/e517fced669d54bcaf3da2d8ca468d29120fedfc/setuptools/command/install.py?at=default&fileviewer=file-view-default#install.py-58

Yegor
Yegor Yefremov Jan. 5, 2016, 3:45 p.m. UTC | #2
On Tue, Jan 5, 2016 at 4:40 PM, Yegor Yefremov
<yegorslists@googlemail.com> wrote:
> Hello Thomas, Yann,
>
> On Tue, Jan 5, 2016 at 8:17 AM,  <yegorslists@googlemail.com> wrote:
>> From: Yegor Yefremov <yegorslists@googlemail.com>
>>
>> Host variant is needed to cross-compile CFFI based C library wrappers.
>>
>> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
>> ---
>> Changes:
>>         v2: add host-libffi dependency
>>
>>  package/python-cffi/python-cffi.mk | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/package/python-cffi/python-cffi.mk b/package/python-cffi/python-cffi.mk
>> index 70fbe02..02c969b 100644
>> --- a/package/python-cffi/python-cffi.mk
>> +++ b/package/python-cffi/python-cffi.mk
>> @@ -11,5 +11,7 @@ PYTHON_CFFI_SETUP_TYPE = setuptools
>>  PYTHON_CFFI_DEPENDENCIES = host-pkgconf libffi
>>  PYTHON_CFFI_LICENSE = MIT
>>  PYTHON_CFFI_LICENSE_FILES = LICENSE
>> +HOST_PYTHON_CFFI_DEPENDENCIES = host-python-pycparser host-libffi
>>
>>  $(eval $(python-package))
>> +$(eval $(host-python-package))
>> --
>
> I have now following theory regarding checking dependencies in target
> and host variant.
>
> If you look at python-tornado's setup.py file [1], you see, that they
> say, install_requires will be checked only for setuptools. This is
> also the case for host-python-cffi. The target variant will be
> installed with --single-version-externally-managed option, that
> performs "old-style" install [2] [3], i.e. without checking
> install_requires.
>
> That's my understanding for now.
>
> [1] https://github.com/tornadoweb/tornado/blob/master/setup.py#L126
> [2] https://pythonhosted.org/setuptools/setuptools.html
> [3] https://bitbucket.org/pypa/setuptools/src/e517fced669d54bcaf3da2d8ca468d29120fedfc/setuptools/command/install.py?at=default&fileviewer=file-view-default#install.py-58

This SO answer also points to this conclusion:
http://stackoverflow.com/a/22179371/1113139

Yegor
Thomas Petazzoni Feb. 3, 2016, 10 p.m. UTC | #3
Hello,

On Tue,  5 Jan 2016 08:17:24 +0100, yegorslists@googlemail.com wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
> 
> Host variant is needed to cross-compile CFFI based C library wrappers.
> 
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
> Changes:
> 	v2: add host-libffi dependency
> 
>  package/python-cffi/python-cffi.mk | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/package/python-cffi/python-cffi.mk b/package/python-cffi/python-cffi.mk
> index 70fbe02..02c969b 100644
> --- a/package/python-cffi/python-cffi.mk
> +++ b/package/python-cffi/python-cffi.mk
> @@ -11,5 +11,7 @@ PYTHON_CFFI_SETUP_TYPE = setuptools
>  PYTHON_CFFI_DEPENDENCIES = host-pkgconf libffi
>  PYTHON_CFFI_LICENSE = MIT
>  PYTHON_CFFI_LICENSE_FILES = LICENSE
> +HOST_PYTHON_CFFI_DEPENDENCIES = host-python-pycparser host-libffi
>  
>  $(eval $(python-package))
> +$(eval $(host-python-package))

This wasn't building properly here, because python-cffi uses pkg-config
to get the flags to link with libffi, and by default our pkg-config
returns results that are valid to build stuff for the target, not for
the host.

So, I've fixed that by passing a bunch of pkg-config environment
variables when building the host package.

Also, you were missing the host-pkgconf dependency for the dependencies
of host variant.

Committed with those issues fixed.

Thanks!

Thomas
diff mbox

Patch

diff --git a/package/python-cffi/python-cffi.mk b/package/python-cffi/python-cffi.mk
index 70fbe02..02c969b 100644
--- a/package/python-cffi/python-cffi.mk
+++ b/package/python-cffi/python-cffi.mk
@@ -11,5 +11,7 @@  PYTHON_CFFI_SETUP_TYPE = setuptools
 PYTHON_CFFI_DEPENDENCIES = host-pkgconf libffi
 PYTHON_CFFI_LICENSE = MIT
 PYTHON_CFFI_LICENSE_FILES = LICENSE
+HOST_PYTHON_CFFI_DEPENDENCIES = host-python-pycparser host-libffi
 
 $(eval $(python-package))
+$(eval $(host-python-package))