Skip to contentSkip to conversation

python3-m2crypto: Improve multilib header workaround

PATCH In review Richard Purdie 2 participants 2 messages May 8, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 python3-m2crypto: Improve multilib header workaround

The multilib header issues continue to cause problems for this recipe. Simplfy the workaround to something which resolves all the current issues and is much simpler to understand/maintain.

---
 .../python/python3-m2crypto_0.37.1.bb         | 25 ++++---------------
 1 file changed, 5 insertions(+), 20 deletions(-)
meta-python/recipes-devtools/python/python3-m2crypto_0.37.1.bb +5 -20
index 896d9d2cc..45abaac33 100644
@@ -36,27 +36,12 @@ SWIG_FEATURES_x32 = "-D__ILP32__"
 SWIG_FEATURES ?= "-D__${HOST_ARCH}__"
 export SWIG_FEATURES
 
-# Get around a problem with swig, but only if the
-# multilib header file exists.
-#
 do_configure_prepend() {
-    ${CPP} -dM - < /dev/null | grep -v '__\(STDC\|REGISTER_PREFIX\|GNUC\|STDC_HOSTED\)__' \
-    | sed 's/^\(#define \([^ ]*\) .*\)$/#undef \2\n\1/' > ${S}/SWIG/gcc_macros.h
-
-    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}\./" "${S}/$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}\./" "${S}/$i"
-        done
+    # swig can't handle any multilib header redirection so just remove it for this build
+    if [ -e ${STAGING_INCDIR}/openssl/opensslconf-64.h ] ;then
+        cp ${STAGING_INCDIR}/openssl/opensslconf-64.h ${STAGING_INCDIR}/openssl/opensslconf.h
+    elif [ -e ${STAGING_INCDIR}/openssl/opensslconf-32.h ] ;then
+        cp ${STAGING_INCDIR}/openssl/opensslconf-32.h ${STAGING_INCDIR}/openssl/opensslconf.h
     fi
 }
 
Signature · 1 line
2.25.1
#1 lore raw

Thanks for the fix, However, I have found a different way to fix it correctly [1]

[1] https://lists.openembedded.org/g/openembedded-devel/topic/meta_oe_patch_v2/82680640?p=,,,20,0,0,0::recentpostdate%2Fsticky,,,20,2,0,82680640

Quoted 53 lines · Richard Purdie

The multilib header issues continue to cause problems for this recipe. Simplfy the workaround to something which resolves all the current issues and is much simpler to understand/maintain.

---
 .../python/python3-m2crypto_0.37.1.bb         | 25 ++++---------------
 1 file changed, 5 insertions(+), 20 deletions(-)
meta-python/recipes-devtools/python/python3-m2crypto_0.37.1.bb +5 -21
index 896d9d2cc..45abaac33 100644
@@ -36,27 +36,12 @@ SWIG_FEATURES_x32 = "-D__ILP32__"
 SWIG_FEATURES ?= "-D__${HOST_ARCH}__"
 export SWIG_FEATURES
 
-# Get around a problem with swig, but only if the
-# multilib header file exists.
-#
 do_configure_prepend() {
-    ${CPP} -dM - < /dev/null | grep -v '__\(STDC\|REGISTER_PREFIX\|GNUC\|STDC_HOSTED\)__' \
-    | sed 's/^\(#define \([^ ]*\) .*\)$/#undef \2\n\1/' > ${S}/SWIG/gcc_macros.h
-
-    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}\./" "${S}/$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}\./" "${S}/$i"
-        done
+    # swig can't handle any multilib header redirection so just remove it for this build
+    if [ -e ${STAGING_INCDIR}/openssl/opensslconf-64.h ] ;then
+        cp ${STAGING_INCDIR}/openssl/opensslconf-64.h ${STAGING_INCDIR}/openssl/opensslconf.h
+    elif [ -e ${STAGING_INCDIR}/openssl/opensslconf-32.h ] ;then
+        cp ${STAGING_INCDIR}/openssl/opensslconf-32.h ${STAGING_INCDIR}/openssl/opensslconf.h
     fi
 }
 
--

2.25.1