[packages] python: add a minimal python-mini package, remove readline support since...
[openwrt/svn-archive/archive.git] / lang / python / python-package.mk
1 #
2 # Copyright (C) 2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 ifeq ($(DUMP),)
10
11 PYTHON_VERSION=2.5
12
13 PYTHON_DIR:=$(STAGING_DIR)/usr
14 PYTHON_BIN_DIR:=$(PYTHON_DIR)/bin
15 PYTHON_INC_DIR:=$(PYTHON_DIR)/include/python$(PYTHON_VERSION)
16 PYTHON_LIB_DIR:=$(PYTHON_DIR)/lib/python$(PYTHON_VERSION)
17
18 PYTHON:=$(PYTHON_BIN_DIR)/python
19
20 PYTHON_PKG_DIR:=/usr/lib/python$(PYTHON_VERSION)/site-packages
21
22 endif
23
24 define PyPackage
25 NAME:=$(1)
26 $(eval $(call PyPackage/$(1)))
27
28 define Package/$(1)
29 SUBMENU:=Python
30 TITLE:=$(TITLE)
31 SECTION:=lang
32 CATEGORY:=Languages
33 DEPENDS:=python-core
34 $(call PyPackage/$(1))
35 endef
36
37 ifdef PyPackage/$(1)/description
38 define Package/$(1)/description
39 $(call PyPackage/$(1)/description)
40 endef
41 endif
42
43 $(call shexport,PyPackage/$(1)/filespec)
44
45 define Package/$(1)/install
46 @getvar $$(call shvar,PyPackage/$(1)/filespec) | ( \
47 IFS='|'; \
48 while read fop fspec fperm; do \
49 if [ "$$$$$$$$fop" = "+" ]; then \
50 dpath=`dirname "$$$$$$$$fspec"`; \
51 if [ -n "$$$$$$$$fperm" ]; then \
52 dperm="-m$$$$$$$$fperm"; \
53 else \
54 dperm=`stat -c "%a" $(PKG_INSTALL_DIR)$$$$$$$$dpath`; \
55 fi; \
56 mkdir -p $$$$$$$$$dperm $$(1)$$$$$$$$dpath; \
57 echo "copying: '$$$$$$$$fspec'"; \
58 cp -fpR $(PKG_INSTALL_DIR)$$$$$$$$fspec $$(1)$$$$$$$$dpath/; \
59 if [ -n "$$$$$$$$fperm" ]; then \
60 chmod -R $$$$$$$$fperm $$(1)$$$$$$$$fspec; \
61 fi; \
62 elif [ "$$$$$$$$fop" = "-" ]; then \
63 echo "removing: '$$$$$$$$fspec'"; \
64 rm -fR $$(1)$$$$$$$$fspec; \
65 elif [ "$$$$$$$$fop" = "=" ]; then \
66 echo "setting permissions: '$$$$$$$$fperm' on '$$$$$$$$fspec'"; \
67 chmod -R $$$$$$$$fperm $$(1)$$$$$$$$fspec; \
68 fi; \
69 done; \
70 )
71 $(call PyPackage/$(1)/install,$$(1))
72 endef
73
74 $$(eval $$(call BuildPackage,$(1)))
75 endef
76
77 define Build/Compile/PyMod
78 ( cd $(PKG_BUILD_DIR)/$(1); \
79 CFLAGS="$(TARGET_CFLAGS)" \
80 CPPFLAGS="$(TARGET_CPPFLAGS)" \
81 LDFLAGS="$(TARGET_LDFLAGS)" \
82 $(3) \
83 $(PYTHON) ./setup.py $(2) \
84 );
85 endef