Skip to contentSkip to conversation

python3-crc32c: Do not poke at build system for finding platform

PATCH New Khem Raj 1 participant 1 message Mar 4, 2022

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 python3-crc32c: Do not poke at build system for finding platform

platform is target specific and when cross compiling it should be detected differently, in this case lets pass it via environment so that it can be set in recipe

Cc Justin Bronder <[email protected]>
---
 ...p.py-Fix-determining-target-platform.patch | 34 +++++++++++++++++++
 .../python/python3-crc32c_2.2.post0.bb        |  3 ++
 2 files changed, 37 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-crc32c/0001-setup.py-Fix-determining-target-platform.patch
meta-python/recipes-devtools/python/python3-crc32c/0001-setup.py-Fix-determining-target-platform.patch new file +34 -0
new file mode 100644
index 0000000000..b534c05e9a
@@ -0,0 +1,34 @@
+From 855428feb14c44762ea21a18b05638e3e6266ab5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 3 Mar 2022 23:50:30 -0800
+Subject: [PATCH] setup.py: Fix determining target platform
+
+Do not poke at the build machine to determine target platform or architecture
+pass it from environment instead for cross compiling to work
+
+Upstream-Status: Inappropriate [OE-Specific]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ setup.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/setup.py
++++ b/setup.py
+@@ -20,6 +20,7 @@
+ #    MA 02111-1307  USA
+ #
+ import glob
++import os
+ import platform
+ 
+ import distutils.ccompiler
+@@ -58,7 +59,8 @@ class _build_ext(build_ext):
+ 
+     def run(self):
+         assert(len(self.distribution.ext_modules) == 1)
+-        platform = self.platform.lower()
++        platform = os.environ.get('PLATFORM', 'True')
++
+         is_intel = platform in ['x86_64', 'amd64', 'i386', 'i686']
+         is_arm = platform in ['aarch64_be', 'aarch64', 'armv8b', 'armv8l']
+         distutils.log.info("platform: %s, is_intel: %d, is_arm: %d", platform, is_intel, is_arm)
meta-python/recipes-devtools/python/python3-crc32c_2.2.post0.bb +3 -0
index 0d51420939..040bbd320d 100644
@@ -9,8 +9,11 @@ LIC_FILES_CHKSUM = " \
     file://crc32c_adler.c;startline=9;endline=24;md5=c60e6e55d0e5d95effa6fad27db0711a \
 "
 
+SRC_URI += "file://0001-setup.py-Fix-determining-target-platform.patch"
 SRC_URI[sha256sum] = "3d058e7a5e37e4985d1a7ad4cb702bca56b490daa658d4851377d13ead8b435e"
 
 inherit pypi setuptools3
 
+export PLATFORM = "${TARGET_ARCH}"
+
 RDEPENDS:${PN} += "python3-core"
Signature · 1 line
2.35.1