You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

220 lines
7.0 KiB

  1. #
  2. # Copyright (C) 2006-2014 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. # The file included below defines PYTHON_VERSION
  9. include ./files/python-package.mk
  10. PKG_NAME:=python
  11. PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
  12. PKG_RELEASE:=4
  13. PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
  14. PKG_SOURCE_URL:=http://www.python.org/ftp/python/$(PKG_VERSION)
  15. PKG_MD5SUM:=38d530f7efc373d64a8fb1637e3baaa7
  16. PKG_LICENSE:=PSF
  17. 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
  18. PKG_INSTALL:=1
  19. PKG_BUILD_PARALLEL:=1
  20. HOST_BUILD_PARALLEL:=1
  21. PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
  22. HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
  23. PKG_BUILD_DEPENDS:=python/host
  24. include $(INCLUDE_DIR)/host-build.mk
  25. include $(INCLUDE_DIR)/package.mk
  26. define Package/python/Default
  27. SUBMENU:=Python
  28. SECTION:=lang
  29. CATEGORY:=Languages
  30. TITLE:=Python $(PYTHON_VERSION) programming language
  31. URL:=http://www.python.org/
  32. MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
  33. endef
  34. define Package/python/Default/description
  35. Python is a dynamic object-oriented programming language that can be used
  36. for many kinds of software development. It offers strong support for
  37. integration with other languages and tools, comes with extensive standard
  38. libraries, and can be learned in a few days. Many Python programmers
  39. report substantial productivity gains and feel the language encourages
  40. the development of higher quality, more maintainable code.
  41. endef
  42. define Package/python-base
  43. $(call Package/python/Default)
  44. TITLE:=Python $(PYTHON_VERSION) interpreter
  45. DEPENDS:=+libpthread +zlib +libffi +libopenssl
  46. endef
  47. define Package/python-base/description
  48. This package contains only the interpreter and the bare minimum
  49. for the interpreter to start.
  50. endef
  51. define Package/python
  52. $(call Package/python/Default)
  53. DEPENDS:=+python-base +libncursesw +libbz2 +libgdbm +libsqlite3 +libexpat +libdb47
  54. endef
  55. define Package/python/description
  56. This package contains the (almost) full Python install.
  57. endef
  58. MAKE_FLAGS+=\
  59. CROSS_COMPILE=yes \
  60. LD="$(TARGET_CC)" \
  61. PGEN=pgen2
  62. EXTRA_CFLAGS+= \
  63. -DNDEBUG -fno-inline
  64. EXTRA_LDFLAGS+= \
  65. -L$(PKG_BUILD_DIR)
  66. ENABLE_IPV6:=
  67. ifeq ($(CONFIG_IPV6),y)
  68. ENABLE_IPV6 += --enable-ipv6
  69. endif
  70. CONFIGURE_ARGS+= \
  71. --sysconfdir=/etc \
  72. --enable-shared \
  73. --without-cxx-main \
  74. --with-threads \
  75. --with-system-ffi="$(STAGING_DIR)/usr" \
  76. --without-pymalloc \
  77. $(ENABLE_IPV6) \
  78. CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
  79. OPT="$(TARGET_CFLAGS)"
  80. define Build/Prepare
  81. $(call Build/Prepare/Default)
  82. $(CP) ./files/config.site $(PKG_BUILD_DIR)/config.site
  83. endef
  84. define Build/InstallDev
  85. $(INSTALL_DIR) $(STAGING_DIR)/mk/
  86. $(INSTALL_DIR) $(1)/usr/include/ $(1)/usr/lib/ $(1)/usr/lib/pkgconfig
  87. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
  88. $(INSTALL_DATA) ./files/python-package.mk $(STAGING_DIR)/mk/
  89. $(CP) \
  90. $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
  91. $(1)/usr/include/
  92. $(CP) \
  93. $(STAGING_DIR_HOST)/lib/python$(PYTHON_VERSION) \
  94. $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \
  95. $(1)/usr/lib/
  96. $(CP) \
  97. $(STAGING_DIR_HOST)/lib/pkgconfig/python.pc \
  98. $(STAGING_DIR_HOST)/lib/pkgconfig/python2.pc \
  99. $(STAGING_DIR_HOST)/lib/pkgconfig/python-$(PYTHON_VERSION).pc \
  100. $(1)/usr/lib/pkgconfig
  101. $(CP) \
  102. $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
  103. $(1)/usr/lib/python$(PYTHON_VERSION)/
  104. endef
  105. define PyPackage/python-base/filespec
  106. +|/usr/bin/python$(PYTHON_VERSION)
  107. +|/usr/lib/python$(PYTHON_VERSION)/_abcoll.py
  108. +|/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py
  109. +|/usr/lib/python$(PYTHON_VERSION)/_weakrefset.py
  110. +|/usr/lib/python$(PYTHON_VERSION)/abc.py
  111. +|/usr/lib/python$(PYTHON_VERSION)/copy_reg.py
  112. +|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
  113. +|/usr/lib/python$(PYTHON_VERSION)/linecache.py
  114. +|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
  115. +|/usr/lib/python$(PYTHON_VERSION)/os.py
  116. +|/usr/lib/python$(PYTHON_VERSION)/re.py
  117. +|/usr/lib/python$(PYTHON_VERSION)/site.py
  118. +|/usr/lib/python$(PYTHON_VERSION)/sre_compile.py
  119. +|/usr/lib/python$(PYTHON_VERSION)/sre_constants.py
  120. +|/usr/lib/python$(PYTHON_VERSION)/sre_parse.py
  121. +|/usr/lib/python$(PYTHON_VERSION)/sysconfig.py
  122. +|/usr/lib/python$(PYTHON_VERSION)/stat.py
  123. +|/usr/lib/python$(PYTHON_VERSION)/traceback.py
  124. +|/usr/lib/python$(PYTHON_VERSION)/types.py
  125. +|/usr/lib/python$(PYTHON_VERSION)/UserDict.py
  126. +|/usr/lib/python$(PYTHON_VERSION)/warnings.py
  127. endef
  128. define PyPackage/python/filespec
  129. +|/usr/lib/python$(PYTHON_VERSION)
  130. -|/usr/lib/python$(PYTHON_VERSION)/config
  131. -|/usr/lib/python$(PYTHON_VERSION)/distutils/cygwinccompiler.py
  132. -|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst*
  133. -|/usr/lib/python$(PYTHON_VERSION)/ensurepip
  134. -|/usr/lib/python$(PYTHON_VERSION)/idlelib
  135. -|/usr/lib/python$(PYTHON_VERSION)/lib2to3
  136. -|/usr/lib/python$(PYTHON_VERSION)/lib-tk
  137. -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_testcapi.so
  138. -|/usr/lib/python$(PYTHON_VERSION)/pdb.doc
  139. -|/usr/lib/python$(PYTHON_VERSION)/test
  140. -|/usr/lib/python$(PYTHON_VERSION)/webbrowser.py
  141. -|/usr/lib/python$(PYTHON_VERSION)/*/test
  142. -|/usr/lib/python$(PYTHON_VERSION)/*/tests
  143. -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/readline.so
  144. -|/usr/lib/python$(PYTHON_VERSION)/_abcoll.py
  145. -|/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py
  146. -|/usr/lib/python$(PYTHON_VERSION)/_weakrefset.py
  147. -|/usr/lib/python$(PYTHON_VERSION)/abc.py
  148. -|/usr/lib/python$(PYTHON_VERSION)/copy_reg.py
  149. -|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
  150. -|/usr/lib/python$(PYTHON_VERSION)/linecache.py
  151. -|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
  152. -|/usr/lib/python$(PYTHON_VERSION)/os.py
  153. -|/usr/lib/python$(PYTHON_VERSION)/re.py
  154. -|/usr/lib/python$(PYTHON_VERSION)/site.py
  155. -|/usr/lib/python$(PYTHON_VERSION)/sre_compile.py
  156. -|/usr/lib/python$(PYTHON_VERSION)/sre_constants.py
  157. -|/usr/lib/python$(PYTHON_VERSION)/sre_parse.py
  158. -|/usr/lib/python$(PYTHON_VERSION)/sysconfig.py
  159. -|/usr/lib/python$(PYTHON_VERSION)/stat.py
  160. -|/usr/lib/python$(PYTHON_VERSION)/traceback.py
  161. -|/usr/lib/python$(PYTHON_VERSION)/types.py
  162. -|/usr/lib/python$(PYTHON_VERSION)/UserDict.py
  163. -|/usr/lib/python$(PYTHON_VERSION)/warnings.py
  164. endef
  165. define PyPackage/python-base/install
  166. $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python
  167. $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python2
  168. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/
  169. endef
  170. HOST_CFLAGS+= \
  171. -I/usr/include/ncursesw \
  172. -I/usr/include/ncurses
  173. HOST_CONFIGURE_ARGS+= \
  174. --without-cxx-main \
  175. --without-pymalloc \
  176. --with-threads \
  177. --prefix=$(STAGING_DIR_HOST) \
  178. --with-ensurepip=upgrade \
  179. CONFIG_SITE= \
  180. CFLAGS="$(HOST_CFLAGS)"
  181. define Host/Install
  182. $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/
  183. $(MAKE) -C $(HOST_BUILD_DIR) install
  184. $(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(STAGING_DIR_HOST)/bin/pgen2
  185. endef
  186. $(eval $(call HostBuild))
  187. $(eval $(call PyPackage,python-base))
  188. $(eval $(call PyPackage,python))
  189. $(eval $(call BuildPackage,python-base))
  190. $(eval $(call BuildPackage,python))