2 # Copyright (C) 2006-2016 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
11 include .
/files
/python-version.mk
14 PKG_VERSION
:=$(PYTHON_VERSION
).
$(PYTHON_VERSION_MICRO
)
17 PKG_SOURCE
:=Python-
$(PKG_VERSION
).
tar.xz
18 PKG_SOURCE_URL
:=https
://www.python.org
/ftp
/python
/$(PKG_VERSION
)
19 PKG_MD5SUM
:=57dffcee9cee8bb2ab5f82af1d8e9a69
22 PKG_LICENSE_FILES
:=LICENSE Modules
/_ctypes
/libffi_msvc
/LICENSE Modules
/_ctypes
/darwin
/LICENSE Modules
/_ctypes
/libffi
/LICENSE Modules
/_ctypes
/libffi_osx
/LICENSE Tools
/pybench
/LICENSE
24 # This file provides the necsessary host build variables
25 include .
/files
/python-host.mk
28 include .
/files
/python-package.mk
32 HOST_BUILD_PARALLEL
:=1
34 PKG_BUILD_DIR
:=$(BUILD_DIR
)/Python-
$(PKG_VERSION
)
35 HOST_BUILD_DIR
:=$(BUILD_DIR_HOST
)/Python-
$(PKG_VERSION
)
37 PKG_BUILD_DEPENDS
:=python
/host
38 HOST_BUILD_DEPENDS
:=bzip2
/host expat
/host libffi
/host
40 include $(INCLUDE_DIR
)/host-build.mk
41 include $(INCLUDE_DIR
)/package.mk
43 define Package
/python
/Default
47 TITLE
:=Python
$(PYTHON_VERSION
) programming language
48 URL
:=https
://www.python.org
/
49 MAINTAINER
:=Alexandru Ardelean
<ardeleanalex@gmail.com
>
52 define Package
/python
/Default
/description
53 Python is a dynamic object-oriented programming language that can be used
54 for many kinds of software development. It offers strong support for
55 integration with other languages and tools
, comes with extensive standard
56 libraries
, and can be learned in a few days. Many Python programmers
57 report substantial productivity gains and feel the language encourages
58 the development of higher quality
, more maintainable code.
61 define Package
/python-base
62 $(call Package
/python
/Default
)
63 TITLE
:=Python
$(PYTHON_VERSION
) interpreter
64 DEPENDS
:=+libpthread
+zlib
67 define Package
/python-base
/description
68 This package contains only the interpreter and the bare minimum
69 for the interpreter to start.
72 define Package
/python-light
73 $(call Package
/python
/Default
)
74 TITLE
:=Python
$(PYTHON_VERSION
) light installation
75 DEPENDS
:=+python-base
+libffi
+libbz2
78 define Package
/python-light
/description
79 This package is essentially the python-base package plus
80 a few of the rarely used
(and big
) libraries stripped out
81 into separate packages.
84 PYTHON_LIB_FILES_DEL
:=
86 PYTHON_PACKAGES_DEPENDS
:=
90 PYTHON_PACKAGES_DEPENDS
+=$(1)
92 PYTHON_LIB_FILES_DEL
+=$(2)
93 define PyPackage
/$(1)/filespec
94 $(subst $(space
),$(newline
),$(foreach lib_file
,$(2),+|
$(lib_file
)))
98 include .
/files
/python-package-
*.mk
100 define Package
/python
101 $(call Package
/python
/Default
)
102 DEPENDS
:=+python-light
$(foreach package
,$(PYTHON_PACKAGES_DEPENDS
),+$(package
))
105 define Package
/python
/description
106 This package contains the
(almost
) full Python
install.
107 It
's python-light + all other packages.
121 ifeq ($(CONFIG_IPV6),y)
122 ENABLE_IPV6 += --enable-ipv6
130 --with-system-ffi="$(STAGING_DIR)/usr" \
133 CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
134 OPT="$(TARGET_CFLAGS)"
137 $(call Build/Prepare/Default)
138 $(CP) ./files/config.site $(PKG_BUILD_DIR)/config.site
141 define Build/InstallDev
142 $(INSTALL_DIR) $(STAGING_DIR)/mk/
143 $(INSTALL_DIR) $(1)/usr/include/ $(1)/usr/lib/ $(1)/usr/lib/pkgconfig
144 $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
146 ./files/python-package.mk \
147 ./files/python-host.mk \
148 ./files/python-version.mk \
151 $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
154 $(HOST_PYTHON_LIB_DIR) \
155 $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \
158 $(HOST_PYTHON_DIR)/lib/pkgconfig/python.pc \
159 $(HOST_PYTHON_DIR)/lib/pkgconfig/python2.pc \
160 $(HOST_PYTHON_DIR)/lib/pkgconfig/python-$(PYTHON_VERSION).pc \
161 $(1)/usr/lib/pkgconfig
163 $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
164 $(1)/usr/lib/python$(PYTHON_VERSION)/
167 PYTHON_BASE_LIB_FILES:= \
168 /usr/lib/python$(PYTHON_VERSION)/_abcoll.py \
169 /usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py \
170 /usr/lib/python$(PYTHON_VERSION)/_weakrefset.py \
171 /usr/lib/python$(PYTHON_VERSION)/abc.py \
172 /usr/lib/python$(PYTHON_VERSION)/copy_reg.py \
173 /usr/lib/python$(PYTHON_VERSION)/genericpath.py \
174 /usr/lib/python$(PYTHON_VERSION)/linecache.py \
175 /usr/lib/python$(PYTHON_VERSION)/posixpath.py \
176 /usr/lib/python$(PYTHON_VERSION)/os.py \
177 /usr/lib/python$(PYTHON_VERSION)/re.py \
178 /usr/lib/python$(PYTHON_VERSION)/site.py \
179 /usr/lib/python$(PYTHON_VERSION)/sre_compile.py \
180 /usr/lib/python$(PYTHON_VERSION)/sre_constants.py \
181 /usr/lib/python$(PYTHON_VERSION)/sre_parse.py \
182 /usr/lib/python$(PYTHON_VERSION)/sysconfig.py \
183 /usr/lib/python$(PYTHON_VERSION)/stat.py \
184 /usr/lib/python$(PYTHON_VERSION)/traceback.py \
185 /usr/lib/python$(PYTHON_VERSION)/types.py \
186 /usr/lib/python$(PYTHON_VERSION)/UserDict.py \
187 /usr/lib/python$(PYTHON_VERSION)/warnings.py
189 PYTHON_LIB_FILES_DEL+=$(PYTHON_BASE_LIB_FILES)
191 define PyPackage/python-base/filespec
192 +|/usr/bin/python$(PYTHON_VERSION)
193 $(subst $(space),$(newline),$(foreach lib_file,$(PYTHON_BASE_LIB_FILES),+|$(lib_file)))
196 define PyPackage/python-light/filespec
197 +|/usr/lib/python$(PYTHON_VERSION)
198 -|/usr/lib/python$(PYTHON_VERSION)/distutils/cygwinccompiler.py
199 -|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst*
200 -|/usr/lib/python$(PYTHON_VERSION)/ensurepip
201 -|/usr/lib/python$(PYTHON_VERSION)/idlelib
202 -|/usr/lib/python$(PYTHON_VERSION)/lib-tk
203 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_testcapi.so
204 -|/usr/lib/python$(PYTHON_VERSION)/pdb.doc
205 -|/usr/lib/python$(PYTHON_VERSION)/test
206 -|/usr/lib/python$(PYTHON_VERSION)/webbrowser.py
207 -|/usr/lib/python$(PYTHON_VERSION)/*/test
208 -|/usr/lib/python$(PYTHON_VERSION)/*/tests
209 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/readline.so
210 $(subst $(space),$(newline),$(foreach lib_file,$(PYTHON_LIB_FILES_DEL),-|$(lib_file)))
213 define PyPackage/python-base/install
214 $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python
215 $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python2
216 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/
219 define PyPackage/python/filespec
223 HOST_CONFIGURE_ARGS+= \
227 --prefix=$(HOST_PYTHON_DIR) \
228 --exec-prefix=$(HOST_PYTHON_DIR) \
229 --with-system-expat=$(STAGING_DIR_HOSTPKG) \
230 --with-system-ffi=$(STAGING_DIR_HOSTPKG) \
232 CFLAGS="$(HOST_CFLAGS)"
235 $(MAKE) -C $(HOST_BUILD_DIR) install
236 $(INSTALL_DIR) $(HOST_PYTHON_DIR)/bin/
237 $(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(HOST_PYTHON_DIR)/bin/pgen2
240 $(eval $(call HostBuild))
242 $(foreach package, $(PYTHON_PACKAGES), \
243 $(eval $(call PyPackage,$(package))) \
244 $(eval $(call BuildPackage,$(package))) \
247 $(eval $(call PyPackage,python-base))
248 $(eval $(call PyPackage,python-light))
249 $(eval $(call PyPackage,python))
251 $(eval $(call BuildPackage,python-base))
252 $(eval $(call BuildPackage,python-light))
253 $(eval $(call BuildPackage,python))