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