2 # Copyright (C) 2007 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
11 PYTHON:=$(STAGING_DIR)/usr/bin/hostpython
15 PYTHON_INC_DIR:=$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION)
16 PYTHON_LIB_DIR:=$(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION)
18 PYTHON_PKG_DIR:=/usr/lib/python$(PYTHON_VERSION)/site-packages
24 $(eval $(call PyPackage/$(1)))
32 $(call PyPackage/$(1))
35 ifdef PyPackage/$(1)/description
36 define Package/$(1)/description
37 $(call PyPackage/$(1)/description)
41 $(call shexport,PyPackage/$(1)/filespec)
43 define Package/$(1)/install
44 @getvar $$(call shvar,PyPackage/$(1)/filespec) | ( \
46 while read fop fspec fperm; do \
47 if [ "$$$$$$$$fop" = "+" ]; then \
48 dpath=`dirname "$$$$$$$$fspec"`; \
49 if [ -n "$$$$$$$$fperm" ]; then \
50 dperm="-m$$$$$$$$fperm"; \
52 dperm=`stat -c "%a" $(PKG_INSTALL_DIR)$$$$$$$$dpath`; \
54 mkdir -p $$$$$$$$$dperm $$(1)$$$$$$$$dpath; \
55 echo "copying: '$$$$$$$$fspec'"; \
56 cp -fpR $(PKG_INSTALL_DIR)$$$$$$$$fspec $$(1)$$$$$$$$dpath/; \
57 if [ -n "$$$$$$$$fperm" ]; then \
58 chmod -R $$$$$$$$fperm $$(1)$$$$$$$$fspec; \
60 elif [ "$$$$$$$$fop" = "-" ]; then \
61 echo "removing: '$$$$$$$$fspec'"; \
62 rm -fR $$(1)$$$$$$$$fspec; \
63 elif [ "$$$$$$$$fop" = "=" ]; then \
64 echo "setting permissions: '$$$$$$$$fperm' on '$$$$$$$$fspec'"; \
65 chmod -R $$$$$$$$fperm $$(1)$$$$$$$$fspec; \
69 $(call PyPackage/$(1)/install,$$(1))
72 $$(eval $$(call BuildPackage,$(1)))
75 define Build/Compile/PyMod
76 ( cd $(PKG_BUILD_DIR)/$(1); \
77 CFLAGS="$(TARGET_CFLAGS)" \
78 CPPFLAGS="$(TARGET_CPPFLAGS)" \
79 LDFLAGS="$(TARGET_LDFLAGS)" \
81 $(PYTHON) ./setup.py $(2) \