diff options
Diffstat (limited to 'meta/recipes-devtools/python/python3-native_3.5.5.bb')
-rw-r--r-- | meta/recipes-devtools/python/python3-native_3.5.5.bb | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3-native_3.5.5.bb b/meta/recipes-devtools/python/python3-native_3.5.5.bb new file mode 100644 index 0000000000..70c1512b5b --- /dev/null +++ b/meta/recipes-devtools/python/python3-native_3.5.5.bb | |||
@@ -0,0 +1,112 @@ | |||
1 | require recipes-devtools/python/python.inc | ||
2 | |||
3 | PR = "${INC_PR}.0" | ||
4 | PYTHON_MAJMIN = "3.5" | ||
5 | DISTRO_SRC_URI ?= "file://sitecustomize.py" | ||
6 | DISTRO_SRC_URI_linuxstdbase = "" | ||
7 | SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \ | ||
8 | file://12-distutils-prefix-is-inside-staging-area.patch \ | ||
9 | file://python-config.patch \ | ||
10 | file://0001-cross-compile-support.patch \ | ||
11 | file://030-fixup-include-dirs.patch \ | ||
12 | file://070-dont-clean-ipkg-install.patch \ | ||
13 | file://080-distutils-dont_adjust_files.patch \ | ||
14 | file://130-readline-setup.patch \ | ||
15 | file://150-fix-setupterm.patch \ | ||
16 | file://python-3.3-multilib.patch \ | ||
17 | file://03-fix-tkinter-detection.patch \ | ||
18 | file://avoid_warning_about_tkinter.patch \ | ||
19 | file://shutil-follow-symlink-fix.patch \ | ||
20 | file://0001-h2py-Fix-issue-13032-where-it-fails-with-UnicodeDeco.patch \ | ||
21 | file://sysroot-include-headers.patch \ | ||
22 | file://unixccompiler.patch \ | ||
23 | ${DISTRO_SRC_URI} \ | ||
24 | file://sysconfig.py-add-_PYTHON_PROJECT_SRC.patch \ | ||
25 | file://setup.py-check-cross_compiling-when-get-FLAGS.patch \ | ||
26 | file://0001-Do-not-use-the-shell-version-of-python-config-that-w.patch \ | ||
27 | file://support_SOURCE_DATE_EPOCH_in_py_compile.patch \ | ||
28 | " | ||
29 | |||
30 | SRC_URI[md5sum] = "f3763edf9824d5d3a15f5f646083b6e0" | ||
31 | SRC_URI[sha256sum] = "063d2c3b0402d6191b90731e0f735c64830e7522348aeb7ed382a83165d45009" | ||
32 | |||
33 | LIC_FILES_CHKSUM = "file://LICENSE;md5=b6ec515b22618f55fa07276b897bacea" | ||
34 | |||
35 | # exclude pre-releases for both python 2.x and 3.x | ||
36 | UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar" | ||
37 | |||
38 | S = "${WORKDIR}/Python-${PV}" | ||
39 | |||
40 | EXTRANATIVEPATH += "bzip2-native" | ||
41 | DEPENDS = "openssl-native bzip2-replacement-native zlib-native readline-native sqlite3-native gdbm-native" | ||
42 | |||
43 | inherit native | ||
44 | |||
45 | # uninative may be used on pre glibc 2.25 systems which don't have getentropy | ||
46 | EXTRA_OECONF_append = " --bindir=${bindir}/${PN} --without-ensurepip ac_cv_func_getentropy=no" | ||
47 | |||
48 | EXTRA_OEMAKE = '\ | ||
49 | LIBC="" \ | ||
50 | STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE} \ | ||
51 | STAGING_INCDIR=${STAGING_INCDIR_NATIVE} \ | ||
52 | LIB=${baselib} \ | ||
53 | ARCH=${TARGET_ARCH} \ | ||
54 | ' | ||
55 | |||
56 | # No ctypes option for python 3 | ||
57 | PYTHONLSBOPTS = "" | ||
58 | |||
59 | do_configure_append() { | ||
60 | autoreconf --verbose --install --force --exclude=autopoint ../Python-${PV}/Modules/_ctypes/libffi | ||
61 | sed -i -e 's,#define HAVE_GETRANDOM 1,/\* #undef HAVE_GETRANDOM \*/,' ${B}/pyconfig.h | ||
62 | } | ||
63 | |||
64 | # Regenerate all of the generated files | ||
65 | # This ensures that pgen and friends get created during the compile phase | ||
66 | do_compile_prepend() { | ||
67 | # Has to be done ahead of other regen- targets due to https://bugs.python.org/issue33080 | ||
68 | oe_runmake regen-importlib | ||
69 | oe_runmake regen-all | ||
70 | } | ||
71 | |||
72 | do_install() { | ||
73 | install -d ${D}${libdir}/pkgconfig | ||
74 | oe_runmake 'DESTDIR=${D}' install | ||
75 | if [ -e ${WORKDIR}/sitecustomize.py ]; then | ||
76 | install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN} | ||
77 | fi | ||
78 | install -d ${D}${bindir}/${PN} | ||
79 | install -m 0755 Parser/pgen ${D}${bindir}/${PN} | ||
80 | |||
81 | # Make sure we use /usr/bin/env python | ||
82 | for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do | ||
83 | sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT | ||
84 | done | ||
85 | |||
86 | # Add a symlink to the native Python so that scripts can just invoke | ||
87 | # "nativepython" and get the right one without needing absolute paths | ||
88 | # (these often end up too long for the #! parser in the kernel as the | ||
89 | # buffer is 128 bytes long). | ||
90 | ln -s python3-native/python3 ${D}${bindir}/nativepython3 | ||
91 | } | ||
92 | |||
93 | python(){ | ||
94 | |||
95 | # Read JSON manifest | ||
96 | import json | ||
97 | pythondir = d.getVar('THISDIR',True) | ||
98 | with open(pythondir+'/python3/python3-manifest.json') as manifest_file: | ||
99 | python_manifest=json.load(manifest_file) | ||
100 | |||
101 | rprovides = d.getVar('RPROVIDES').split() | ||
102 | |||
103 | # Hardcoded since it cant be python3-native-foo, should be python3-foo-native | ||
104 | pn = 'python3' | ||
105 | |||
106 | for key in python_manifest: | ||
107 | pypackage = pn + '-' + key + '-native' | ||
108 | if pypackage not in rprovides: | ||
109 | rprovides.append(pypackage) | ||
110 | |||
111 | d.setVar('RPROVIDES', ' '.join(rprovides)) | ||
112 | } | ||