summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python_2.7.3.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/python/python_2.7.3.bb')
-rw-r--r--meta/recipes-devtools/python/python_2.7.3.bb186
1 files changed, 186 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python_2.7.3.bb b/meta/recipes-devtools/python/python_2.7.3.bb
new file mode 100644
index 0000000000..0d641720f1
--- /dev/null
+++ b/meta/recipes-devtools/python/python_2.7.3.bb
@@ -0,0 +1,186 @@
1require python.inc
2DEPENDS = "python-native bzip2 db gdbm openssl readline sqlite3 zlib"
3PR = "${INC_PR}.3"
4
5DISTRO_SRC_URI ?= "file://sitecustomize.py"
6DISTRO_SRC_URI_linuxstdbase = ""
7SRC_URI += "\
8 file://01-use-proper-tools-for-cross-build.patch \
9 file://03-fix-tkinter-detection.patch \
10 file://05-enable-ctypes-cross-build.patch \
11 file://06-ctypes-libffi-fix-configure.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://remove_sqlite_rpath.patch \
17 file://setup_py_skip_cross_import_check.patch \
18 file://add-md5module-support.patch \
19 file://host_include_contamination.patch \
20 file://fix_for_using_different_libdir.patch \
21 file://setuptweaks.patch \
22 file://check-if-target-is-64b-not-host.patch \
23 file://search_db_h_in_inc_dirs_and_avoid_warning.patch \
24 file://avoid_warning_about_tkinter.patch \
25 file://avoid_warning_for_sunos_specific_module.patch \
26 file://python-2.7.3-berkeley-db-5.3.patch \
27 file://python-2.7.3-remove-bsdb-rpath.patch \
28 file://builddir.patch \
29 file://python-2.7.3-CVE-2012-2135.patch \
30 file://gcc-4.8-fix-configure-Wformat.patch \
31 file://fix-makefile-for-ptest.patch \
32 file://run-ptest \
33 file://CVE-2013-4073_py27.patch \
34 file://pypirc-secure.patch \
35 file://parallel-makeinst-create-bindir.patch \
36 file://python-2.7.3-CVE-2013-1752-smtplib-fix.patch \
37 file://python-fix-build-error-with-Readline-6.3.patch \
38 file://python-2.7.3-CVE-2014-1912.patch \
39"
40
41S = "${WORKDIR}/Python-${PV}"
42
43inherit autotools multilib_header python-dir pythonnative
44
45# The 3 lines below are copied from the libffi recipe, ctypes ships its own copy of the libffi sources
46#Somehow gcc doesn't set __SOFTFP__ when passing -mfloatabi=softp :(
47TARGET_CC_ARCH_append_armv6 = " -D__SOFTFP__"
48TARGET_CC_ARCH_append_armv7a = " -D__SOFTFP__"
49
50do_configure_prepend() {
51 rm -f ${S}/Makefile.orig
52 autoreconf -Wcross --verbose --install --force --exclude=autopoint Modules/_ctypes/libffi || bbnote "_ctypes failed to autoreconf"
53}
54
55do_compile() {
56 # regenerate platform specific files, because they depend on system headers
57 cd Lib/plat-linux2
58 include=${STAGING_INCDIR} ${STAGING_BINDIR_NATIVE}/python-native/python \
59 ${S}/Tools/scripts/h2py.py -i '(u_long)' \
60 ${STAGING_INCDIR}/dlfcn.h \
61 ${STAGING_INCDIR}/linux/cdrom.h \
62 ${STAGING_INCDIR}/netinet/in.h \
63 ${STAGING_INCDIR}/sys/types.h
64 sed -e 's,${STAGING_DIR_HOST},,g' -i *.py
65 cd -
66
67 # remove hardcoded ccache, see http://bugs.openembedded.net/show_bug.cgi?id=4144
68 sed -i -e s,ccache\ ,'$(CCACHE) ', Makefile
69
70 # remove any bogus LD_LIBRARY_PATH
71 sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile
72
73 if [ ! -f Makefile.orig ]; then
74 install -m 0644 Makefile Makefile.orig
75 fi
76 sed -i -e 's,^LDFLAGS=.*,LDFLAGS=-L. -L${STAGING_LIBDIR},g' \
77 -e 's,libdir=${libdir},libdir=${STAGING_LIBDIR},g' \
78 -e 's,libexecdir=${libexecdir},libexecdir=${STAGING_DIR_HOST}${libexecdir},g' \
79 -e 's,^LIBDIR=.*,LIBDIR=${STAGING_LIBDIR},g' \
80 -e 's,includedir=${includedir},includedir=${STAGING_INCDIR},g' \
81 -e 's,^INCLUDEDIR=.*,INCLUDE=${STAGING_INCDIR},g' \
82 -e 's,^CONFINCLUDEDIR=.*,CONFINCLUDE=${STAGING_INCDIR},g' \
83 Makefile
84 # save copy of it now, because if we do it in do_install and
85 # then call do_install twice we get Makefile.orig == Makefile.sysroot
86 install -m 0644 Makefile Makefile.sysroot
87
88 export CROSS_COMPILE="${TARGET_PREFIX}"
89 export PYTHONBUILDDIR="${S}"
90
91 oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \
92 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \
93 STAGING_LIBDIR=${STAGING_LIBDIR} \
94 STAGING_INCDIR=${STAGING_INCDIR} \
95 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
96 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
97 OPT="${CFLAGS}"
98}
99
100do_install() {
101 # make install needs the original Makefile, or otherwise the inclues would
102 # go to ${D}${STAGING...}/...
103 install -m 0644 Makefile.orig Makefile
104
105 export CROSS_COMPILE="${TARGET_PREFIX}"
106 export PYTHONBUILDDIR="${S}"
107
108 # After swizzling the makefile, we need to run the build again.
109 # install can race with the build so we have to run this first, then install
110 oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \
111 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \
112 CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \
113 STAGING_LIBDIR=${STAGING_LIBDIR} \
114 STAGING_INCDIR=${STAGING_INCDIR} \
115 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
116 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
117 DESTDIR=${D} LIBDIR=${libdir}
118
119 oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \
120 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \
121 CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \
122 STAGING_LIBDIR=${STAGING_LIBDIR} \
123 STAGING_INCDIR=${STAGING_INCDIR} \
124 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
125 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
126 DESTDIR=${D} LIBDIR=${libdir} install
127
128 install -m 0644 Makefile.sysroot ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
129
130 if [ -e ${WORKDIR}/sitecustomize.py ]; then
131 install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN}
132 fi
133
134 oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h
135}
136
137do_install_append_class-nativesdk () {
138 create_wrapper ${D}${bindir}/python2.7 TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo'
139}
140
141SSTATE_SCAN_FILES += "Makefile"
142PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
143
144py_package_preprocess () {
145 # copy back the old Makefile to fix target package
146 install -m 0644 Makefile.orig ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
147
148 # Remove references to buildmachine paths in target Makefile
149 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
150}
151
152require python-${PYTHON_MAJMIN}-manifest.inc
153
154# manual dependency additions
155RPROVIDES_${PN}-core = "${PN}"
156RRECOMMENDS_${PN}-core = "${PN}-readline"
157RRECOMMENDS_${PN}-crypt = "openssl"
158RRECOMMENDS_${PN}-crypt_class-nativesdk = "nativesdk-openssl"
159
160# package libpython2
161PACKAGES =+ "lib${BPN}2"
162FILES_lib${BPN}2 = "${libdir}/libpython*.so.*"
163
164# catch debug extensions (isn't that already in python-core-dbg?)
165FILES_${PN}-dbg += "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/.debug"
166
167# catch all the rest (unsorted)
168PACKAGES += "${PN}-misc"
169FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}"
170RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-misc"
171#inherit ptest after "require python-${PYTHON_MAJMIN}-manifest.inc" so PACKAGES doesn't get overwritten
172inherit ptest
173
174# This must come after inherit ptest for the override to take effect
175do_install_ptest() {
176 cp ${B}/Makefile ${D}${PTEST_PATH}
177 sed -e s:LIBDIR/python/ptest:${PTEST_PATH}:g \
178 -e s:LIBDIR:${libdir}:g \
179 -i ${D}${PTEST_PATH}/run-ptest
180}
181
182# catch manpage
183PACKAGES += "${PN}-man"
184FILES_${PN}-man = "${datadir}/man"
185
186BBCLASSEXTEND = "nativesdk"