Skip to contentSkip to conversation

python-m2crypto: avoid swig problem

PATCH New Chong Lu 1 participant 1 message Jun 6, 2014

lore
Share & tools
lore

Chong Lu

author
#0 lore raw

PATCH v2 1/1 python-m2crypto: avoid swig problem

Swig is used to generate C source and it has trouble processing opensslconf.h sometimes. So, we help it out when multilib variants exist.

For native builds, the variant header will never exist.

Specific multi-lib header files might be named *-32.h or *-n32.h, so we check for both names. We also might check for *-n64.h although that will never exist. It appears that *-o??.h will never exist, so we don't check for that.

---
 .../python/python-m2crypto_0.21.1.bb               |   23 +++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
meta-oe/recipes-devtools/python/python-m2crypto_0.21.1.bb +22 -1
index 21c0269..67ec921 100644
@@ -1,7 +1,7 @@
 SUMMARY = "A Python crypto and SSL toolkit"
 HOMEPAGE = "http://chandlerproject.org/bin/view/Projects/MeTooCrypto"
 
-DEPENDS = "openssl swig-native"
+DEPENDS = "openssl swig-native python"
 
 LICENSE = "BSD"
 LIC_FILES_CHKSUM = "file://LICENCE;md5=b0e1f0b7d0ce8a62c18b1287b991800e"
@@ -20,4 +20,25 @@ SWIG_FEATURES_x86-64 = "-D__x86_64__"
 SWIG_FEATURES ?= ""
 export SWIG_FEATURES
 
+# Get around a problem with swig, but only if the
+# multilib header file exists.
+#
+do_compile_prepend() {
+    if [ "${SITEINFO_BITS}" = "64" ];then
+        bit="64"
+    else
+        bit="32"
+    fi
+
+    if [ -e ${STAGING_INCDIR}/openssl/opensslconf-${bit}.h ] ;then
+        for i in SWIG/_ec.i SWIG/_evp.i; do
+            sed -i -e "s/opensslconf.*\./opensslconf-${bit}\./" "$i"
+        done
+    elif [ -e ${STAGING_INCDIR}/openssl/opensslconf-n${bit}.h ] ;then
+        for i in SWIG/_ec.i SWIG/_evp.i; do
+            sed -i -e "s/opensslconf.*\./opensslconf-n${bit}\./" "$i"
+        done
+    fi
+}
+
 BBCLASSEXTEND = "native"
Signature · 1 line
1.7.9.5