Skip to contentSkip to conversation

libxml2: make dependencies on python conditional

PATCH Superseded Dmitry Rozhkov 2 participants 2 messages Apr 3, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxml2: make dependencies on python conditional

The library libxml2 can provide its own bindings for python2 in addition to the third party python-lxml and python3-lxml packages if this functionality is enabled in PACKAGECONFIG.

But in case the functionality is disabled there's no need to depend on python2.

Make the dependency on python2 enabled only if the python feature is added to PACKAGECONFIG. Also don't produce the binary package libxml2-python if it's not needed.

---
 meta/recipes-core/libxml/libxml2_2.9.4.bb | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
meta/recipes-core/libxml/libxml2_2.9.4.bb +6 -3
index 023fe99..1c629d1 100644
@@ -32,9 +32,11 @@ SRC_URI[testtar.sha256sum] = "96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c
 
 BINCONFIG = "${bindir}/xml2-config"
 
-inherit autotools pkgconfig binconfig-disabled pythonnative ptest
+inherit autotools pkgconfig binconfig-disabled ptest
 
-RDEPENDS_${PN}-ptest += "python-core"
+inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'pythonnative', '', d)}
+
+RDEPENDS_${PN}-ptest += "make ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python-core', '', d)}"
 
 RDEPENDS_${PN}-python += "python-core"
 
@@ -60,7 +62,8 @@ python populate_packages_prepend () {
         d.setVar('PKG_libxml2', '${MLPREFIX}libxml2')
 }
 
-PACKAGES += "${PN}-utils ${PN}-python"
+PACKAGES += "${PN}-utils \
+             ${@bb.utils.contains('PACKAGECONFIG', 'python', '${PN}-python', '', d)}"
 
 FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
 FILES_${PN}-dev += "${libdir}/xml2Conf.sh ${libdir}/cmake/*"
Signature · 1 line
2.9.3
#1 lore raw
Quoted 11 lines · Dmitry Rozhkov

The library libxml2 can provide its own bindings for python2 in addition to the third party python-lxml and python3-lxml packages if this functionality is enabled in PACKAGECONFIG.

But in case the functionality is disabled there's no need to depend on python2.

Make the dependency on python2 enabled only if the python feature is added to PACKAGECONFIG. Also don't produce the binary package libxml2-python if it's not needed.

| ERROR: oe_runmake failed
| cc1: warning: include location "/usr/include/python3.4m" is unsafe for cross-compilation [-Wpoison-system-directories]
| cc1: warning: include location "/usr/include/python3.4m" is unsafe for cross-compilation [-Wpoison-system-directories]
| cc1: warning: include location "/usr/include/python3.4m" is unsafe for cross-compilation [-Wpoison-system-directories]

| In file included from /usr/include/python3.4m/Python.h:8:0,
|                  from ../../libxml2-2.9.4/python/libxml2-py.c:3:
| /usr/include/python3.4m/pyconfig.h:3:52: fatal error:
x86_64-linux-gnu/python3.4m/pyconfig.h: No such file or directory
|  #  include <x86_64-linux-gnu/python3.4m/pyconfig.h>
|                                                     ^
| In file included from /usr/include/python3.4m/Python.h:8:0,
|                  from ../../libxml2-2.9.4/python/libxml_wrap.h:1,
|                  from ../../libxml2-2.9.4/python/types.c:9:
| /usr/include/python3.4m/pyconfig.h:3:52: fatal error:
x86_64-linux-gnu/python3.4m/pyconfig.h: No such file or directory
|  #  include <x86_64-linux-gnu/python3.4m/pyconfig.h>
|                                                     ^
| compilation terminated.
| compilation terminated.
| Makefile:625: recipe for target 'types.lo' failed
| make[4]: *** [types.lo] Error 1
| make[4]: *** Waiting for unfinished jobs....
| Makefile:625: recipe for target 'libxml2-py.lo' failed
| make[4]: *** [libxml2-py.lo] Error 1
| In file included from /usr/include/python3.4m/Python.h:8:0,
|                  from ../../libxml2-2.9.4/python/libxml.c:14:
| /usr/include/python3.4m/pyconfig.h:3:52: fatal error:
x86_64-linux-gnu/python3.4m/pyconfig.h: No such file or directory
|  #  include <x86_64-linux-gnu/python3.4m/pyconfig.h>
|                                                     ^
| compilation terminated.
| Makefile:625: recipe for target 'libxml.lo' failed

Something went wrong... Promise it built before I applied the patch. Also the PACKAGES change shouldn't be required as an empty package won't be generated.

Ross