remove UninstallDev
[packages.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 PYTHON_VERSION=2.5
10
11 PYTHON_DIR:=$(STAGING_DIR)/usr
12 PYTHON_BIN_DIR:=$(PYTHON_DIR)/bin
13 PYTHON_INC_DIR:=$(PYTHON_DIR)/include/python$(PYTHON_VERSION)
14 PYTHON_LIB_DIR:=$(PYTHON_DIR)/lib/python$(PYTHON_VERSION)
15
16 PYTHON:=$(PYTHON_BIN_DIR)/python
17
18 PYTHON_PKG_DIR:=/usr/lib/python$(PYTHON_VERSION)/site-packages
19
20 define PyPackage
21   $(call shexport,PyPackage/$(1)/filespec)
22
23   define Package/$(1)/install
24         @getvar $$(call shvar,PyPackage/$(1)/filespec) | ( \
25                 IFS='|'; \
26                 while read fop fspec fperm; do \
27                   if [ "$$$$$$$$fop" = "+" ]; then \
28                     dpath=`dirname "$$$$$$$$fspec"`; \
29                     if [ -n "$$$$$$$$fperm" ]; then \
30                       dperm="-m$$$$$$$$fperm"; \
31                     else \
32                       dperm=`stat -c "%a" $(PKG_INSTALL_DIR)$$$$$$$$dpath`; \
33                     fi; \
34                     mkdir -p $$$$$$$$$dperm $$(1)$$$$$$$$dpath; \
35                     echo "copying: '$$$$$$$$fspec'"; \
36                     cp -fpR $(PKG_INSTALL_DIR)$$$$$$$$fspec $$(1)$$$$$$$$dpath/; \
37                     if [ -n "$$$$$$$$fperm" ]; then \
38                       chmod -R $$$$$$$$fperm $$(1)$$$$$$$$fspec; \
39                     fi; \
40                   elif [ "$$$$$$$$fop" = "-" ]; then \
41                     echo "removing: '$$$$$$$$fspec'"; \
42                     rm -fR $$(1)$$$$$$$$fspec; \
43                   elif [ "$$$$$$$$fop" = "=" ]; then \
44                     echo "setting permissions: '$$$$$$$$fperm' on '$$$$$$$$fspec'"; \
45                     chmod -R $$$$$$$$fperm $$(1)$$$$$$$$fspec; \
46                   fi; \
47                 done; \
48         )
49         $(call PyPackage/$(1)/install,$$(1))
50   endef
51 endef
52
53 define Build/Compile/PyMod
54         ( cd $(PKG_BUILD_DIR)/$(1); \
55                 CFLAGS="$(TARGET_CFLAGS)" \
56                 CPPFLAGS="$(TARGET_CPPFLAGS)" \
57                 LDFLAGS="$(TARGET_LDFLAGS)" \
58                 $(3) \
59                 $(PYTHON) ./setup.py $(2) \
60         );
61 endef