Patchwork [1/2] newt: enable python support

login
register
mail settings
Submitter Kang Kai
Date Dec. 12, 2012, 10:48 a.m.
Message ID <58aafb8241ddc377b72b2732c45f3f15fb20f7d6.1355309061.git.kai.kang@windriver.com>
Download mbox | patch
Permalink /patch/40793/
State Accepted
Commit 40bb94f63eafaf4a58e745cd10ce77e28ce3abd2
Headers show

Comments

Kang Kai - Dec. 12, 2012, 10:48 a.m.
Compile newt with python support. There may be packages that need newt's
python extension.

Add python to DEPENDS. And add patch fix_python_fpic.patch to compile
python .so module with flag -fPIC.

Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
 .../newt/files/fix_python_fpic.patch               |   24 ++++++++++++++++++++
 meta/recipes-extended/newt/libnewt_0.52.14.bb      |   24 +++++++++++++++-----
 2 files changed, 42 insertions(+), 6 deletions(-)
 create mode 100644 meta/recipes-extended/newt/files/fix_python_fpic.patch

Patch

diff --git a/meta/recipes-extended/newt/files/fix_python_fpic.patch b/meta/recipes-extended/newt/files/fix_python_fpic.patch
new file mode 100644
index 0000000..3ef94e0
--- /dev/null
+++ b/meta/recipes-extended/newt/files/fix_python_fpic.patch
@@ -0,0 +1,24 @@ 
+Fix relocations warning when compile python module
+
+After enable python support in newt, bitbake complains warning:
+
+WARNING: QA Issue: ELF binary '/mnt/sda10/poky-all-platform/build/tmp/work/i586-poky-linux/libnewt/0.52.14-r2/packages-split/libnewt-python/usr/lib/python2.7/site-packages/_snackmodule.so' has relocations in .text
+
+Add flag -fPIC to compile _snackmodule.so to fix the warning.
+
+Signed-off-by: Kang Kai <kai.kang@windriver.com>
+
+Upstream-Status: Pending
+
+---
+--- newt-0.52.14/Makefile.in	2012-12-04 17:27:27.578915801 +0800
++++ newt-0.52.14/Makefile.in.new	2012-12-04 17:28:43.274918472 +0800
+@@ -84,7 +84,7 @@
+ 			PIFLAGS=`$$ver-config --includes`; \
+ 			PLDFLAGS=`$$ver-config --ldflags`; \
+ 			PLFLAGS=`$$ver-config --libs`; \
+-	        $(CC) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snackmodule.o snackmodule.c ;\
++	        $(CC) $(SHCFLAGS) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snackmodule.o snackmodule.c ;\
+ 	        $(CC) --shared $$PLDFLAGS $$PLFLAGS $(LDFLAGS) -o $$ver/_snackmodule.so $$ver/snackmodule.o -L.  -lnewt $(LIBS);\
+ 	done || :
+ 	touch $@
diff --git a/meta/recipes-extended/newt/libnewt_0.52.14.bb b/meta/recipes-extended/newt/libnewt_0.52.14.bb
index 0208695..c1ec029 100644
--- a/meta/recipes-extended/newt/libnewt_0.52.14.bb
+++ b/meta/recipes-extended/newt/libnewt_0.52.14.bb
@@ -15,28 +15,40 @@  LICENSE = "LGPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=55ca817ccb7d5b5b66355690e9abc605"
 
 # slang needs to be >= 2.2
-DEPENDS = "slang popt"
+DEPENDS = "slang popt python"
 
-PR = "r1"
+PR = "r2"
 
 SRC_URI = "https://fedorahosted.org/releases/n/e/newt/newt-${PV}.tar.gz \
            file://remove_slang_include.patch \
            file://fix_SHAREDDIR.patch \
-           file://cross_ar.patch"
+           file://cross_ar.patch \
+           file://fix_python_fpic.patch"
 
 SRC_URI[md5sum] = "eb78c6bb658b92ec7198908b5b8d0e37"
 SRC_URI[sha256sum] = "f70f4f58baa60388ddf2e39249ffb00898fb40f2b2767e42e2ab51fe4b40978e"
 
 S = "${WORKDIR}/newt-${PV}"
 
-EXTRA_OECONF = "--without-python --without-tcl"
+EXTRA_OECONF = "--without-tcl"
 
-inherit autotools
+inherit autotools pythonnative python-dir
 
-PACKAGES_prepend = "whiptail "
+EXTRA_OEMAKE = "PYTHONVERS=${PYTHON_DIR}"
+
+export STAGING_INCDIR
+export STAGING_LIBDIR
+
+export BUILD_SYS
+export HOST_SYS
+
+PACKAGES_prepend = "whiptail ${PN}-python "
 
 do_configure_prepend() {
     sh autogen.sh
 }
 
 FILES_whiptail = "${bindir}/whiptail"
+FILES_${PN}-dbg += "${PYTHON_SITEPACKAGES_DIR}/.debug/"
+FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*"
+FILES_${PN}-staticdev = "${libdir}/*.a"