The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / python3 / python3.mk
1 ################################################################################
2 #
3 # python3
4 #
5 ################################################################################
6
7 PYTHON3_VERSION_MAJOR = 3.4
8 PYTHON3_VERSION = $(PYTHON3_VERSION_MAJOR).3
9 PYTHON3_SOURCE = Python-$(PYTHON3_VERSION).tar.xz
10 PYTHON3_SITE = http://python.org/ftp/python/$(PYTHON3_VERSION)
11 PYTHON3_LICENSE = Python software foundation license v2, others
12 PYTHON3_LICENSE_FILES = LICENSE
13
14 # Python itself doesn't use libtool, but it includes the source code
15 # of libffi, which uses libtool. Unfortunately, it uses a beta version
16 # of libtool for which we don't have a matching patch. However, this
17 # is not a problem, because we don't use the libffi copy included in
18 # the Python sources, but instead use an external libffi library.
19 PYTHON3_LIBTOOL_PATCH = NO
20
21 # Python needs itself and a "pgen" program to build itself, both being
22 # provided in the Python sources. So in order to cross-compile Python,
23 # we need to build a host Python first. This host Python is also
24 # installed in $(HOST_DIR), as it is needed when cross-compiling
25 # third-party Python modules.
26
27 HOST_PYTHON3_CONF_OPTS +=       \
28         --without-ensurepip     \
29         --without-cxx-main      \
30         --disable-sqlite3       \
31         --disable-tk            \
32         --with-expat=system     \
33         --disable-curses        \
34         --disable-codecs-cjk    \
35         --disable-nis           \
36         --enable-unicodedata    \
37         --disable-test-modules  \
38         --disable-idle3         \
39         --disable-ossaudiodev   \
40         --disable-pyo-build
41
42 # Make sure that LD_LIBRARY_PATH overrides -rpath.
43 # This is needed because libpython may be installed at the same time that
44 # python is called.
45 HOST_PYTHON3_CONF_ENV += \
46         LDFLAGS="$(HOST_LDFLAGS) -Wl,--enable-new-dtags"
47
48 PYTHON3_DEPENDENCIES = host-python3 libffi
49
50 HOST_PYTHON3_DEPENDENCIES = host-expat host-zlib
51
52 PYTHON3_INSTALL_STAGING = YES
53
54 ifeq ($(BR2_PACKAGE_PYTHON3_READLINE),y)
55 PYTHON3_DEPENDENCIES += readline
56 endif
57
58 ifeq ($(BR2_PACKAGE_PYTHON3_CURSES),y)
59 PYTHON3_DEPENDENCIES += ncurses
60 else
61 PYTHON3_CONF_OPTS += --disable-curses
62 endif
63
64 ifeq ($(BR2_PACKAGE_PYTHON3_DECIMAL),y)
65 PYTHON3_DEPENDENCIES += mpdecimal
66 PYTHON3_CONF_OPTS += --with-libmpdec=system
67 else
68 PYTHON3_CONF_OPTS += --with-libmpdec=none
69 endif
70
71 ifeq ($(BR2_PACKAGE_PYTHON3_PYEXPAT),y)
72 PYTHON3_DEPENDENCIES += expat
73 PYTHON3_CONF_OPTS += --with-expat=system
74 else
75 PYTHON3_CONF_OPTS += --with-expat=none
76 endif
77
78 ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
79 PYTHON3_CONF_OPTS += --enable-old-stdlib-cache
80 endif
81
82 ifeq ($(BR2_PACKAGE_PYTHON3_PY_ONLY),y)
83 PYTHON3_CONF_OPTS += --disable-pyc-build
84 endif
85
86 ifeq ($(BR2_PACKAGE_PYTHON3_SQLITE),y)
87 PYTHON3_DEPENDENCIES += sqlite
88 else
89 PYTHON3_CONF_OPTS += --disable-sqlite3
90 endif
91
92 ifeq ($(BR2_PACKAGE_PYTHON3_SSL),y)
93 PYTHON3_DEPENDENCIES += openssl
94 endif
95
96 ifneq ($(BR2_PACKAGE_PYTHON3_CODECSCJK),y)
97 PYTHON3_CONF_OPTS += --disable-codecs-cjk
98 endif
99
100 ifneq ($(BR2_PACKAGE_PYTHON3_UNICODEDATA),y)
101 PYTHON3_CONF_OPTS += --disable-unicodedata
102 endif
103
104 ifeq ($(BR2_PACKAGE_PYTHON3_BZIP2),y)
105 PYTHON3_DEPENDENCIES += bzip2
106 endif
107
108 ifeq ($(BR2_PACKAGE_PYTHON3_ZLIB),y)
109 PYTHON3_DEPENDENCIES += zlib
110 endif
111
112 ifeq ($(BR2_PACKAGE_PYTHON3_OSSAUDIODEV),y)
113 PYTHON3_CONF_OPTS += --enable-ossaudiodev
114 else
115 PYTHON3_CONF_OPTS += --disable-ossaudiodev
116 endif
117
118 PYTHON3_CONF_ENV += \
119         ac_cv_have_long_long_format=yes \
120         ac_cv_file__dev_ptmx=yes \
121         ac_cv_file__dev_ptc=yes \
122         ac_cv_working_tzset=yes
123
124 # uClibc is known to have a broken wcsftime() implementation, so tell
125 # Python 3 to fall back to strftime() instead.
126 ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
127 PYTHON3_CONF_ENV += ac_cv_func_wcsftime=no
128 endif
129
130 PYTHON3_CONF_OPTS += \
131         --without-ensurepip     \
132         --without-cxx-main      \
133         --with-system-ffi       \
134         --disable-pydoc         \
135         --disable-test-modules  \
136         --disable-lib2to3       \
137         --disable-tk            \
138         --disable-nis           \
139         --disable-idle3         \
140         --disable-pyo-build
141
142 # This is needed to make sure the Python build process doesn't try to
143 # regenerate those files with the pgen program. Otherwise, it builds
144 # pgen for the target, and tries to run it on the host.
145
146 define PYTHON3_TOUCH_GRAMMAR_FILES
147         touch $(@D)/Include/graminit.h $(@D)/Python/graminit.c
148 endef
149
150 PYTHON3_POST_PATCH_HOOKS += PYTHON3_TOUCH_GRAMMAR_FILES
151
152 #
153 # Remove useless files. In the config/ directory, only the Makefile
154 # and the pyconfig.h files are needed at runtime.
155 #
156 define PYTHON3_REMOVE_USELESS_FILES
157         rm -f $(TARGET_DIR)/usr/bin/python$(PYTHON3_VERSION_MAJOR)-config
158         rm -f $(TARGET_DIR)/usr/bin/python$(PYTHON3_VERSION_MAJOR)m-config
159         rm -f $(TARGET_DIR)/usr/bin/python3-config
160         rm -f $(TARGET_DIR)/usr/bin/smtpd.py.3
161         for i in `find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/config-$(PYTHON3_VERSION_MAJOR)m/ \
162                 -type f -not -name pyconfig.h -a -not -name Makefile` ; do \
163                 rm -f $$i ; \
164         done
165         rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/__pycache__/
166         rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/lib-dynload/sysconfigdata/__pycache__
167         rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/collections/__pycache__
168         rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/importlib/__pycache__
169 endef
170
171 PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_REMOVE_USELESS_FILES
172
173 #
174 # Make sure libpython gets stripped out on target
175 #
176 define PYTHON3_ENSURE_LIBPYTHON_STRIPPED
177         chmod u+w $(TARGET_DIR)/usr/lib/libpython$(PYTHON3_VERSION_MAJOR)*.so
178 endef
179
180 PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_ENSURE_LIBPYTHON_STRIPPED
181
182 PYTHON3_AUTORECONF = YES
183
184 define PYTHON3_INSTALL_SYMLINK
185         ln -fs python3 $(TARGET_DIR)/usr/bin/python
186 endef
187
188 ifneq ($(BR2_PACKAGE_PYTHON),y)
189 PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_INSTALL_SYMLINK
190 endif
191
192 # Some packages may have build scripts requiring python3, whatever is the
193 # python version chosen for the target.
194 # Only install the python symlink in the host tree if python3 is enabled
195 # for the target.
196 ifeq ($(BR2_PACKAGE_PYTHON3),y)
197 define HOST_PYTHON3_INSTALL_SYMLINK
198         ln -fs python3 $(HOST_DIR)/usr/bin/python
199         ln -fs python3-config $(HOST_DIR)/usr/bin/python-config
200 endef
201
202 HOST_PYTHON3_POST_INSTALL_HOOKS += HOST_PYTHON3_INSTALL_SYMLINK
203 endif
204
205 # Provided to other packages
206 PYTHON3_PATH = $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/sysconfigdata/:$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/
207
208 $(eval $(autotools-package))
209 $(eval $(host-autotools-package))
210
211 ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
212 define PYTHON3_FINALIZE_TARGET
213         find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.py' -print0 | xargs -0 rm -f
214 endef
215 endif
216
217 ifeq ($(BR2_PACKAGE_PYTHON3_PY_ONLY),y)
218 define PYTHON3_FINALIZE_TARGET
219         find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.pyc' -print0 | xargs -0 rm -f
220 endef
221 endif
222
223 TARGET_FINALIZE_HOOKS += PYTHON3_FINALIZE_TARGET