暫無描述

Makefile 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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:=3
  13. PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
  14. PKG_SOURCE_URL:=http://www.python.org/ftp/python/$(PKG_VERSION)
  15. PKG_MD5SUM:=d235bdfa75b8396942e360a70487ee00
  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:=libffi/host 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/
  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. $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
  98. $(1)/usr/lib/python$(PYTHON_VERSION)/
  99. endef
  100. define PyPackage/python-base/filespec
  101. +|/usr/bin/python$(PYTHON_VERSION)
  102. +|/usr/lib/python$(PYTHON_VERSION)/_abcoll.py
  103. +|/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py
  104. +|/usr/lib/python$(PYTHON_VERSION)/_weakrefset.py
  105. +|/usr/lib/python$(PYTHON_VERSION)/abc.py
  106. +|/usr/lib/python$(PYTHON_VERSION)/copy_reg.py
  107. +|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
  108. +|/usr/lib/python$(PYTHON_VERSION)/linecache.py
  109. +|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
  110. +|/usr/lib/python$(PYTHON_VERSION)/os.py
  111. +|/usr/lib/python$(PYTHON_VERSION)/re.py
  112. +|/usr/lib/python$(PYTHON_VERSION)/site.py
  113. +|/usr/lib/python$(PYTHON_VERSION)/sre_compile.py
  114. +|/usr/lib/python$(PYTHON_VERSION)/sre_constants.py
  115. +|/usr/lib/python$(PYTHON_VERSION)/sre_parse.py
  116. +|/usr/lib/python$(PYTHON_VERSION)/sysconfig.py
  117. +|/usr/lib/python$(PYTHON_VERSION)/stat.py
  118. +|/usr/lib/python$(PYTHON_VERSION)/traceback.py
  119. +|/usr/lib/python$(PYTHON_VERSION)/types.py
  120. +|/usr/lib/python$(PYTHON_VERSION)/UserDict.py
  121. +|/usr/lib/python$(PYTHON_VERSION)/warnings.py
  122. endef
  123. define PyPackage/python/filespec
  124. +|/usr/lib/python$(PYTHON_VERSION)
  125. -|/usr/lib/python$(PYTHON_VERSION)/config
  126. -|/usr/lib/python$(PYTHON_VERSION)/distutils/cygwinccompiler.py
  127. -|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst*
  128. -|/usr/lib/python$(PYTHON_VERSION)/idlelib
  129. -|/usr/lib/python$(PYTHON_VERSION)/lib2to3
  130. -|/usr/lib/python$(PYTHON_VERSION)/lib-tk
  131. -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_testcapi.so
  132. -|/usr/lib/python$(PYTHON_VERSION)/pdb.doc
  133. -|/usr/lib/python$(PYTHON_VERSION)/test
  134. -|/usr/lib/python$(PYTHON_VERSION)/webbrowser.py
  135. -|/usr/lib/python$(PYTHON_VERSION)/*/test
  136. -|/usr/lib/python$(PYTHON_VERSION)/*/tests
  137. -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/readline.so
  138. -|/usr/lib/python$(PYTHON_VERSION)/_abcoll.py
  139. -|/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py
  140. -|/usr/lib/python$(PYTHON_VERSION)/_weakrefset.py
  141. -|/usr/lib/python$(PYTHON_VERSION)/abc.py
  142. -|/usr/lib/python$(PYTHON_VERSION)/copy_reg.py
  143. -|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
  144. -|/usr/lib/python$(PYTHON_VERSION)/linecache.py
  145. -|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
  146. -|/usr/lib/python$(PYTHON_VERSION)/os.py
  147. -|/usr/lib/python$(PYTHON_VERSION)/re.py
  148. -|/usr/lib/python$(PYTHON_VERSION)/site.py
  149. -|/usr/lib/python$(PYTHON_VERSION)/sre_compile.py
  150. -|/usr/lib/python$(PYTHON_VERSION)/sre_constants.py
  151. -|/usr/lib/python$(PYTHON_VERSION)/sre_parse.py
  152. -|/usr/lib/python$(PYTHON_VERSION)/sysconfig.py
  153. -|/usr/lib/python$(PYTHON_VERSION)/stat.py
  154. -|/usr/lib/python$(PYTHON_VERSION)/traceback.py
  155. -|/usr/lib/python$(PYTHON_VERSION)/types.py
  156. -|/usr/lib/python$(PYTHON_VERSION)/UserDict.py
  157. -|/usr/lib/python$(PYTHON_VERSION)/warnings.py
  158. endef
  159. define PyPackage/python-base/install
  160. $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python
  161. $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python2
  162. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/
  163. endef
  164. HOST_CONFIGURE_ARGS+= \
  165. --without-cxx-main \
  166. --without-pymalloc \
  167. --with-threads \
  168. --prefix=$(STAGING_DIR_HOST) \
  169. CONFIG_SITE= \
  170. OPT="$(HOST_CFLAGS)"
  171. define Host/Install
  172. $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/
  173. $(MAKE) -C $(HOST_BUILD_DIR) install
  174. $(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(STAGING_DIR_HOST)/bin/pgen2
  175. endef
  176. $(eval $(call HostBuild))
  177. $(eval $(call PyPackage,python-base))
  178. $(eval $(call PyPackage,python))
  179. $(eval $(call BuildPackage,python-base))
  180. $(eval $(call BuildPackage,python))