diff options
Diffstat (limited to 'meta/recipes-devtools/python/python_2.7.13.bb')
-rw-r--r-- | meta/recipes-devtools/python/python_2.7.13.bb | 277 |
1 files changed, 0 insertions, 277 deletions
diff --git a/meta/recipes-devtools/python/python_2.7.13.bb b/meta/recipes-devtools/python/python_2.7.13.bb deleted file mode 100644 index 337c7447bb..0000000000 --- a/meta/recipes-devtools/python/python_2.7.13.bb +++ /dev/null | |||
@@ -1,277 +0,0 @@ | |||
1 | require python.inc | ||
2 | |||
3 | DEPENDS = "python-native libffi bzip2 gdbm openssl readline sqlite3 zlib" | ||
4 | |||
5 | PR = "${INC_PR}" | ||
6 | |||
7 | DISTRO_SRC_URI ?= "file://sitecustomize.py" | ||
8 | DISTRO_SRC_URI_linuxstdbase = "" | ||
9 | SRC_URI += "\ | ||
10 | file://01-use-proper-tools-for-cross-build.patch \ | ||
11 | file://03-fix-tkinter-detection.patch \ | ||
12 | file://06-avoid_usr_lib_termcap_path_in_linking.patch \ | ||
13 | ${DISTRO_SRC_URI} \ | ||
14 | file://multilib.patch \ | ||
15 | file://cgi_py.patch \ | ||
16 | file://setup_py_skip_cross_import_check.patch \ | ||
17 | file://add-md5module-support.patch \ | ||
18 | file://host_include_contamination.patch \ | ||
19 | file://fix_for_using_different_libdir.patch \ | ||
20 | file://setuptweaks.patch \ | ||
21 | file://check-if-target-is-64b-not-host.patch \ | ||
22 | file://search_db_h_in_inc_dirs_and_avoid_warning.patch \ | ||
23 | file://avoid_warning_about_tkinter.patch \ | ||
24 | file://avoid_warning_for_sunos_specific_module.patch \ | ||
25 | file://python-2.7.3-remove-bsdb-rpath.patch \ | ||
26 | file://fix-makefile-for-ptest.patch \ | ||
27 | file://run-ptest \ | ||
28 | file://parallel-makeinst-create-bindir.patch \ | ||
29 | file://use_sysroot_ncurses_instead_of_host.patch \ | ||
30 | file://add-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch \ | ||
31 | file://Don-t-use-getentropy-on-Linux.patch \ | ||
32 | file://pass-missing-libraries-to-Extension-for-mul.patch \ | ||
33 | file://support_SOURCE_DATE_EPOCH_in_py_compile_2.7.patch \ | ||
34 | " | ||
35 | |||
36 | S = "${WORKDIR}/Python-${PV}" | ||
37 | |||
38 | inherit autotools multilib_header python-dir pythonnative | ||
39 | |||
40 | CONFIGUREOPTS += " --with-system-ffi " | ||
41 | |||
42 | EXTRA_OECONF += "ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=no" | ||
43 | |||
44 | PACKAGECONFIG ??= "bdb" | ||
45 | PACKAGECONFIG[bdb] = ",,db" | ||
46 | |||
47 | do_configure_append() { | ||
48 | rm -f ${S}/Makefile.orig | ||
49 | autoreconf -Wcross --verbose --install --force --exclude=autopoint ../Python-${PV}/Modules/_ctypes/libffi | ||
50 | } | ||
51 | |||
52 | do_compile() { | ||
53 | # regenerate platform specific files, because they depend on system headers | ||
54 | cd ${S}/Lib/plat-linux2 | ||
55 | include=${STAGING_INCDIR} ${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
56 | ${S}/Tools/scripts/h2py.py -i '(u_long)' \ | ||
57 | ${STAGING_INCDIR}/dlfcn.h \ | ||
58 | ${STAGING_INCDIR}/linux/cdrom.h \ | ||
59 | ${STAGING_INCDIR}/netinet/in.h \ | ||
60 | ${STAGING_INCDIR}/sys/types.h | ||
61 | sed -e 's,${STAGING_DIR_HOST},,g' -i *.py | ||
62 | cd - | ||
63 | |||
64 | # remove any bogus LD_LIBRARY_PATH | ||
65 | sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile | ||
66 | |||
67 | if [ ! -f Makefile.orig ]; then | ||
68 | install -m 0644 Makefile Makefile.orig | ||
69 | fi | ||
70 | sed -i -e 's#^LDFLAGS=.*#LDFLAGS=${LDFLAGS} -L. -L${STAGING_LIBDIR}#g' \ | ||
71 | -e 's,libdir=${libdir},libdir=${STAGING_LIBDIR},g' \ | ||
72 | -e 's,libexecdir=${libexecdir},libexecdir=${STAGING_DIR_HOST}${libexecdir},g' \ | ||
73 | -e 's,^LIBDIR=.*,LIBDIR=${STAGING_LIBDIR},g' \ | ||
74 | -e 's,includedir=${includedir},includedir=${STAGING_INCDIR},g' \ | ||
75 | -e 's,^INCLUDEDIR=.*,INCLUDE=${STAGING_INCDIR},g' \ | ||
76 | -e 's,^CONFINCLUDEDIR=.*,CONFINCLUDE=${STAGING_INCDIR},g' \ | ||
77 | Makefile | ||
78 | # save copy of it now, because if we do it in do_install and | ||
79 | # then call do_install twice we get Makefile.orig == Makefile.sysroot | ||
80 | install -m 0644 Makefile Makefile.sysroot | ||
81 | |||
82 | export CROSS_COMPILE="${TARGET_PREFIX}" | ||
83 | export PYTHONBUILDDIR="${B}" | ||
84 | |||
85 | oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \ | ||
86 | HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
87 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
88 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
89 | STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ | ||
90 | OPT="${CFLAGS}" | ||
91 | } | ||
92 | |||
93 | do_install() { | ||
94 | # make install needs the original Makefile, or otherwise the inclues would | ||
95 | # go to ${D}${STAGING...}/... | ||
96 | install -m 0644 Makefile.orig Makefile | ||
97 | |||
98 | export CROSS_COMPILE="${TARGET_PREFIX}" | ||
99 | export PYTHONBUILDDIR="${B}" | ||
100 | |||
101 | # After swizzling the makefile, we need to run the build again. | ||
102 | # install can race with the build so we have to run this first, then install | ||
103 | oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \ | ||
104 | HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
105 | CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \ | ||
106 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
107 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
108 | STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ | ||
109 | DESTDIR=${D} LIBDIR=${libdir} | ||
110 | |||
111 | oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \ | ||
112 | HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
113 | CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \ | ||
114 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
115 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
116 | STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ | ||
117 | DESTDIR=${D} LIBDIR=${libdir} install | ||
118 | |||
119 | install -m 0644 Makefile.sysroot ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile | ||
120 | |||
121 | if [ -e ${WORKDIR}/sitecustomize.py ]; then | ||
122 | install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN} | ||
123 | fi | ||
124 | |||
125 | oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h | ||
126 | |||
127 | if [ -z "${@bb.utils.filter('PACKAGECONFIG', 'bdb', d)}" ]; then | ||
128 | rm -rf ${D}/${libdir}/python${PYTHON_MAJMIN}/bsddb | ||
129 | fi | ||
130 | } | ||
131 | |||
132 | do_install_append_class-nativesdk () { | ||
133 | create_wrapper ${D}${bindir}/python2.7 PYTHONHOME='${prefix}' TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' | ||
134 | } | ||
135 | |||
136 | SSTATE_SCAN_FILES += "Makefile" | ||
137 | PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess" | ||
138 | |||
139 | py_package_preprocess () { | ||
140 | # copy back the old Makefile to fix target package | ||
141 | install -m 0644 ${B}/Makefile.orig ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile | ||
142 | |||
143 | # Remove references to buildmachine paths in target Makefile and _sysconfigdata | ||
144 | sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \ | ||
145 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile \ | ||
146 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py | ||
147 | python -m py_compile ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py | ||
148 | } | ||
149 | |||
150 | |||
151 | # manual dependency additions | ||
152 | RPROVIDES_${PN}-core = "${PN}" | ||
153 | RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python-modules" | ||
154 | RRECOMMENDS_${PN}-crypt = "openssl" | ||
155 | |||
156 | # package libpython2 | ||
157 | PACKAGES =+ "lib${BPN}2" | ||
158 | FILES_lib${BPN}2 = "${libdir}/libpython*.so.*" | ||
159 | |||
160 | # catch all the rest (unsorted) | ||
161 | PACKAGES += "${PN}-misc" | ||
162 | FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}" | ||
163 | RDEPENDS_${PN}-modules += "${PN}-misc" | ||
164 | |||
165 | # ptest | ||
166 | RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-tests" | ||
167 | #inherit ptest after "require python-${PYTHON_MAJMIN}-manifest.inc" so PACKAGES doesn't get overwritten | ||
168 | inherit ptest | ||
169 | |||
170 | # This must come after inherit ptest for the override to take effect | ||
171 | do_install_ptest() { | ||
172 | cp ${B}/Makefile ${D}${PTEST_PATH} | ||
173 | sed -e s:LIBDIR/python/ptest:${PTEST_PATH}:g \ | ||
174 | -e s:LIBDIR:${libdir}:g \ | ||
175 | -i ${D}${PTEST_PATH}/run-ptest | ||
176 | |||
177 | #Remove build host references | ||
178 | sed -i \ | ||
179 | -e 's:--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \ | ||
180 | -e 's:--sysroot=${STAGING_DIR_TARGET}::g' \ | ||
181 | -e 's|${DEBUG_PREFIX_MAP}||g' \ | ||
182 | -e 's:${HOSTTOOLS_DIR}/::g' \ | ||
183 | -e 's:${RECIPE_SYSROOT}::g' \ | ||
184 | -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ | ||
185 | ${D}/${PTEST_PATH}/Makefile | ||
186 | } | ||
187 | |||
188 | # catch manpage | ||
189 | PACKAGES += "${PN}-man" | ||
190 | FILES_${PN}-man = "${datadir}/man" | ||
191 | |||
192 | # Nasty but if bdb isn't enabled the package won't be generated | ||
193 | RDEPENDS_${PN}-modules_remove = "${@bb.utils.contains('PACKAGECONFIG', 'bdb', '', '${PN}-bsddb', d)}" | ||
194 | |||
195 | BBCLASSEXTEND = "nativesdk" | ||
196 | |||
197 | RPROVIDES_${PN} += "${PN}-modules" | ||
198 | |||
199 | # We want bytecode precompiled .py files (.pyc's) by default | ||
200 | # but the user may set it on their own conf | ||
201 | |||
202 | INCLUDE_PYCS ?= "1" | ||
203 | |||
204 | python(){ | ||
205 | import json | ||
206 | |||
207 | filename = os.path.join(d.getVar('THISDIR'), 'python', 'python2-manifest.json') | ||
208 | # This python changes the datastore based on the contents of a file, so mark | ||
209 | # that dependency. | ||
210 | bb.parse.mark_dependency(d, filename) | ||
211 | |||
212 | with open(filename) as manifest_file: | ||
213 | python_manifest=json.load(manifest_file) | ||
214 | |||
215 | include_pycs = d.getVar('INCLUDE_PYCS') | ||
216 | |||
217 | packages = d.getVar('PACKAGES').split() | ||
218 | pn = d.getVar('PN') | ||
219 | |||
220 | newpackages=[] | ||
221 | |||
222 | for key in python_manifest: | ||
223 | pypackage= pn + '-' + key | ||
224 | |||
225 | if pypackage not in packages: | ||
226 | # We need to prepend, otherwise python-misc gets everything | ||
227 | # so we use a new variable | ||
228 | newpackages.append(pypackage) | ||
229 | |||
230 | # "Build" python's manifest FILES, RDEPENDS and SUMMARY | ||
231 | d.setVar('FILES_' + pypackage, '') | ||
232 | for value in python_manifest[key]['files']: | ||
233 | d.appendVar('FILES_' + pypackage, ' ' + value) | ||
234 | if include_pycs == '1': | ||
235 | if value.endswith('.py'): | ||
236 | d.appendVar('FILES_' + pypackage, ' ' + value + 'c') | ||
237 | |||
238 | d.setVar('RDEPENDS_' + pypackage, '') | ||
239 | for value in python_manifest[key]['rdepends']: | ||
240 | # Make it work with or without $PN | ||
241 | if '${PN}' in value: | ||
242 | value=value.split('-')[1] | ||
243 | d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value) | ||
244 | d.setVar('SUMMARY_' + pypackage, python_manifest[key]['summary']) | ||
245 | |||
246 | # We need to ensure staticdev packages match for files first so we sort in reverse | ||
247 | newpackages.sort(reverse=True) | ||
248 | # Prepending so to avoid python-misc getting everything | ||
249 | packages = newpackages + packages | ||
250 | d.setVar('PACKAGES', ' '.join(packages)) | ||
251 | d.setVar('ALLOW_EMPTY_${PN}-modules', '1') | ||
252 | } | ||
253 | |||
254 | # Files needed to create a new manifest | ||
255 | SRC_URI += "file://create_manifest2.py file://get_module_deps2.py file://python2-manifest.json" | ||
256 | |||
257 | do_create_manifest() { | ||
258 | # This task should be run with every new release of Python. | ||
259 | # We must ensure that PACKAGECONFIG enables everything when creating | ||
260 | # a new manifest, this is to base our new manifest on a complete | ||
261 | # native python build, containing all dependencies, otherwise the task | ||
262 | # wont be able to find the required files. | ||
263 | # e.g. BerkeleyDB is an optional build dependency so it may or may not | ||
264 | # be present, we must ensure it is. | ||
265 | |||
266 | cd ${WORKDIR} | ||
267 | # This needs to be executed by python-native and NOT by HOST's python | ||
268 | nativepython create_manifest2.py | ||
269 | cp python2-manifest.json.new ${THISDIR}/python/python2-manifest.json | ||
270 | } | ||
271 | |||
272 | # bitbake python -c create_manifest | ||
273 | addtask do_create_manifest | ||
274 | |||
275 | # Make sure we have native python ready when we create a new manifest | ||
276 | do_create_manifest[depends] += "python:do_prepare_recipe_sysroot" | ||
277 | do_create_manifest[depends] += "python:do_patch" | ||