1 ################################################################################
5 ################################################################################
7 PYTHON3_VERSION_MAJOR
= 3.3
8 PYTHON3_VERSION
= $(PYTHON3_VERSION_MAJOR
).0
9 PYTHON3_SOURCE
= Python-
$(PYTHON3_VERSION
).
tar.xz
10 PYTHON3_SITE
= http
://python.org
/ftp
/python
/$(PYTHON3_VERSION
)
12 # Python needs itself and a "pgen" program to build itself, both being
13 # provided in the Python sources. So in order to cross-compile Python,
14 # we need to build a host Python first. This host Python is also
15 # installed in $(HOST_DIR), as it is needed when cross-compiling
16 # third-party Python modules.
18 HOST_PYTHON3_CONF_OPT
+= \
24 --disable-codecs-cjk \
26 --disable-unicodedata \
27 --disable-test-modules \
30 HOST_PYTHON3_MAKE_ENV
= \
31 PYTHON_MODULES_INCLUDE
=$(HOST_DIR
)/usr
/include \
32 PYTHON_MODULES_LIB
="$(HOST_DIR)/lib $(HOST_DIR)/usr/lib"
34 HOST_PYTHON3_AUTORECONF
= YES
36 define HOST_PYTHON3_CONFIGURE_CMDS
37 (cd
$(@D
) && rm -rf config.cache
; \
38 $(HOST_CONFIGURE_OPTS
) \
39 CFLAGS
="$(HOST_CFLAGS)" \
40 LDFLAGS
="$(HOST_LDFLAGS)" \
41 $(HOST_PYTHON3_CONF_ENV
) \
43 --prefix="$(HOST_DIR)/usr" \
44 --sysconfdir
="$(HOST_DIR)/etc" \
45 $(HOST_PYTHON3_CONF_OPT
) \
49 PYTHON3_DEPENDENCIES
= host-python3 libffi
51 HOST_PYTHON3_DEPENDENCIES
= host-expat host-zlib
53 PYTHON3_INSTALL_STAGING
= YES
55 ifeq ($(BR2_PACKAGE_PYTHON3_READLINE
),y
)
56 PYTHON3_DEPENDENCIES
+= readline
59 ifeq ($(BR2_PACKAGE_PYTHON3_CURSES
),y
)
60 PYTHON3_DEPENDENCIES
+= ncurses
62 PYTHON3_CONF_OPT
+= --disable-curses
65 ifeq ($(BR2_PACKAGE_PYTHON3_PYEXPAT
),y
)
66 PYTHON3_DEPENDENCIES
+= expat
67 PYTHON3_CONF_OPT
+= --with-expat
=system
69 PYTHON3_CONF_OPT
+= --with-expat
=none
72 ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY
),y
)
73 PYTHON3_CONF_OPT
+= --enable-old-stdlib-cache
76 ifeq ($(BR2_PACKAGE_PYTHON3_SQLITE
),y
)
77 PYTHON3_DEPENDENCIES
+= sqlite
79 PYTHON3_CONF_OPT
+= --disable-sqlite3
82 ifeq ($(BR2_PACKAGE_PYTHON3_SSL
),y
)
83 PYTHON3_DEPENDENCIES
+= openssl
86 ifneq ($(BR2_PACKAGE_PYTHON3_CODECSCJK
),y
)
87 PYTHON3_CONF_OPT
+= --disable-codecs-cjk
90 ifneq ($(BR2_PACKAGE_PYTHON3_UNICODEDATA
),y
)
91 PYTHON3_CONF_OPT
+= --disable-unicodedata
94 ifeq ($(BR2_PACKAGE_PYTHON3_BZIP2
),y
)
95 PYTHON3_DEPENDENCIES
+= bzip2
98 ifeq ($(BR2_PACKAGE_PYTHON3_ZLIB
),y
)
99 PYTHON3_DEPENDENCIES
+= zlib
102 PYTHON3_CONF_ENV
+= \
103 _PROJECT_BASE
=$(PYTHON3_DIR
) \
104 _PYTHON_HOST_PLATFORM
=$(BR2_HOSTARCH
) \
105 PYTHON_FOR_BUILD
=$(HOST_PYTHON3_DIR
)/python \
106 PGEN_FOR_BUILD
=$(HOST_PYTHON3_DIR
)/Parser
/pgen \
107 ac_cv_have_long_long_format
=yes \
108 ac_cv_file__dev_ptmx
=yes \
109 ac_cv_file__dev_ptc
=yes \
111 PYTHON3_CONF_OPT
+= \
115 --disable-test-modules \
122 _PROJECT_BASE
=$(PYTHON3_DIR
) \
123 _PYTHON_HOST_PLATFORM
=$(BR2_HOSTARCH
) \
124 PYTHON_MODULES_INCLUDE
=$(STAGING_DIR
)/usr
/include \
125 PYTHON_MODULES_LIB
="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib"
127 # python distutils adds -L$LIBDIR when linking binary extensions, causing
128 # trouble for cross compilation
129 define PYTHON3_FIXUP_LIBDIR
130 $(SED
) 's|^LIBDIR=.*|LIBDIR= $(STAGING_DIR)/usr/lib|' \
131 $(STAGING_DIR
)/usr
/lib
/python
$(PYTHON3_VERSION_MAJOR
)/config-3.3m
/Makefile
134 PYTHON3_POST_INSTALL_STAGING_HOOKS
+= PYTHON3_FIXUP_LIBDIR
137 # Remove useless files. In the config/ directory, only the Makefile
138 # and the pyconfig.h files are needed at runtime.
140 define PYTHON3_REMOVE_USELESS_FILES
141 rm -f
$(TARGET_DIR
)/usr
/bin
/python
$(PYTHON3_VERSION_MAJOR
)-config
142 rm -f
$(TARGET_DIR
)/usr
/bin
/python
$(PYTHON3_VERSION_MAJOR
)m-config
143 rm -f
$(TARGET_DIR
)/usr
/bin
/python3-config
144 rm -f
$(TARGET_DIR
)/usr
/bin
/smtpd.py
.3
145 for i in
`find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/config-3.3m/ \
146 -type f -not -name pyconfig.h -a -not -name Makefile` ; do \
151 PYTHON3_POST_INSTALL_TARGET_HOOKS
+= PYTHON3_REMOVE_USELESS_FILES
153 PYTHON3_AUTORECONF
= YES
155 define PYTHON3_INSTALL_SYMLINK
156 ln
-fs python3
$(TARGET_DIR
)/usr
/bin
/python
159 ifneq ($(BR2_PACKAGE_PYTHON
),y
)
160 PYTHON3_POST_INSTALL_TARGET_HOOKS
+= PYTHON3_INSTALL_SYMLINK
163 ifeq ($(BR2_PACKAGE_PYTHON3_PY_ONLY
),y
)
164 define PYTHON3_REMOVE_MODULES_FILES
165 for i in
`find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) \
166 -name __pycache__` ; do \
172 ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY
),y
)
173 define PYTHON3_REMOVE_MODULES_FILES
174 for i in
`find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) \
181 PYTHON3_POST_INSTALL_TARGET_HOOKS
+= PYTHON3_REMOVE_MODULES_FILES
184 $(eval
$(autotools-package
))
185 $(eval
$(host-autotools-package
))