diff options
Diffstat (limited to 'meta/recipes-devtools/python/python_2.7.12.bb')
-rw-r--r-- | meta/recipes-devtools/python/python_2.7.12.bb | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python_2.7.12.bb b/meta/recipes-devtools/python/python_2.7.12.bb new file mode 100644 index 0000000000..3ee1e38b66 --- /dev/null +++ b/meta/recipes-devtools/python/python_2.7.12.bb | |||
@@ -0,0 +1,169 @@ | |||
1 | require python.inc | ||
2 | DEPENDS = "python-native libffi bzip2 db 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 | " | ||
30 | |||
31 | S = "${WORKDIR}/Python-${PV}" | ||
32 | |||
33 | inherit autotools multilib_header python-dir pythonnative | ||
34 | |||
35 | CONFIGUREOPTS += " --with-system-ffi " | ||
36 | |||
37 | EXTRA_OECONF += "ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=no" | ||
38 | |||
39 | do_configure_append() { | ||
40 | rm -f ${S}/Makefile.orig | ||
41 | autoreconf -Wcross --verbose --install --force --exclude=autopoint ../Python-${PV}/Modules/_ctypes/libffi | ||
42 | } | ||
43 | |||
44 | do_compile() { | ||
45 | # regenerate platform specific files, because they depend on system headers | ||
46 | cd ${S}/Lib/plat-linux2 | ||
47 | include=${STAGING_INCDIR} ${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
48 | ${S}/Tools/scripts/h2py.py -i '(u_long)' \ | ||
49 | ${STAGING_INCDIR}/dlfcn.h \ | ||
50 | ${STAGING_INCDIR}/linux/cdrom.h \ | ||
51 | ${STAGING_INCDIR}/netinet/in.h \ | ||
52 | ${STAGING_INCDIR}/sys/types.h | ||
53 | sed -e 's,${STAGING_DIR_HOST},,g' -i *.py | ||
54 | cd - | ||
55 | |||
56 | # remove any bogus LD_LIBRARY_PATH | ||
57 | sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile | ||
58 | |||
59 | if [ ! -f Makefile.orig ]; then | ||
60 | install -m 0644 Makefile Makefile.orig | ||
61 | fi | ||
62 | sed -i -e 's#^LDFLAGS=.*#LDFLAGS=${LDFLAGS} -L. -L${STAGING_LIBDIR}#g' \ | ||
63 | -e 's,libdir=${libdir},libdir=${STAGING_LIBDIR},g' \ | ||
64 | -e 's,libexecdir=${libexecdir},libexecdir=${STAGING_DIR_HOST}${libexecdir},g' \ | ||
65 | -e 's,^LIBDIR=.*,LIBDIR=${STAGING_LIBDIR},g' \ | ||
66 | -e 's,includedir=${includedir},includedir=${STAGING_INCDIR},g' \ | ||
67 | -e 's,^INCLUDEDIR=.*,INCLUDE=${STAGING_INCDIR},g' \ | ||
68 | -e 's,^CONFINCLUDEDIR=.*,CONFINCLUDE=${STAGING_INCDIR},g' \ | ||
69 | Makefile | ||
70 | # save copy of it now, because if we do it in do_install and | ||
71 | # then call do_install twice we get Makefile.orig == Makefile.sysroot | ||
72 | install -m 0644 Makefile Makefile.sysroot | ||
73 | |||
74 | export CROSS_COMPILE="${TARGET_PREFIX}" | ||
75 | export PYTHONBUILDDIR="${B}" | ||
76 | |||
77 | oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \ | ||
78 | HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
79 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
80 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
81 | STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ | ||
82 | OPT="${CFLAGS}" | ||
83 | } | ||
84 | |||
85 | do_install() { | ||
86 | # make install needs the original Makefile, or otherwise the inclues would | ||
87 | # go to ${D}${STAGING...}/... | ||
88 | install -m 0644 Makefile.orig Makefile | ||
89 | |||
90 | export CROSS_COMPILE="${TARGET_PREFIX}" | ||
91 | export PYTHONBUILDDIR="${B}" | ||
92 | |||
93 | # After swizzling the makefile, we need to run the build again. | ||
94 | # install can race with the build so we have to run this first, then install | ||
95 | oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \ | ||
96 | HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
97 | CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \ | ||
98 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
99 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
100 | STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ | ||
101 | DESTDIR=${D} LIBDIR=${libdir} | ||
102 | |||
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} install | ||
110 | |||
111 | install -m 0644 Makefile.sysroot ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile | ||
112 | |||
113 | if [ -e ${WORKDIR}/sitecustomize.py ]; then | ||
114 | install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN} | ||
115 | fi | ||
116 | |||
117 | oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h | ||
118 | } | ||
119 | |||
120 | do_install_append_class-nativesdk () { | ||
121 | create_wrapper ${D}${bindir}/python2.7 PYTHONHOME='${prefix}' TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' | ||
122 | } | ||
123 | |||
124 | SSTATE_SCAN_FILES += "Makefile" | ||
125 | PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess" | ||
126 | |||
127 | py_package_preprocess () { | ||
128 | # copy back the old Makefile to fix target package | ||
129 | install -m 0644 ${B}/Makefile.orig ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile | ||
130 | |||
131 | # Remove references to buildmachine paths in target Makefile and _sysconfigdata | ||
132 | sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \ | ||
133 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile \ | ||
134 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py | ||
135 | } | ||
136 | |||
137 | require python-${PYTHON_MAJMIN}-manifest.inc | ||
138 | |||
139 | # manual dependency additions | ||
140 | RPROVIDES_${PN}-core = "${PN}" | ||
141 | RRECOMMENDS_${PN}-core = "${PN}-readline" | ||
142 | RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python-modules" | ||
143 | RRECOMMENDS_${PN}-crypt = "openssl" | ||
144 | |||
145 | # package libpython2 | ||
146 | PACKAGES =+ "lib${BPN}2" | ||
147 | FILES_lib${BPN}2 = "${libdir}/libpython*.so.*" | ||
148 | |||
149 | # catch all the rest (unsorted) | ||
150 | PACKAGES += "${PN}-misc" | ||
151 | FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}" | ||
152 | RDEPENDS_${PN}-modules += "${PN}-misc" | ||
153 | RDEPENDS_${PN}-ptest = "${PN}-modules" | ||
154 | #inherit ptest after "require python-${PYTHON_MAJMIN}-manifest.inc" so PACKAGES doesn't get overwritten | ||
155 | inherit ptest | ||
156 | |||
157 | # This must come after inherit ptest for the override to take effect | ||
158 | do_install_ptest() { | ||
159 | cp ${B}/Makefile ${D}${PTEST_PATH} | ||
160 | sed -e s:LIBDIR/python/ptest:${PTEST_PATH}:g \ | ||
161 | -e s:LIBDIR:${libdir}:g \ | ||
162 | -i ${D}${PTEST_PATH}/run-ptest | ||
163 | } | ||
164 | |||
165 | # catch manpage | ||
166 | PACKAGES += "${PN}-man" | ||
167 | FILES_${PN}-man = "${datadir}/man" | ||
168 | |||
169 | BBCLASSEXTEND = "nativesdk" | ||