luaposix: bump to version 31
[buildroot-gz.git] / package / python3 / python3.mk
bloba8a1942f0dad0a1400625f97f7272346953d62ba
1 ################################################################################
3 # python3
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 += \
19 --without-cxx-main \
20 --disable-sqlite3 \
21 --disable-tk \
22 --with-expat=system \
23 --disable-curses \
24 --disable-codecs-cjk \
25 --disable-nis \
26 --disable-unicodedata \
27 --disable-test-modules \
28 --disable-idle3
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) \
42 ./configure \
43 --prefix="$(HOST_DIR)/usr" \
44 --sysconfdir="$(HOST_DIR)/etc" \
45 $(HOST_PYTHON3_CONF_OPT) \
47 endef
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
57 endif
59 ifeq ($(BR2_PACKAGE_PYTHON3_CURSES),y)
60 PYTHON3_DEPENDENCIES += ncurses
61 else
62 PYTHON3_CONF_OPT += --disable-curses
63 endif
65 ifeq ($(BR2_PACKAGE_PYTHON3_PYEXPAT),y)
66 PYTHON3_DEPENDENCIES += expat
67 PYTHON3_CONF_OPT += --with-expat=system
68 else
69 PYTHON3_CONF_OPT += --with-expat=none
70 endif
72 ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
73 PYTHON3_CONF_OPT += --enable-old-stdlib-cache
74 endif
76 ifeq ($(BR2_PACKAGE_PYTHON3_SQLITE),y)
77 PYTHON3_DEPENDENCIES += sqlite
78 else
79 PYTHON3_CONF_OPT += --disable-sqlite3
80 endif
82 ifeq ($(BR2_PACKAGE_PYTHON3_SSL),y)
83 PYTHON3_DEPENDENCIES += openssl
84 endif
86 ifneq ($(BR2_PACKAGE_PYTHON3_CODECSCJK),y)
87 PYTHON3_CONF_OPT += --disable-codecs-cjk
88 endif
90 ifneq ($(BR2_PACKAGE_PYTHON3_UNICODEDATA),y)
91 PYTHON3_CONF_OPT += --disable-unicodedata
92 endif
94 ifeq ($(BR2_PACKAGE_PYTHON3_BZIP2),y)
95 PYTHON3_DEPENDENCIES += bzip2
96 endif
98 ifeq ($(BR2_PACKAGE_PYTHON3_ZLIB),y)
99 PYTHON3_DEPENDENCIES += zlib
100 endif
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 += \
112 --without-cxx-main \
113 --with-system-ffi \
114 --disable-pydoc \
115 --disable-test-modules \
116 --disable-lib2to3 \
117 --disable-tk \
118 --disable-nis \
119 --disable-idle3
121 PYTHON3_MAKE_ENV = \
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
132 endef
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 \
147 rm -f $$i ; \
148 done
149 endef
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
157 endef
159 ifneq ($(BR2_PACKAGE_PYTHON),y)
160 PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_INSTALL_SYMLINK
161 endif
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 \
167 rm -rf $$i ; \
168 done
169 endef
170 endif
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) \
175 -name *.py` ; do \
176 rm -f $$i ; \
177 done
178 endef
179 endif
181 PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_REMOVE_MODULES_FILES
184 $(eval $(autotools-package))
185 $(eval $(host-autotools-package))