source: packages/lang/python/python-package.mk @ 8639

Last change on this file since 8639 was 8639, checked in by nico, 9 years ago

massive python changes:

  • move all python packages to lang section
  • add a python-package.mk rules file sourced by all python packages for PyPackage/* defs
  • introduce a new way of specifying files to be packaged (experimental)
  • add missing svn:properties
  • Property svn:copyright set to Copyright (C) 2007 OpenWrt.org
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
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
9ifeq ($(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
20endif
21
22define 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)))
72endef
73
74define 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        );
82endef
Note: See TracBrowser for help on using the repository browser.