2 # Copyright (C) 2006-2015 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
10 # The file included below defines PYTHON_VERSION
11 include .
/files
/python-package.mk
14 PKG_VERSION
:=$(PYTHON_VERSION
).
$(PYTHON_VERSION_MICRO
)
17 PKG_SOURCE
:=Python-
$(PKG_VERSION
).
tar.xz
18 PKG_SOURCE_URL
:=http
://www.python.org
/ftp
/python
/$(PKG_VERSION
)
19 PKG_MD5SUM
:=c685ef0b8e9f27b5e3db5db12b268ac6
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
26 HOST_BUILD_PARALLEL
:=1
28 PKG_BUILD_DIR
:=$(BUILD_DIR
)/Python-
$(PKG_VERSION
)
29 HOST_BUILD_DIR
:=$(BUILD_DIR_HOST
)/Python-
$(PKG_VERSION
)
31 PKG_BUILD_DEPENDS
:=python
/host
32 HOST_BUILD_DEPENDS
:=bzip2
/host expat
/host
34 include $(INCLUDE_DIR
)/host-build.mk
35 include $(INCLUDE_DIR
)/package.mk
37 define Package
/python
/Default
41 TITLE
:=Python
$(PYTHON_VERSION
) programming language
42 URL
:=http
://www.python.org
/
43 MAINTAINER
:=Alexandru Ardelean
<ardeleanalex@gmail.com
>
46 define Package
/python
/Default
/description
47 Python is a dynamic object-oriented programming language that can be used
48 for many kinds of software development. It offers strong support for
49 integration with other languages and tools
, comes with extensive standard
50 libraries
, and can be learned in a few days. Many Python programmers
51 report substantial productivity gains and feel the language encourages
52 the development of higher quality
, more maintainable code.
55 define Package
/python-base
56 $(call Package
/python
/Default
)
57 TITLE
:=Python
$(PYTHON_VERSION
) interpreter
58 DEPENDS
:=+libpthread
+zlib
61 define Package
/python-base
/description
62 This package contains only the interpreter and the bare minimum
63 for the interpreter to start.
66 define Package
/python-light
67 $(call Package
/python
/Default
)
68 TITLE
:=Python
$(PYTHON_VERSION
) light installation
69 DEPENDS
:=+python-base
+libffi
+libbz2
72 define Package
/python-light
/description
73 This package is essentially the python-base package plus
74 a few of the rarely used
(and big
) libraries stripped out
75 into separate packages.
78 PYTHON_LIB_FILES_DEL
:=
82 PYTHON_LIB_FILES_DEL
+=$(2)
83 define PyPackage
/$(1)/filespec
84 $(subst $(space
),$(newline
),$(foreach lib_file
,$(2),+|
$(lib_file
)))
88 include .
/files
/python-package-
*.mk
91 $(call Package
/python
/Default
)
92 DEPENDS
:=+python-light
$(foreach package
,$(PYTHON_PACKAGES
),+$(package
))
95 define Package
/python
/description
96 This package contains the
(almost
) full Python
install.
97 It
's python-light + all other packages.
111 ifeq ($(CONFIG_IPV6),y)
112 ENABLE_IPV6 += --enable-ipv6
120 --with-system-ffi="$(STAGING_DIR)/usr" \
123 CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
124 OPT="$(TARGET_CFLAGS)"
127 $(call Build/Prepare/Default)
128 $(CP) ./files/config.site $(PKG_BUILD_DIR)/config.site
131 define Build/InstallDev
132 $(INSTALL_DIR) $(STAGING_DIR)/mk/
133 $(INSTALL_DIR) $(1)/usr/include/ $(1)/usr/lib/ $(1)/usr/lib/pkgconfig
134 $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
136 ./files/python-package.mk \
137 ./files/python-host.mk \
140 $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
143 $(STAGING_DIR_HOST)/usr/lib/python$(PYTHON_VERSION) \
144 $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \
147 $(STAGING_DIR_HOST)/usr/lib/pkgconfig/python.pc \
148 $(STAGING_DIR_HOST)/usr/lib/pkgconfig/python2.pc \
149 $(STAGING_DIR_HOST)/usr/lib/pkgconfig/python-$(PYTHON_VERSION).pc \
150 $(1)/usr/lib/pkgconfig
152 $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
153 $(1)/usr/lib/python$(PYTHON_VERSION)/
156 PYTHON_BASE_LIB_FILES:= \
157 /usr/lib/python$(PYTHON_VERSION)/_abcoll.py \
158 /usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py \
159 /usr/lib/python$(PYTHON_VERSION)/_weakrefset.py \
160 /usr/lib/python$(PYTHON_VERSION)/abc.py \
161 /usr/lib/python$(PYTHON_VERSION)/copy_reg.py \
162 /usr/lib/python$(PYTHON_VERSION)/genericpath.py \
163 /usr/lib/python$(PYTHON_VERSION)/linecache.py \
164 /usr/lib/python$(PYTHON_VERSION)/posixpath.py \
165 /usr/lib/python$(PYTHON_VERSION)/os.py \
166 /usr/lib/python$(PYTHON_VERSION)/re.py \
167 /usr/lib/python$(PYTHON_VERSION)/site.py \
168 /usr/lib/python$(PYTHON_VERSION)/sre_compile.py \
169 /usr/lib/python$(PYTHON_VERSION)/sre_constants.py \
170 /usr/lib/python$(PYTHON_VERSION)/sre_parse.py \
171 /usr/lib/python$(PYTHON_VERSION)/sysconfig.py \
172 /usr/lib/python$(PYTHON_VERSION)/stat.py \
173 /usr/lib/python$(PYTHON_VERSION)/traceback.py \
174 /usr/lib/python$(PYTHON_VERSION)/types.py \
175 /usr/lib/python$(PYTHON_VERSION)/UserDict.py \
176 /usr/lib/python$(PYTHON_VERSION)/warnings.py
178 PYTHON_LIB_FILES_DEL+=$(PYTHON_BASE_LIB_FILES)
180 define PyPackage/python-base/filespec
181 +|/usr/bin/python$(PYTHON_VERSION)
182 $(subst $(space),$(newline),$(foreach lib_file,$(PYTHON_BASE_LIB_FILES),+|$(lib_file)))
185 define PyPackage/python-light/filespec
186 +|/usr/lib/python$(PYTHON_VERSION)
187 -|/usr/lib/python$(PYTHON_VERSION)/config
188 -|/usr/lib/python$(PYTHON_VERSION)/distutils/cygwinccompiler.py
189 -|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst*
190 -|/usr/lib/python$(PYTHON_VERSION)/ensurepip
191 -|/usr/lib/python$(PYTHON_VERSION)/idlelib
192 -|/usr/lib/python$(PYTHON_VERSION)/lib2to3
193 -|/usr/lib/python$(PYTHON_VERSION)/lib-tk
194 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_testcapi.so
195 -|/usr/lib/python$(PYTHON_VERSION)/pdb.doc
196 -|/usr/lib/python$(PYTHON_VERSION)/test
197 -|/usr/lib/python$(PYTHON_VERSION)/webbrowser.py
198 -|/usr/lib/python$(PYTHON_VERSION)/*/test
199 -|/usr/lib/python$(PYTHON_VERSION)/*/tests
200 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/readline.so
201 $(subst $(space),$(newline),$(foreach lib_file,$(PYTHON_LIB_FILES_DEL),-|$(lib_file)))
204 define PyPackage/python-base/install
205 $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python
206 $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python2
207 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/
210 define PyPackage/python/filespec
215 -I/usr/include/ncursesw \
216 -I/usr/include/ncurses
218 HOST_CONFIGURE_ARGS+= \
222 --prefix=$(STAGING_DIR_HOST)/usr \
223 --with-system-expat=$(STAGING_DIR_HOST) \
224 --with-ensurepip=upgrade \
226 CFLAGS="$(HOST_CFLAGS)"
229 $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/
230 $(MAKE) -C $(HOST_BUILD_DIR) install
231 $(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(STAGING_DIR_HOST)/bin/pgen2
234 $(eval $(call HostBuild))
236 $(foreach package, $(PYTHON_PACKAGES), \
237 $(eval $(call PyPackage,$(package))) \
238 $(eval $(call BuildPackage,$(package))) \
241 $(eval $(call PyPackage,python-base))
242 $(eval $(call PyPackage,python-light))
243 $(eval $(call PyPackage,python))
245 $(eval $(call BuildPackage,python-base))
246 $(eval $(call BuildPackage,python-light))
247 $(eval $(call BuildPackage,python))