packages/lang/python/Makefile
Alexandru Ardelean 0ea587ad24 python: remove explicit rules in favor of using make/configure vars
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2014-11-07 15:37:17 +02:00

192 lines
5.7 KiB
Makefile

#
# Copyright (C) 2006-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
# The file included below defines PYTHON_VERSION
include ./files/python-package.mk
PKG_NAME:=python
PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
PKG_RELEASE:=3
PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://www.python.org/ftp/python/$(PKG_VERSION)
PKG_MD5SUM:=d235bdfa75b8396942e360a70487ee00
PKG_LICENSE:=PSF
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
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
HOST_BUILD_PARALLEL:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
PKG_BUILD_DEPENDS:=python/host
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
define Package/python/Default
SUBMENU:=Python
SECTION:=lang
CATEGORY:=Languages
TITLE:=Python $(PYTHON_VERSION) programming language
URL:=http://www.python.org/
MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
endef
define Package/python/Default/description
Python is a dynamic object-oriented programming language that can be used
for many kinds of software development. It offers strong support for
integration with other languages and tools, comes with extensive standard
libraries, and can be learned in a few days. Many Python programmers
report substantial productivity gains and feel the language encourages
the development of higher quality, more maintainable code.
endef
define Package/python
$(call Package/python/Default)
DEPENDS:=+libpthread +zlib +libffi +libopenssl +libcrypto
endef
define Package/python/description
This package contains only the interpreter and the bare minimum
for the interpreter to start.
endef
define Package/python-full
$(call Package/python/Default)
TITLE:=Full install (minus a few libs)
DEPENDS:=@PACKAGE_python +PACKAGE_python:python +libncursesw
endef
define Package/python-full/description
This package contains the (almost) full Python install.
endef
MAKE_FLAGS:=\
DESTDIR="$(PKG_INSTALL_DIR)" \
CROSS_COMPILE=yes \
LD="$(TARGET_CC)" \
PGEN=pgen2
EXTRA_CFLAGS+= \
-DNDEBUG -fno-inline
EXTRA_LDFLAGS+= \
-L$(PKG_BUILD_DIR)
ENABLE_IPV6:=
ifeq ($(CONFIG_IPV6),y)
ENABLE_IPV6 += --enable-ipv6
endif
CONFIGURE_ARGS+= \
--sysconfdir=/etc \
--enable-shared \
--without-cxx-main \
--with-threads \
--with-system-ffi="$(STAGING_DIR)/usr" \
--without-ensurepip \
--without-pymalloc \
$(ENABLE_IPV6) \
CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
OPT="$(TARGET_CFLAGS)"
define Hooks/Configure/Pre/ConfigSiteInstall
$(CP) ./files/config.site $(PKG_BUILD_DIR)/config.site
endef
Hooks/Configure/Pre+=\
Hooks/Configure/Pre/ConfigSiteInstall
define Build/InstallDev
$(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
$(INSTALL_DIR) $(STAGING_DIR)/mk/
$(INSTALL_DATA) ./files/python-package.mk $(STAGING_DIR)/mk/
$(CP) \
$(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
$(1)/usr/include/
$(CP) \
$(STAGING_DIR_HOST)/lib/python$(PYTHON_VERSION) \
$(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \
$(1)/usr/lib/
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
$(1)/usr/lib/python$(PYTHON_VERSION)/
$(CP) \
$(STAGING_DIR_HOST)/bin/python$(PYTHON_VERSION)-config \
$(2)/bin/
$(SED) 's,^#!.*,#!/usr/bin/env python$(PYTHON_VERSION),g' $(2)/bin/python$(PYTHON_VERSION)-config
endef
define PyPackage/python/filespec
+|/usr/bin/python$(PYTHON_VERSION)
+|/usr/lib/python$(PYTHON_VERSION)/_abcoll.py
+|/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py
+|/usr/lib/python$(PYTHON_VERSION)/_weakrefset.py
+|/usr/lib/python$(PYTHON_VERSION)/abc.py
+|/usr/lib/python$(PYTHON_VERSION)/copy_reg.py
+|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
+|/usr/lib/python$(PYTHON_VERSION)/linecache.py
+|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
+|/usr/lib/python$(PYTHON_VERSION)/os.py
+|/usr/lib/python$(PYTHON_VERSION)/re.py
+|/usr/lib/python$(PYTHON_VERSION)/site.py
+|/usr/lib/python$(PYTHON_VERSION)/sre_compile.py
+|/usr/lib/python$(PYTHON_VERSION)/sre_constants.py
+|/usr/lib/python$(PYTHON_VERSION)/sre_parse.py
+|/usr/lib/python$(PYTHON_VERSION)/sysconfig.py
+|/usr/lib/python$(PYTHON_VERSION)/stat.py
+|/usr/lib/python$(PYTHON_VERSION)/traceback.py
+|/usr/lib/python$(PYTHON_VERSION)/types.py
+|/usr/lib/python$(PYTHON_VERSION)/UserDict.py
+|/usr/lib/python$(PYTHON_VERSION)/warnings.py
endef
define PyPackage/python-full/filespec
+|/usr/lib/python$(PYTHON_VERSION)
-|/usr/lib/python$(PYTHON_VERSION)/config
-|/usr/lib/python$(PYTHON_VERSION)/distutils
-|/usr/lib/python$(PYTHON_VERSION)/idlelib
-|/usr/lib/python$(PYTHON_VERSION)/lib2to3
-|/usr/lib/python$(PYTHON_VERSION)/lib-tk
-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_testcapi.so
-|/usr/lib/python$(PYTHON_VERSION)/test
-|/usr/lib/python$(PYTHON_VERSION)/*/test
-|/usr/lib/python$(PYTHON_VERSION)/*/tests
endef
define PyPackage/python/install
$(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python
$(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python2
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/
endef
HOST_CONFIGURE_ARGS+= \
--without-cxx-main \
--without-ensurepip \
--without-pymalloc \
--with-threads \
--prefix=$(STAGING_DIR_HOST)
define Host/Install
$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/
$(MAKE) -C $(HOST_BUILD_DIR) install
$(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(STAGING_DIR_HOST)/bin/pgen2
endef
$(eval $(call HostBuild))
$(eval $(call PyPackage,python))
$(eval $(call PyPackage,python-full))
$(eval $(call BuildPackage,python))
$(eval $(call BuildPackage,python-full))