diff options
Diffstat (limited to 'meta/recipes-devtools/python/python-native_2.7.15.bb')
| -rw-r--r-- | meta/recipes-devtools/python/python-native_2.7.15.bb | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python-native_2.7.15.bb b/meta/recipes-devtools/python/python-native_2.7.15.bb new file mode 100644 index 0000000000..7c491fa3e0 --- /dev/null +++ b/meta/recipes-devtools/python/python-native_2.7.15.bb | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | require python.inc | ||
| 2 | EXTRANATIVEPATH += "bzip2-native" | ||
| 3 | DEPENDS = "openssl-native bzip2-replacement-native zlib-native readline-native sqlite3-native expat-native gdbm-native db-native" | ||
| 4 | PR = "${INC_PR}.1" | ||
| 5 | |||
| 6 | SRC_URI += "\ | ||
| 7 | file://05-enable-ctypes-cross-build.patch \ | ||
| 8 | file://10-distutils-fix-swig-parameter.patch \ | ||
| 9 | file://11-distutils-never-modify-shebang-line.patch \ | ||
| 10 | file://0001-distutils-set-the-prefix-to-be-inside-staging-direct.patch \ | ||
| 11 | file://debug.patch \ | ||
| 12 | file://unixccompiler.patch \ | ||
| 13 | file://nohostlibs.patch \ | ||
| 14 | file://multilib.patch \ | ||
| 15 | file://add-md5module-support.patch \ | ||
| 16 | file://builddir.patch \ | ||
| 17 | file://parallel-makeinst-create-bindir.patch \ | ||
| 18 | file://revert_use_of_sysconfigdata.patch \ | ||
| 19 | " | ||
| 20 | |||
| 21 | S = "${WORKDIR}/Python-${PV}" | ||
| 22 | |||
| 23 | FILESEXTRAPATHS =. "${FILE_DIRNAME}/${PN}:" | ||
| 24 | |||
| 25 | inherit native | ||
| 26 | |||
| 27 | EXTRA_OECONF_append = " --bindir=${bindir}/${PN} --with-system-expat=${STAGING_DIR_HOST}" | ||
| 28 | |||
| 29 | EXTRA_OEMAKE = '\ | ||
| 30 | LIBC="" \ | ||
| 31 | STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE} \ | ||
| 32 | STAGING_INCDIR=${STAGING_INCDIR_NATIVE} \ | ||
| 33 | ' | ||
| 34 | |||
| 35 | do_configure_append() { | ||
| 36 | autoreconf --verbose --install --force --exclude=autopoint ../Python-${PV}/Modules/_ctypes/libffi | ||
| 37 | } | ||
| 38 | |||
| 39 | # Regenerate all of the generated files | ||
| 40 | # This ensures that pgen and friends get created during the compile phase | ||
| 41 | do_compile_prepend() { | ||
| 42 | oe_runmake regen-all | ||
| 43 | } | ||
| 44 | |||
| 45 | do_install() { | ||
| 46 | oe_runmake 'DESTDIR=${D}' install | ||
| 47 | install -d ${D}${bindir}/${PN} | ||
| 48 | install -m 0755 Parser/pgen ${D}${bindir}/${PN} | ||
| 49 | |||
| 50 | # Make sure we use /usr/bin/env python | ||
| 51 | for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do | ||
| 52 | sed -i -e '1s|^#!.*|#!/usr/bin/env python|' $PYTHSCRIPT | ||
| 53 | done | ||
| 54 | |||
| 55 | # Add a symlink to the native Python so that scripts can just invoke | ||
| 56 | # "nativepython" and get the right one without needing absolute paths | ||
| 57 | # (these often end up too long for the #! parser in the kernel as the | ||
| 58 | # buffer is 128 bytes long). | ||
| 59 | ln -s python-native/python ${D}${bindir}/nativepython | ||
| 60 | |||
| 61 | # We don't want modules in ~/.local being used in preference to those | ||
| 62 | # installed in the native sysroot, so disable user site support. | ||
| 63 | sed -i -e 's,^\(ENABLE_USER_SITE = \).*,\1False,' ${D}${libdir}/python${PYTHON_MAJMIN}/site.py | ||
| 64 | } | ||
| 65 | |||
| 66 | python(){ | ||
| 67 | |||
| 68 | # Read JSON manifest | ||
| 69 | import json | ||
| 70 | pythondir = d.getVar('THISDIR',True) | ||
| 71 | with open(pythondir+'/python/python2-manifest.json') as manifest_file: | ||
| 72 | python_manifest=json.load(manifest_file) | ||
| 73 | |||
| 74 | rprovides = d.getVar('RPROVIDES').split() | ||
| 75 | |||
| 76 | # Hardcoded since it cant be python-native-foo, should be python-foo-native | ||
| 77 | pn = 'python' | ||
| 78 | |||
| 79 | for key in python_manifest: | ||
| 80 | pypackage = pn + '-' + key + '-native' | ||
| 81 | if pypackage not in rprovides: | ||
| 82 | rprovides.append(pypackage) | ||
| 83 | |||
| 84 | d.setVar('RPROVIDES', ' '.join(rprovides)) | ||
| 85 | } | ||
