added XOrg video drivers for i810, ati, nv and fbdev
[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:=$(STAGING_DIR)/usr/bin/hostpython
12
13 PYTHON_VERSION=2.5
14
15 PYTHON_INC_DIR:=$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION)
16 PYTHON_LIB_DIR:=$(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION)
17
18 PYTHON_PKG_DIR:=/usr/lib/python$(PYTHON_VERSION)/site-packages
19
20 endif
21
22 define PyPackage
23 NAME:=$(1)
24 $(eval $(call PyPackage/$(1)))
25
26 define Package/$(1)
27 TITLE:=$(TITLE)
28 SECTION:=lang
29 CATEGORY:=Languages
30 DEPENDS:=+python
31 $(call PyPackage/$(1))
32 endef
33
34 ifdef PyPackage/$(1)/description
35 define Package/$(1)/description
36 $(call PyPackage/$(1)/description)
37 endef
38 endif
39
40 $(call shexport,PyPackage/$(1)/filespec)
41
42 define Package/$(1)/install
43 @getvar $$(call shvar,PyPackage/$(1)/filespec) | ( \
44 IFS='|'; \
45 while read fop fspec fperm; do \
46 if [ "$$$$$$$$fop" = "+" ]; then \
47 dpath=`dirname "$$$$$$$$fspec"`; \
48 if [ -n "$$$$$$$$fperm" ]; then \
49 dperm="-m$$$$$$$$fperm"; \
50 else \
51 dperm=`stat -c "%a" $(PKG_INSTALL_DIR)$$$$$$$$dpath`; \
52 fi; \
53 mkdir -p $$$$$$$$$dperm $$(1)$$$$$$$$dpath; \
54 echo "copying: '$$$$$$$$fspec'"; \
55 cp -fpR $(PKG_INSTALL_DIR)$$$$$$$$fspec $$(1)$$$$$$$$dpath/; \
56 if [ -n "$$$$$$$$fperm" ]; then \
57 chmod -R $$$$$$$$fperm $$(1)$$$$$$$$fspec; \
58 fi; \
59 elif [ "$$$$$$$$fop" = "-" ]; then \
60 echo "removing: '$$$$$$$$fspec'"; \
61 rm -fR $$(1)$$$$$$$$fspec; \
62 elif [ "$$$$$$$$fop" = "=" ]; then \
63 echo "setting permissions: '$$$$$$$$fperm' on '$$$$$$$$fspec'"; \
64 chmod -R $$$$$$$$fperm $$(1)$$$$$$$$fspec; \
65 fi; \
66 done; \
67 )
68 $(call PyPackage/$(1)/install,$$(1))
69 endef
70
71 $$(eval $$(call BuildPackage,$(1)))
72 endef
73
74 define Build/Compile/PyMod
75 ( cd $(PKG_BUILD_DIR)/$(1); \
76 CFLAGS="$(TARGET_CFLAGS)" \
77 CPPFLAGS="$(TARGET_CPPFLAGS)" \
78 LDFLAGS="$(TARGET_LDFLAGS)" \
79 $(3) \
80 $(PYTHON) ./setup.py $(2) \
81 );
82 endef