summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3_3.5.3.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/python/python3_3.5.3.bb')
-rw-r--r--meta/recipes-devtools/python/python3_3.5.3.bb223
1 files changed, 223 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3_3.5.3.bb b/meta/recipes-devtools/python/python3_3.5.3.bb
new file mode 100644
index 0000000000..3b3cfebbf4
--- /dev/null
+++ b/meta/recipes-devtools/python/python3_3.5.3.bb
@@ -0,0 +1,223 @@
1require recipes-devtools/python/python.inc
2
3DEPENDS = "python3-native libffi bzip2 db gdbm openssl readline sqlite3 zlib virtual/libintl xz"
4PR = "${INC_PR}.0"
5PYTHON_MAJMIN = "3.5"
6PYTHON_BINABI= "${PYTHON_MAJMIN}m"
7DISTRO_SRC_URI ?= "file://sitecustomize.py"
8DISTRO_SRC_URI_linuxstdbase = ""
9SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
10file://python-config.patch \
11file://0001-cross-compile-support.patch \
12file://030-fixup-include-dirs.patch \
13file://070-dont-clean-ipkg-install.patch \
14file://080-distutils-dont_adjust_files.patch \
15file://130-readline-setup.patch \
16file://150-fix-setupterm.patch \
17file://0001-h2py-Fix-issue-13032-where-it-fails-with-UnicodeDeco.patch \
18file://tweak-MULTIARCH-for-powerpc-linux-gnuspe.patch \
19${DISTRO_SRC_URI} \
20"
21
22SRC_URI += "\
23 file://03-fix-tkinter-detection.patch \
24 file://avoid_warning_about_tkinter.patch \
25 file://cgi_py.patch \
26 file://host_include_contamination.patch \
27 file://python-3.3-multilib.patch \
28 file://shutil-follow-symlink-fix.patch \
29 file://sysroot-include-headers.patch \
30 file://unixccompiler.patch \
31 file://avoid-ncursesw-include-path.patch \
32 file://python3-use-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch \
33 file://python3-setup.py-no-host-headers-libs.patch \
34 file://sysconfig.py-add-_PYTHON_PROJECT_SRC.patch \
35 file://setup.py-check-cross_compiling-when-get-FLAGS.patch \
36 file://setup.py-find-libraries-in-staging-dirs.patch \
37 file://configure.ac-fix-LIBPL.patch \
38 file://upstream-random-fixes.patch \
39 "
40SRC_URI[md5sum] = "57d1f8bfbabf4f2500273fb0706e6f21"
41SRC_URI[sha256sum] = "eefe2ad6575855423ab630f5b51a8ef6e5556f774584c06beab4926f930ddbb0"
42
43LIC_FILES_CHKSUM = "file://LICENSE;md5=b680ed99aa60d350c65a65914494207e"
44
45# exclude pre-releases for both python 2.x and 3.x
46UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
47
48S = "${WORKDIR}/Python-${PV}"
49
50inherit autotools multilib_header python3native pkgconfig
51
52CONFIGUREOPTS += " --with-system-ffi "
53
54CACHED_CONFIGUREVARS = "ac_cv_have_chflags=no \
55 ac_cv_have_lchflags=no \
56 ac_cv_have_long_long_format=yes \
57 ac_cv_buggy_getaddrinfo=no \
58 ac_cv_file__dev_ptmx=yes \
59 ac_cv_file__dev_ptc=no \
60"
61
62TARGET_CC_ARCH += "-DNDEBUG -fno-inline"
63SDK_CC_ARCH += "-DNDEBUG -fno-inline"
64EXTRA_OEMAKE += "CROSS_COMPILE=yes"
65EXTRA_OECONF += "CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ --without-ensurepip"
66
67export CROSS_COMPILE = "${TARGET_PREFIX}"
68export _PYTHON_PROJECT_BASE = "${B}"
69export _PYTHON_PROJECT_SRC = "${S}"
70export CCSHARED = "-fPIC"
71
72# Fix cross compilation of different modules
73export CROSSPYTHONPATH = "${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/:${B}/build/lib.linux-${TARGET_ARCH}-${PYTHON_MAJMIN}:${S}/Lib:${S}/Lib/plat-linux"
74
75# No ctypes option for python 3
76PYTHONLSBOPTS = ""
77
78do_configure_append() {
79 rm -f ${S}/Makefile.orig
80 autoreconf -Wcross --verbose --install --force --exclude=autopoint ../Python-${PV}/Modules/_ctypes/libffi
81}
82
83do_compile() {
84 # regenerate platform specific files, because they depend on system headers
85 cd ${S}/Lib/plat-linux*
86 include=${STAGING_INCDIR} ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
87 ${S}/Tools/scripts/h2py.py -i '(u_long)' \
88 ${STAGING_INCDIR}/dlfcn.h \
89 ${STAGING_INCDIR}/linux/cdrom.h \
90 ${STAGING_INCDIR}/netinet/in.h \
91 ${STAGING_INCDIR}/sys/types.h
92 sed -e 's,${STAGING_DIR_HOST},,g' -i *.py
93 cd -
94
95
96 # remove any bogus LD_LIBRARY_PATH
97 sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile
98
99 if [ ! -f Makefile.orig ]; then
100 install -m 0644 Makefile Makefile.orig
101 fi
102 sed -i -e 's,^CONFIGURE_LDFLAGS=.*,CONFIGURE_LDFLAGS=-L. -L${STAGING_LIBDIR},g' \
103 -e 's,libdir=${libdir},libdir=${STAGING_LIBDIR},g' \
104 -e 's,libexecdir=${libexecdir},libexecdir=${STAGING_DIR_HOST}${libexecdir},g' \
105 -e 's,^LIBDIR=.*,LIBDIR=${STAGING_LIBDIR},g' \
106 -e 's,includedir=${includedir},includedir=${STAGING_INCDIR},g' \
107 -e 's,^INCLUDEDIR=.*,INCLUDE=${STAGING_INCDIR},g' \
108 -e 's,^CONFINCLUDEDIR=.*,CONFINCLUDE=${STAGING_INCDIR},g' \
109 Makefile
110 # save copy of it now, because if we do it in do_install and
111 # then call do_install twice we get Makefile.orig == Makefile.sysroot
112 install -m 0644 Makefile Makefile.sysroot
113
114 oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python3-native/pgen \
115 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python3-native/python3 \
116 STAGING_LIBDIR=${STAGING_LIBDIR} \
117 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
118 STAGING_INCDIR=${STAGING_INCDIR} \
119 LIB=${baselib} \
120 ARCH=${TARGET_ARCH} \
121 OPT="${CFLAGS}" libpython3.so
122
123 oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python3-native/pgen \
124 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python3-native/python3 \
125 STAGING_LIBDIR=${STAGING_LIBDIR} \
126 STAGING_INCDIR=${STAGING_INCDIR} \
127 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
128 LIB=${baselib} \
129 ARCH=${TARGET_ARCH} \
130 OPT="${CFLAGS}"
131}
132
133do_install() {
134 # make install needs the original Makefile, or otherwise the inclues would
135 # go to ${D}${STAGING...}/...
136 install -m 0644 Makefile.orig Makefile
137
138 install -d ${D}${libdir}/pkgconfig
139 install -d ${D}${libdir}/python${PYTHON_MAJMIN}/config
140
141 # rerun the build once again with original makefile this time
142 # run install in a separate step to avoid compile/install race
143 oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python3-native/pgen \
144 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python3-native/python3 \
145 STAGING_LIBDIR=${STAGING_LIBDIR} \
146 STAGING_INCDIR=${STAGING_INCDIR} \
147 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
148 LIB=${baselib} \
149 ARCH=${TARGET_ARCH} \
150 DESTDIR=${D} LIBDIR=${libdir}
151
152 oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python3-native/pgen \
153 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python3-native/python3 \
154 STAGING_LIBDIR=${STAGING_LIBDIR} \
155 STAGING_INCDIR=${STAGING_INCDIR} \
156 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
157 LIB=${baselib} \
158 ARCH=${TARGET_ARCH} \
159 DESTDIR=${D} LIBDIR=${libdir} install
160
161 # avoid conflict with 2to3 from Python 2
162 rm -f ${D}/${bindir}/2to3
163
164 install -m 0644 Makefile.sysroot ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
165 install -m 0644 Makefile.sysroot ${D}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}/Makefile
166
167 if [ -e ${WORKDIR}/sitecustomize.py ]; then
168 install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN}
169 fi
170
171 oe_multilib_header python${PYTHON_BINABI}/pyconfig.h
172}
173
174do_install_append_class-nativesdk () {
175 create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo'
176}
177
178SSTATE_SCAN_FILES += "Makefile"
179PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
180
181py_package_preprocess () {
182 # copy back the old Makefile to fix target package
183 install -m 0644 ${B}/Makefile.orig ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
184 install -m 0644 ${B}/Makefile.orig ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}/Makefile
185 # Remove references to buildmachine paths in target Makefile and _sysconfigdata
186 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
187 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile \
188 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}/Makefile \
189 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py
190}
191
192require python-${PYTHON_MAJMIN}-manifest.inc
193
194# manual dependency additions
195RPROVIDES_${PN}-modules = "${PN}"
196RRECOMMENDS_${PN}-core = "${PN}-readline"
197RRECOMMENDS_${PN}-crypt = "openssl"
198RRECOMMENDS_${PN}-crypt_class-nativesdk = "nativesdk-openssl"
199
200FILES_${PN}-2to3 += "${bindir}/2to3-${PYTHON_MAJMIN}"
201FILES_${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3"
202FILES_${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}"
203
204PACKAGES =+ "${PN}-pyvenv"
205FILES_${PN}-pyvenv += "${bindir}/pyvenv-${PYTHON_MAJMIN} ${bindir}/pyvenv"
206
207# package libpython3
208PACKAGES =+ "libpython3 libpython3-staticdev"
209FILES_libpython3 = "${libdir}/libpython*.so.*"
210FILES_libpython3-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_BINABI}/libpython${PYTHON_BINABI}.a"
211INSANE_SKIP_${PN}-dev += "dev-elf"
212
213# catch all the rest (unsorted)
214PACKAGES += "${PN}-misc"
215RDEPENDS_${PN}-misc += "${PN}-core ${PN}-email ${PN}-codecs ${PN}-textutils ${PN}-argparse"
216RDEPENDS_${PN}-modules += "${PN}-misc"
217FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}"
218
219# catch manpage
220PACKAGES += "${PN}-man"
221FILES_${PN}-man = "${datadir}/man"
222
223BBCLASSEXTEND = "nativesdk"