diff options
Diffstat (limited to 'meta/recipes-devtools/python')
-rw-r--r-- | meta/recipes-devtools/python/python3_3.5.5.bb | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/meta/recipes-devtools/python/python3_3.5.5.bb b/meta/recipes-devtools/python/python3_3.5.5.bb index 8e94e38a2d..aad2e3abe6 100644 --- a/meta/recipes-devtools/python/python3_3.5.5.bb +++ b/meta/recipes-devtools/python/python3_3.5.5.bb | |||
@@ -73,7 +73,8 @@ CACHED_CONFIGUREVARS = "ac_cv_have_chflags=no \ | |||
73 | TARGET_CC_ARCH += "-DNDEBUG -fno-inline" | 73 | TARGET_CC_ARCH += "-DNDEBUG -fno-inline" |
74 | SDK_CC_ARCH += "-DNDEBUG -fno-inline" | 74 | SDK_CC_ARCH += "-DNDEBUG -fno-inline" |
75 | EXTRA_OEMAKE += "CROSS_COMPILE=yes" | 75 | EXTRA_OEMAKE += "CROSS_COMPILE=yes" |
76 | EXTRA_OECONF += "CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ --without-ensurepip --enable-optimizations" | 76 | EXTRA_OECONF += "CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ --without-ensurepip" |
77 | |||
77 | PYTHON3_PROFILE_TASK ?= "${S}/Tools/pybench/pybench.py -n 1" | 78 | PYTHON3_PROFILE_TASK ?= "${S}/Tools/pybench/pybench.py -n 1" |
78 | 79 | ||
79 | export CROSS_COMPILE = "${TARGET_PREFIX}" | 80 | export CROSS_COMPILE = "${TARGET_PREFIX}" |
@@ -87,8 +88,10 @@ export CROSSPYTHONPATH = "${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dy | |||
87 | # No ctypes option for python 3 | 88 | # No ctypes option for python 3 |
88 | PYTHONLSBOPTS = "" | 89 | PYTHONLSBOPTS = "" |
89 | 90 | ||
90 | PACKAGECONFIG ??= "readline" | 91 | PACKAGECONFIG ??= "readline ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'pgo', '', d)}" |
91 | PACKAGECONFIG[readline] = ",,readline" | 92 | PACKAGECONFIG[readline] = ",,readline" |
93 | # Use profile guided optimisation by running PyBench inside qemu-user | ||
94 | PACKAGECONFIG[pgo] = "--enable-optimizations" | ||
92 | 95 | ||
93 | do_configure_append() { | 96 | do_configure_append() { |
94 | rm -f ${S}/Makefile.orig | 97 | rm -f ${S}/Makefile.orig |
@@ -108,16 +111,16 @@ run_make() { | |||
108 | } | 111 | } |
109 | 112 | ||
110 | do_compile() { | 113 | do_compile() { |
111 | # regenerate platform specific files, because they depend on system headers | 114 | # regenerate platform specific files, because they depend on system headers |
112 | cd ${S}/Lib/plat-linux* | 115 | cd ${S}/Lib/plat-linux* |
113 | include=${STAGING_INCDIR} ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ | 116 | include=${STAGING_INCDIR} ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ |
114 | ${S}/Tools/scripts/h2py.py -i '(u_long)' \ | 117 | ${S}/Tools/scripts/h2py.py -i '(u_long)' \ |
115 | ${STAGING_INCDIR}/dlfcn.h \ | 118 | ${STAGING_INCDIR}/dlfcn.h \ |
116 | ${STAGING_INCDIR}/linux/cdrom.h \ | 119 | ${STAGING_INCDIR}/linux/cdrom.h \ |
117 | ${STAGING_INCDIR}/netinet/in.h \ | 120 | ${STAGING_INCDIR}/netinet/in.h \ |
118 | ${STAGING_INCDIR}/sys/types.h | 121 | ${STAGING_INCDIR}/sys/types.h |
119 | sed -e 's,${STAGING_DIR_HOST},,g' -i *.py | 122 | sed -e 's,${STAGING_DIR_HOST},,g' -i *.py |
120 | cd - | 123 | cd - |
121 | 124 | ||
122 | # remove any bogus LD_LIBRARY_PATH | 125 | # remove any bogus LD_LIBRARY_PATH |
123 | sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile | 126 | sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile |
@@ -137,20 +140,21 @@ do_compile() { | |||
137 | # then call do_install twice we get Makefile.orig == Makefile.sysroot | 140 | # then call do_install twice we get Makefile.orig == Makefile.sysroot |
138 | install -m 0644 Makefile Makefile.sysroot | 141 | install -m 0644 Makefile Makefile.sysroot |
139 | 142 | ||
140 | run_make profile-opt | 143 | if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then |
141 | 144 | run_make profile-opt | |
142 | if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then | 145 | qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}" |
143 | qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}" | 146 | cat > pgo-image-qemuwrapper << EOF |
144 | cat > pgo-image-qemuwrapper << EOF | ||
145 | #!/bin/sh | 147 | #!/bin/sh |
146 | set -x | 148 | set -x |
147 | $qemu_binary "\$@" | 149 | $qemu_binary "\$@" |
148 | EOF | 150 | EOF |
149 | chmod +x pgo-image-qemuwrapper | 151 | chmod +x pgo-image-qemuwrapper |
150 | ./pgo-image-qemuwrapper ${B}/python ${PYTHON3_PROFILE_TASK} || true | 152 | ./pgo-image-qemuwrapper ${B}/python ${PYTHON3_PROFILE_TASK} || true |
153 | run_make clean_and_use_profile | ||
154 | else | ||
155 | run_make libpython3.so | ||
156 | run_make | ||
151 | fi | 157 | fi |
152 | |||
153 | run_make clean_and_use_profile | ||
154 | } | 158 | } |
155 | 159 | ||
156 | do_install() { | 160 | do_install() { |
@@ -163,8 +167,12 @@ do_install() { | |||
163 | 167 | ||
164 | # rerun the build once again with original makefile this time | 168 | # rerun the build once again with original makefile this time |
165 | # run install in a separate step to avoid compile/install race | 169 | # run install in a separate step to avoid compile/install race |
166 | run_make DESTDIR=${D} LIBDIR=${libdir} build_all_use_profile | 170 | if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then |
167 | 171 | run_make DESTDIR=${D} LIBDIR=${libdir} build_all_use_profile | |
172 | else | ||
173 | run_make DESTDIR=${D} LIBDIR=${libdir} | ||
174 | fi | ||
175 | |||
168 | run_make DESTDIR=${D} LIBDIR=${libdir} install | 176 | run_make DESTDIR=${D} LIBDIR=${libdir} install |
169 | 177 | ||
170 | # avoid conflict with 2to3 from Python 2 | 178 | # avoid conflict with 2to3 from Python 2 |