diff options
Diffstat (limited to 'meta/recipes-devtools/python/python_2.7.14.bb')
-rw-r--r-- | meta/recipes-devtools/python/python_2.7.14.bb | 194 |
1 files changed, 194 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python_2.7.14.bb b/meta/recipes-devtools/python/python_2.7.14.bb new file mode 100644 index 0000000000..e814ff74f7 --- /dev/null +++ b/meta/recipes-devtools/python/python_2.7.14.bb | |||
@@ -0,0 +1,194 @@ | |||
1 | require python.inc | ||
2 | DEPENDS = "python-native libffi bzip2 gdbm openssl readline sqlite3 zlib" | ||
3 | PR = "${INC_PR}" | ||
4 | |||
5 | DISTRO_SRC_URI ?= "file://sitecustomize.py" | ||
6 | DISTRO_SRC_URI_linuxstdbase = "" | ||
7 | SRC_URI += "\ | ||
8 | file://01-use-proper-tools-for-cross-build.patch \ | ||
9 | file://03-fix-tkinter-detection.patch \ | ||
10 | file://06-avoid_usr_lib_termcap_path_in_linking.patch \ | ||
11 | ${DISTRO_SRC_URI} \ | ||
12 | file://multilib.patch \ | ||
13 | file://cgi_py.patch \ | ||
14 | file://setup_py_skip_cross_import_check.patch \ | ||
15 | file://add-md5module-support.patch \ | ||
16 | file://host_include_contamination.patch \ | ||
17 | file://fix_for_using_different_libdir.patch \ | ||
18 | file://setuptweaks.patch \ | ||
19 | file://check-if-target-is-64b-not-host.patch \ | ||
20 | file://search_db_h_in_inc_dirs_and_avoid_warning.patch \ | ||
21 | file://avoid_warning_about_tkinter.patch \ | ||
22 | file://avoid_warning_for_sunos_specific_module.patch \ | ||
23 | file://python-2.7.3-remove-bsdb-rpath.patch \ | ||
24 | file://fix-makefile-for-ptest.patch \ | ||
25 | file://run-ptest \ | ||
26 | file://parallel-makeinst-create-bindir.patch \ | ||
27 | file://use_sysroot_ncurses_instead_of_host.patch \ | ||
28 | file://add-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch \ | ||
29 | file://pass-missing-libraries-to-Extension-for-mul.patch \ | ||
30 | file://support_SOURCE_DATE_EPOCH_in_py_compile_2.7.patch \ | ||
31 | " | ||
32 | |||
33 | S = "${WORKDIR}/Python-${PV}" | ||
34 | |||
35 | inherit autotools multilib_header python-dir pythonnative | ||
36 | |||
37 | CONFIGUREOPTS += " --with-system-ffi " | ||
38 | |||
39 | EXTRA_OECONF += "ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=no" | ||
40 | |||
41 | PACKAGECONFIG ??= "bdb" | ||
42 | PACKAGECONFIG[bdb] = ",,db" | ||
43 | |||
44 | do_configure_append() { | ||
45 | rm -f ${S}/Makefile.orig | ||
46 | autoreconf -Wcross --verbose --install --force --exclude=autopoint ../Python-${PV}/Modules/_ctypes/libffi | ||
47 | } | ||
48 | |||
49 | do_compile() { | ||
50 | # regenerate platform specific files, because they depend on system headers | ||
51 | cd ${S}/Lib/plat-linux2 | ||
52 | include=${STAGING_INCDIR} ${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
53 | ${S}/Tools/scripts/h2py.py -i '(u_long)' \ | ||
54 | ${STAGING_INCDIR}/dlfcn.h \ | ||
55 | ${STAGING_INCDIR}/linux/cdrom.h \ | ||
56 | ${STAGING_INCDIR}/netinet/in.h \ | ||
57 | ${STAGING_INCDIR}/sys/types.h | ||
58 | sed -e 's,${STAGING_DIR_HOST},,g' -i *.py | ||
59 | cd - | ||
60 | |||
61 | # remove any bogus LD_LIBRARY_PATH | ||
62 | sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile | ||
63 | |||
64 | if [ ! -f Makefile.orig ]; then | ||
65 | install -m 0644 Makefile Makefile.orig | ||
66 | fi | ||
67 | sed -i -e 's#^LDFLAGS=.*#LDFLAGS=${LDFLAGS} -L. -L${STAGING_LIBDIR}#g' \ | ||
68 | -e 's,libdir=${libdir},libdir=${STAGING_LIBDIR},g' \ | ||
69 | -e 's,libexecdir=${libexecdir},libexecdir=${STAGING_DIR_HOST}${libexecdir},g' \ | ||
70 | -e 's,^LIBDIR=.*,LIBDIR=${STAGING_LIBDIR},g' \ | ||
71 | -e 's,includedir=${includedir},includedir=${STAGING_INCDIR},g' \ | ||
72 | -e 's,^INCLUDEDIR=.*,INCLUDE=${STAGING_INCDIR},g' \ | ||
73 | -e 's,^CONFINCLUDEDIR=.*,CONFINCLUDE=${STAGING_INCDIR},g' \ | ||
74 | Makefile | ||
75 | # save copy of it now, because if we do it in do_install and | ||
76 | # then call do_install twice we get Makefile.orig == Makefile.sysroot | ||
77 | install -m 0644 Makefile Makefile.sysroot | ||
78 | |||
79 | export CROSS_COMPILE="${TARGET_PREFIX}" | ||
80 | export PYTHONBUILDDIR="${B}" | ||
81 | |||
82 | oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \ | ||
83 | HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
84 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
85 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
86 | STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ | ||
87 | OPT="${CFLAGS}" | ||
88 | } | ||
89 | |||
90 | do_install() { | ||
91 | # make install needs the original Makefile, or otherwise the inclues would | ||
92 | # go to ${D}${STAGING...}/... | ||
93 | install -m 0644 Makefile.orig Makefile | ||
94 | |||
95 | export CROSS_COMPILE="${TARGET_PREFIX}" | ||
96 | export PYTHONBUILDDIR="${B}" | ||
97 | |||
98 | # After swizzling the makefile, we need to run the build again. | ||
99 | # install can race with the build so we have to run this first, then install | ||
100 | oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \ | ||
101 | HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
102 | CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \ | ||
103 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
104 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
105 | STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ | ||
106 | DESTDIR=${D} LIBDIR=${libdir} | ||
107 | |||
108 | oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \ | ||
109 | HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
110 | CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \ | ||
111 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
112 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
113 | STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ | ||
114 | DESTDIR=${D} LIBDIR=${libdir} install | ||
115 | |||
116 | install -m 0644 Makefile.sysroot ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile | ||
117 | |||
118 | if [ -e ${WORKDIR}/sitecustomize.py ]; then | ||
119 | install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN} | ||
120 | fi | ||
121 | |||
122 | oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h | ||
123 | |||
124 | if [ -z "${@bb.utils.filter('PACKAGECONFIG', 'bdb', d)}" ]; then | ||
125 | rm -rf ${D}/${libdir}/python${PYTHON_MAJMIN}/bsddb | ||
126 | fi | ||
127 | } | ||
128 | |||
129 | do_install_append_class-nativesdk () { | ||
130 | create_wrapper ${D}${bindir}/python2.7 PYTHONHOME='${prefix}' TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' | ||
131 | } | ||
132 | |||
133 | SSTATE_SCAN_FILES += "Makefile" | ||
134 | PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess" | ||
135 | |||
136 | py_package_preprocess () { | ||
137 | # copy back the old Makefile to fix target package | ||
138 | install -m 0644 ${B}/Makefile.orig ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile | ||
139 | |||
140 | # Remove references to buildmachine paths in target Makefile and _sysconfigdata | ||
141 | sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \ | ||
142 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile \ | ||
143 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py | ||
144 | python -m py_compile ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py | ||
145 | } | ||
146 | |||
147 | require python-${PYTHON_MAJMIN}-manifest.inc | ||
148 | |||
149 | # manual dependency additions | ||
150 | RPROVIDES_${PN}-core = "${PN}" | ||
151 | RRECOMMENDS_${PN}-core = "${PN}-readline" | ||
152 | RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python-modules" | ||
153 | RRECOMMENDS_${PN}-crypt = "openssl" | ||
154 | |||
155 | # package libpython2 | ||
156 | PACKAGES =+ "lib${BPN}2" | ||
157 | FILES_lib${BPN}2 = "${libdir}/libpython*.so.*" | ||
158 | |||
159 | # catch all the rest (unsorted) | ||
160 | PACKAGES += "${PN}-misc" | ||
161 | FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}" | ||
162 | RDEPENDS_${PN}-modules += "${PN}-misc" | ||
163 | |||
164 | # ptest | ||
165 | RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-tests" | ||
166 | #inherit ptest after "require python-${PYTHON_MAJMIN}-manifest.inc" so PACKAGES doesn't get overwritten | ||
167 | inherit ptest | ||
168 | |||
169 | # This must come after inherit ptest for the override to take effect | ||
170 | do_install_ptest() { | ||
171 | cp ${B}/Makefile ${D}${PTEST_PATH} | ||
172 | sed -e s:LIBDIR/python/ptest:${PTEST_PATH}:g \ | ||
173 | -e s:LIBDIR:${libdir}:g \ | ||
174 | -i ${D}${PTEST_PATH}/run-ptest | ||
175 | |||
176 | #Remove build host references | ||
177 | sed -i \ | ||
178 | -e 's:--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \ | ||
179 | -e 's:--sysroot=${STAGING_DIR_TARGET}::g' \ | ||
180 | -e 's|${DEBUG_PREFIX_MAP}||g' \ | ||
181 | -e 's:${HOSTTOOLS_DIR}/::g' \ | ||
182 | -e 's:${RECIPE_SYSROOT}::g' \ | ||
183 | -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ | ||
184 | ${D}/${PTEST_PATH}/Makefile | ||
185 | } | ||
186 | |||
187 | # catch manpage | ||
188 | PACKAGES += "${PN}-man" | ||
189 | FILES_${PN}-man = "${datadir}/man" | ||
190 | |||
191 | # Nasty but if bdb isn't enabled the package won't be generated | ||
192 | RDEPENDS_${PN}-modules_remove = "${@bb.utils.contains('PACKAGECONFIG', 'bdb', '', '${PN}-bsddb', d)}" | ||
193 | |||
194 | BBCLASSEXTEND = "nativesdk" | ||