optee-os depend on python-pycrypto 89/7389/2
authorRonan <ronan.lemartret@iot.bzh>
Fri, 2 Dec 2016 09:22:14 +0000 (10:22 +0100)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Fri, 2 Dec 2016 13:15:40 +0000 (13:15 +0000)
 * optee-os use python script to build so,
   We need to add:
     inherit pythonnative
   If not we use host python during the build.
 * During the build, optee-os use script:
    - scripts/pem_to_pub_c.py
    - scripts/sign.py
   Those script depend on python-pycrypto
     "from Crypto.PublicKey import RSA"
   So we need to add python-pycrypto native to recipes
 * The python-pycrypto recipes come from meta-security (out of AGL):
   https://layers.openembedded.org/layerindex/recipe/39101/

Change-Id: I64340544c9a23a8e9ef62aca348fc08722d3dcc2
Signed-off-by: Ronan <ronan.lemartret@iot.bzh>
meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os_git.bbappend
meta-agl/recipes-devtools/python/python-pycrypto/cross-compiling.patch [new file with mode: 0644]
meta-agl/recipes-devtools/python/python-pycrypto_2.6.1.bb [new file with mode: 0644]

index 90d6717..e38c904 100644 (file)
@@ -1,4 +1,6 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+inherit pythonnative
+DEPENDS += " python-pycrypto-native"
 
 SRC_URI += " \
         file://0001-disable-libgcc-detection.patch \
diff --git a/meta-agl/recipes-devtools/python/python-pycrypto/cross-compiling.patch b/meta-agl/recipes-devtools/python/python-pycrypto/cross-compiling.patch
new file mode 100644 (file)
index 0000000..712f3e8
--- /dev/null
@@ -0,0 +1,23 @@
+Index: pycrypto-2.6/setup.py
+===================================================================
+--- pycrypto-2.6.orig/setup.py
++++ pycrypto-2.6/setup.py
+@@ -271,7 +271,8 @@ class PCTBuildConfigure(Command):
+         if not os.path.exists("config.status"):
+             if os.system("chmod 0755 configure") != 0:
+                 raise RuntimeError("chmod error")
+-            cmd = "sh configure"    # we use "sh" here so that it'll work on mingw32 with standard python.org binaries
++            host = os.environ.get("HOST_SYS")
++            cmd = "ac_cv_func_malloc_0_nonnull=yes sh configure --host " + host   # we use "sh" here so that it'll work on mingw32 with standard python.org binaries
+             if self.verbose < 1:
+                 cmd += " -q"
+             if os.system(cmd) != 0:
+@@ -370,7 +371,7 @@ kw = {'name':"pycrypto",
+       'ext_modules': plat_ext + [
+             # _fastmath (uses GNU mp library)
+             Extension("Crypto.PublicKey._fastmath",
+-                      include_dirs=['src/','/usr/include/'],
++                      include_dirs=['src/'],
+                       libraries=['gmp'],
+                       sources=["src/_fastmath.c"]),
diff --git a/meta-agl/recipes-devtools/python/python-pycrypto_2.6.1.bb b/meta-agl/recipes-devtools/python/python-pycrypto_2.6.1.bb
new file mode 100644 (file)
index 0000000..f7a69dc
--- /dev/null
@@ -0,0 +1,23 @@
+DESCRIPTION = "Cryptographic modules for Python."
+HOMEPAGE = "http://www.pycrypto.org/"
+LICENSE = "PSFv2"
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=35f354d199e8cb7667b059a23578e63d"
+
+DEPENDS += " gmp"
+PYPI_PACKAGE = "pycrypto"
+
+SRC_URI = "file://cross-compiling.patch"
+
+SRC_URI[md5sum] = "55a61a054aa66812daf5161a0d5d7eda"
+SRC_URI[sha256sum] = "f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c"
+
+inherit pypi autotools-brokensep distutils
+BBCLASSEXTEND = "native"
+do_compile[noexec] = "1"
+
+# We explicitly call distutils_do_install, since we want it to run, but
+# *don't* want the autotools install to run, since this package doesn't
+# provide a "make install" target.
+do_install() {
+       distutils_do_install
+}