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.

191 lines
5.8 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:=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 Hooks/Configure/Pre/ConfigSiteInstall
  81. $(CP) ./files/config.site $(PKG_BUILD_DIR)/config.site
  82. endef
  83. Hooks/Configure/Pre+=\
  84. Hooks/Configure/Pre/ConfigSiteInstall
  85. define Build/InstallDev
  86. $(INSTALL_DIR) $(STAGING_DIR)/mk/
  87. $(INSTALL_DIR) $(1)/usr/include/ $(1)/usr/lib/
  88. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
  89. $(INSTALL_DATA) ./files/python-package.mk $(STAGING_DIR)/mk/
  90. $(CP) \
  91. $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
  92. $(1)/usr/include/
  93. $(CP) \
  94. $(STAGING_DIR_HOST)/lib/python$(PYTHON_VERSION) \
  95. $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \
  96. $(1)/usr/lib/
  97. $(CP) \
  98. $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
  99. $(1)/usr/lib/python$(PYTHON_VERSION)/
  100. endef
  101. define PyPackage/python-base/filespec
  102. +|/usr/bin/python$(PYTHON_VERSION)
  103. +|/usr/lib/python$(PYTHON_VERSION)/_abcoll.py
  104. +|/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py
  105. +|/usr/lib/python$(PYTHON_VERSION)/_weakrefset.py
  106. +|/usr/lib/python$(PYTHON_VERSION)/abc.py
  107. +|/usr/lib/python$(PYTHON_VERSION)/copy_reg.py
  108. +|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
  109. +|/usr/lib/python$(PYTHON_VERSION)/linecache.py
  110. +|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
  111. +|/usr/lib/python$(PYTHON_VERSION)/os.py
  112. +|/usr/lib/python$(PYTHON_VERSION)/re.py
  113. +|/usr/lib/python$(PYTHON_VERSION)/site.py
  114. +|/usr/lib/python$(PYTHON_VERSION)/sre_compile.py
  115. +|/usr/lib/python$(PYTHON_VERSION)/sre_constants.py
  116. +|/usr/lib/python$(PYTHON_VERSION)/sre_parse.py
  117. +|/usr/lib/python$(PYTHON_VERSION)/sysconfig.py
  118. +|/usr/lib/python$(PYTHON_VERSION)/stat.py
  119. +|/usr/lib/python$(PYTHON_VERSION)/traceback.py
  120. +|/usr/lib/python$(PYTHON_VERSION)/types.py
  121. +|/usr/lib/python$(PYTHON_VERSION)/UserDict.py
  122. +|/usr/lib/python$(PYTHON_VERSION)/warnings.py
  123. endef
  124. define PyPackage/python/filespec
  125. +|/usr/lib/python$(PYTHON_VERSION)
  126. -|/usr/lib/python$(PYTHON_VERSION)/config
  127. -|/usr/lib/python$(PYTHON_VERSION)/distutils/cygwinccompiler.py
  128. -|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst*
  129. -|/usr/lib/python$(PYTHON_VERSION)/idlelib
  130. -|/usr/lib/python$(PYTHON_VERSION)/lib2to3
  131. -|/usr/lib/python$(PYTHON_VERSION)/lib-tk
  132. -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_testcapi.so
  133. -|/usr/lib/python$(PYTHON_VERSION)/pdb.doc
  134. -|/usr/lib/python$(PYTHON_VERSION)/test
  135. -|/usr/lib/python$(PYTHON_VERSION)/webbrowser.py
  136. -|/usr/lib/python$(PYTHON_VERSION)/*/test
  137. -|/usr/lib/python$(PYTHON_VERSION)/*/tests
  138. -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/readline.so
  139. endef
  140. define PyPackage/python-base/install
  141. $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python
  142. $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python2
  143. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/
  144. endef
  145. HOST_CONFIGURE_ARGS+= \
  146. --without-cxx-main \
  147. --without-pymalloc \
  148. --with-threads \
  149. --prefix=$(STAGING_DIR_HOST) \
  150. CONFIG_SITE= \
  151. OPT="$(HOST_CFLAGS)"
  152. define Host/Install
  153. $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/
  154. $(MAKE) -C $(HOST_BUILD_DIR) install
  155. $(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(STAGING_DIR_HOST)/bin/pgen2
  156. endef
  157. $(eval $(call HostBuild))
  158. $(eval $(call PyPackage,python-base))
  159. $(eval $(call PyPackage,python))
  160. $(eval $(call BuildPackage,python-base))
  161. $(eval $(call BuildPackage,python))