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
:=53b43534153bb2a0363f08bae8b9d990
20 PKG_HASH
:=35d543986882f78261f97787fd3e06274bfa6df29fac9b4a94f73930ff98f731
23 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
25 # This file provides the necsessary host build variables
26 include .
/files
/python-host.mk
29 include .
/files
/python-package.mk
33 HOST_BUILD_PARALLEL
:=1
35 PKG_BUILD_DIR
:=$(BUILD_DIR
)/Python-
$(PKG_VERSION
)
36 HOST_BUILD_DIR
:=$(BUILD_DIR_HOST
)/Python-
$(PKG_VERSION
)
38 PKG_BUILD_DEPENDS
:=python
/host
39 HOST_BUILD_DEPENDS
:=bzip2
/host expat
/host libffi
/host
41 include $(INCLUDE_DIR
)/host-build.mk
42 include $(INCLUDE_DIR
)/package.mk
44 define Package
/python
/Default
48 TITLE
:=Python
$(PYTHON_VERSION
) programming language
49 URL
:=https
://www.python.org
/
50 MAINTAINER
:=Alexandru Ardelean
<ardeleanalex@gmail.com
>
53 define Package
/python
/Default
/description
54 Python is a dynamic object-oriented programming language that can be used
55 for many kinds of software development. It offers strong support for
56 integration with other languages and tools
, comes with extensive standard
57 libraries
, and can be learned in a few days. Many Python programmers
58 report substantial productivity gains and feel the language encourages
59 the development of higher quality
, more maintainable code.
62 define Package
/python-base
63 $(call Package
/python
/Default
)
64 TITLE
:=Python
$(PYTHON_VERSION
) interpreter
65 DEPENDS
:=+libpthread
+zlib
68 define Package
/python-base
/description
69 This package contains only the interpreter and the bare minimum
70 for the interpreter to start.
73 define Package
/python-light
74 $(call Package
/python
/Default
)
75 TITLE
:=Python
$(PYTHON_VERSION
) light installation
76 DEPENDS
:=+python-base
+libffi
+libbz2
79 define Package
/python-light
/description
80 This package is essentially the python-base package plus
81 a few of the rarely used
(and big
) libraries stripped out
82 into separate packages.
85 PYTHON_LIB_FILES_DEL
:=
87 PYTHON_PACKAGES_DEPENDS
:=
91 PYTHON_PACKAGES_DEPENDS
+=$(1)
93 PYTHON_LIB_FILES_DEL
+=$(2)
94 define PyPackage
/$(1)/filespec
95 $(subst $(space
),$(newline
),$(foreach lib_file
,$(2),+|
$(lib_file
)))
99 include .
/files
/python-package-
*.mk
101 define Package
/python
102 $(call Package
/python
/Default
)
103 DEPENDS
:=+python-light
$(foreach package
,$(PYTHON_PACKAGES_DEPENDS
),+$(package
))
106 define Package
/python
/description
107 This package contains the
(almost
) full Python
install.
108 It
's python-light + all other packages.
122 ifeq ($(CONFIG_IPV6),y)
123 ENABLE_IPV6 += --enable-ipv6
127 _PYTHON_PROJECT_BASE=$(PKG_BUILD_DIR) \
128 _PYTHON_HOST_PLATFORM=linux2 \
129 PYTHONPATH="$(PKG_BUILD_DIR)/Lib:$(PKG_BUILD_DIR)/build/lib.linux2-$(PYTHON_VERSION)" \
130 _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata \
140 PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)" \
142 CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
143 OPT="$(TARGET_CFLAGS)"
146 $(call Build/Prepare/Default)
147 $(CP) ./files/config.site $(PKG_BUILD_DIR)/config.site
150 define Build/InstallDev
151 $(INSTALL_DIR) $(STAGING_DIR)/mk/
152 $(INSTALL_DIR) $(1)/usr/include/ $(1)/usr/lib/ $(1)/usr/lib/pkgconfig
153 $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
155 ./files/python-package.mk \
156 ./files/python-host.mk \
157 ./files/python-version.mk \
160 $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
163 $(HOST_PYTHON_LIB_DIR) \
164 $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \
167 $(HOST_PYTHON_DIR)/lib/pkgconfig/python.pc \
168 $(HOST_PYTHON_DIR)/lib/pkgconfig/python2.pc \
169 $(HOST_PYTHON_DIR)/lib/pkgconfig/python-$(PYTHON_VERSION).pc \
170 $(1)/usr/lib/pkgconfig
172 $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
173 $(1)/usr/lib/python$(PYTHON_VERSION)/
176 PYTHON_BASE_LIB_FILES:= \
177 /usr/lib/python$(PYTHON_VERSION)/_abcoll.py \
178 /usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py \
179 /usr/lib/python$(PYTHON_VERSION)/_weakrefset.py \
180 /usr/lib/python$(PYTHON_VERSION)/abc.py \
181 /usr/lib/python$(PYTHON_VERSION)/copy_reg.py \
182 /usr/lib/python$(PYTHON_VERSION)/genericpath.py \
183 /usr/lib/python$(PYTHON_VERSION)/linecache.py \
184 /usr/lib/python$(PYTHON_VERSION)/posixpath.py \
185 /usr/lib/python$(PYTHON_VERSION)/os.py \
186 /usr/lib/python$(PYTHON_VERSION)/re.py \
187 /usr/lib/python$(PYTHON_VERSION)/site.py \
188 /usr/lib/python$(PYTHON_VERSION)/sre_compile.py \
189 /usr/lib/python$(PYTHON_VERSION)/sre_constants.py \
190 /usr/lib/python$(PYTHON_VERSION)/sre_parse.py \
191 /usr/lib/python$(PYTHON_VERSION)/sysconfig.py \
192 /usr/lib/python$(PYTHON_VERSION)/stat.py \
193 /usr/lib/python$(PYTHON_VERSION)/traceback.py \
194 /usr/lib/python$(PYTHON_VERSION)/types.py \
195 /usr/lib/python$(PYTHON_VERSION)/UserDict.py \
196 /usr/lib/python$(PYTHON_VERSION)/warnings.py
198 PYTHON_LIB_FILES_DEL+=$(PYTHON_BASE_LIB_FILES)
200 define PyPackage/python-base/filespec
201 +|/usr/bin/python$(PYTHON_VERSION)
202 $(subst $(space),$(newline),$(foreach lib_file,$(PYTHON_BASE_LIB_FILES),+|$(lib_file)))
205 define PyPackage/python-light/filespec
206 +|/usr/lib/python$(PYTHON_VERSION)
207 -|/usr/lib/python$(PYTHON_VERSION)/distutils/cygwinccompiler.py
208 -|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst*
209 -|/usr/lib/python$(PYTHON_VERSION)/ensurepip
210 -|/usr/lib/python$(PYTHON_VERSION)/idlelib
211 -|/usr/lib/python$(PYTHON_VERSION)/lib-tk
212 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_testcapi.so
213 -|/usr/lib/python$(PYTHON_VERSION)/pdb.doc
214 -|/usr/lib/python$(PYTHON_VERSION)/test
215 -|/usr/lib/python$(PYTHON_VERSION)/webbrowser.py
216 -|/usr/lib/python$(PYTHON_VERSION)/*/test
217 -|/usr/lib/python$(PYTHON_VERSION)/*/tests
218 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/readline.so
219 $(subst $(space),$(newline),$(foreach lib_file,$(PYTHON_LIB_FILES_DEL),-|$(lib_file)))
222 define PyPackage/python-base/install
223 $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python
224 $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python2
225 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/
228 define PyPackage/python/filespec
232 HOST_CONFIGURE_ARGS+= \
236 --prefix=$(HOST_PYTHON_DIR) \
237 --exec-prefix=$(HOST_PYTHON_DIR) \
238 --with-system-expat=$(STAGING_DIR_HOSTPKG) \
241 CFLAGS="$(HOST_CFLAGS)"
244 $(MAKE) -C $(HOST_BUILD_DIR) install
245 $(INSTALL_DIR) $(HOST_PYTHON_DIR)/bin/
246 $(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(HOST_PYTHON_DIR)/bin/pgen2
249 $(eval $(call HostBuild))
251 $(foreach package, $(PYTHON_PACKAGES), \
252 $(eval $(call PyPackage,$(package))) \
253 $(eval $(call BuildPackage,$(package))) \
256 $(eval $(call PyPackage,python-base))
257 $(eval $(call PyPackage,python-light))
258 $(eval $(call PyPackage,python))
260 $(eval $(call BuildPackage,python-base))
261 $(eval $(call BuildPackage,python-light))
262 $(eval $(call BuildPackage,python))