1 ################################################################################
5 ################################################################################
7 PYTHON3_VERSION_MAJOR
= 3.4
8 PYTHON3_VERSION
= $(PYTHON3_VERSION_MAJOR
).1
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
14 # Python needs itself and a "pgen" program to build itself, both being
15 # provided in the Python sources. So in order to cross-compile Python,
16 # we need to build a host Python first. This host Python is also
17 # installed in $(HOST_DIR), as it is needed when cross-compiling
18 # third-party Python modules.
20 HOST_PYTHON3_CONF_OPTS
+= \
27 --disable-codecs-cjk \
29 --enable-unicodedata \
30 --disable-test-modules \
34 # Make sure that LD_LIBRARY_PATH overrides -rpath.
35 # This is needed because libpython may be installed at the same time that
37 HOST_PYTHON3_CONF_ENV
+= \
38 LDFLAGS
="$(HOST_LDFLAGS) -Wl,--enable-new-dtags"
40 PYTHON3_DEPENDENCIES
= host-python3 libffi
42 HOST_PYTHON3_DEPENDENCIES
= host-expat host-zlib
44 PYTHON3_INSTALL_STAGING
= YES
46 ifeq ($(BR2_PACKAGE_PYTHON3_READLINE
),y
)
47 PYTHON3_DEPENDENCIES
+= readline
50 ifeq ($(BR2_PACKAGE_PYTHON3_CURSES
),y
)
51 PYTHON3_DEPENDENCIES
+= ncurses
53 PYTHON3_CONF_OPTS
+= --disable-curses
56 ifeq ($(BR2_PACKAGE_PYTHON3_DECIMAL
),y
)
57 PYTHON3_DEPENDENCIES
+= mpdecimal
58 PYTHON3_CONF_OPTS
+= --with-libmpdec
=system
60 PYTHON3_CONF_OPTS
+= --with-libmpdec
=none
63 ifeq ($(BR2_PACKAGE_PYTHON3_PYEXPAT
),y
)
64 PYTHON3_DEPENDENCIES
+= expat
65 PYTHON3_CONF_OPTS
+= --with-expat
=system
67 PYTHON3_CONF_OPTS
+= --with-expat
=none
70 ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY
),y
)
71 PYTHON3_CONF_OPTS
+= --enable-old-stdlib-cache
74 ifeq ($(BR2_PACKAGE_PYTHON3_PY_ONLY
),y
)
75 PYTHON3_CONF_OPTS
+= --disable-pyc-build
78 ifeq ($(BR2_PACKAGE_PYTHON3_SQLITE
),y
)
79 PYTHON3_DEPENDENCIES
+= sqlite
81 PYTHON3_CONF_OPTS
+= --disable-sqlite3
84 ifeq ($(BR2_PACKAGE_PYTHON3_SSL
),y
)
85 PYTHON3_DEPENDENCIES
+= openssl
88 ifneq ($(BR2_PACKAGE_PYTHON3_CODECSCJK
),y
)
89 PYTHON3_CONF_OPTS
+= --disable-codecs-cjk
92 ifneq ($(BR2_PACKAGE_PYTHON3_UNICODEDATA
),y
)
93 PYTHON3_CONF_OPTS
+= --disable-unicodedata
96 ifeq ($(BR2_PACKAGE_PYTHON3_BZIP2
),y
)
97 PYTHON3_DEPENDENCIES
+= bzip2
100 ifeq ($(BR2_PACKAGE_PYTHON3_ZLIB
),y
)
101 PYTHON3_DEPENDENCIES
+= zlib
104 PYTHON3_CONF_ENV
+= \
105 ac_cv_have_long_long_format
=yes \
106 ac_cv_file__dev_ptmx
=yes \
107 ac_cv_file__dev_ptc
=yes \
108 ac_cv_working_tzset
=yes
110 PYTHON3_CONF_OPTS
+= \
111 --without-ensurepip \
115 --disable-test-modules \
122 # This is needed to make sure the Python build process doesn't try to
123 # regenerate those files with the pgen program. Otherwise, it builds
124 # pgen for the target, and tries to run it on the host.
126 define PYTHON3_TOUCH_GRAMMAR_FILES
127 touch
$(@D
)/Include
/graminit.h
$(@D
)/Python
/graminit.c
130 PYTHON3_POST_PATCH_HOOKS
+= PYTHON3_TOUCH_GRAMMAR_FILES
133 # Remove useless files. In the config/ directory, only the Makefile
134 # and the pyconfig.h files are needed at runtime.
136 define PYTHON3_REMOVE_USELESS_FILES
137 rm -f
$(TARGET_DIR
)/usr
/bin
/python
$(PYTHON3_VERSION_MAJOR
)-config
138 rm -f
$(TARGET_DIR
)/usr
/bin
/python
$(PYTHON3_VERSION_MAJOR
)m-config
139 rm -f
$(TARGET_DIR
)/usr
/bin
/python3-config
140 rm -f
$(TARGET_DIR
)/usr
/bin
/smtpd.py
.3
141 for i in
`find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/config-$(PYTHON3_VERSION_MAJOR)m/ \
142 -type f -not -name pyconfig.h -a -not -name Makefile` ; do \
145 rm -rf
$(TARGET_DIR
)/usr
/lib
/python
$(PYTHON3_VERSION_MAJOR
)/__pycache__
/
146 rm -rf
$(TARGET_DIR
)/usr
/lib
/python
$(PYTHON3_VERSION_MAJOR
)/lib-dynload
/sysconfigdata
/__pycache__
147 rm -rf
$(TARGET_DIR
)/usr
/lib
/python
$(PYTHON3_VERSION_MAJOR
)/collections
/__pycache__
148 rm -rf
$(TARGET_DIR
)/usr
/lib
/python
$(PYTHON3_VERSION_MAJOR
)/importlib
/__pycache__
151 PYTHON3_POST_INSTALL_TARGET_HOOKS
+= PYTHON3_REMOVE_USELESS_FILES
154 # Make sure libpython gets stripped out on target
156 define PYTHON3_ENSURE_LIBPYTHON_STRIPPED
157 chmod u
+w
$(TARGET_DIR
)/usr
/lib
/libpython
$(PYTHON3_VERSION_MAJOR
)*.so
160 PYTHON3_POST_INSTALL_TARGET_HOOKS
+= PYTHON3_ENSURE_LIBPYTHON_STRIPPED
162 PYTHON3_AUTORECONF
= YES
164 define PYTHON3_INSTALL_SYMLINK
165 ln
-fs python3
$(TARGET_DIR
)/usr
/bin
/python
168 ifneq ($(BR2_PACKAGE_PYTHON
),y
)
169 PYTHON3_POST_INSTALL_TARGET_HOOKS
+= PYTHON3_INSTALL_SYMLINK
172 # Some packages may have build scripts requiring python3, whatever is the
173 # python version chosen for the target.
174 # Only install the python symlink in the host tree if python3 is enabled
176 ifeq ($(BR2_PACKAGE_PYTHON3
),y
)
177 define HOST_PYTHON3_INSTALL_SYMLINK
178 ln
-fs python3
$(HOST_DIR
)/usr
/bin
/python
179 ln
-fs python3-config
$(HOST_DIR
)/usr
/bin
/python-config
182 HOST_PYTHON3_POST_INSTALL_HOOKS
+= HOST_PYTHON3_INSTALL_SYMLINK
185 # Provided to other packages
186 PYTHON3_PATH
= $(TARGET_DIR
)/usr
/lib
/python
$(PYTHON3_VERSION_MAJOR
)/sysconfigdata
/:$(TARGET_DIR
)/usr
/lib
/python
$(PYTHON3_VERSION_MAJOR
)/site-packages
/
188 $(eval
$(autotools-package
))
189 $(eval
$(host-autotools-package
))
191 ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY
),y
)
192 define PYTHON3_FINALIZE_TARGET
193 find
$(TARGET_DIR
)/usr
/lib
/python
$(PYTHON3_VERSION_MAJOR
) -name
'*.py' -print0 | xargs
-0 rm -f
197 ifeq ($(BR2_PACKAGE_PYTHON3_PY_ONLY
),y
)
198 define PYTHON3_FINALIZE_TARGET
199 find
$(TARGET_DIR
)/usr
/lib
/python
$(PYTHON3_VERSION_MAJOR
) -name
'*.pyc' -print0 | xargs
-0 rm -f
203 TARGET_FINALIZE_HOOKS
+= PYTHON3_FINALIZE_TARGET