Split python into a host and target build. Also add a HostPython macro to convenientl...
[openwrt/svn-archive/archive.git] / libs / libdnet / Makefile
index 50a8ba805c40fa96bd7fcc13fda46445d733e094..44bd21d7e8115fe908415e4e92e0fadfed458abf 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2008 OpenWrt.org
+# Copyright (C) 2006-2010 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,39 +8,53 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libdnet
-PKG_VERSION:=1.10
+PKG_VERSION:=1.11
 PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/$(PKG_NAME)
-PKG_MD5SUM:=416b765e9d9961501ac85e9a366fd219
+PKG_MD5SUM:=04c394ed8e1e7fc455456e79e908916d
+
 PKG_FIXUP:=libtool
+PKG_INSTALL:=1
+
+PKG_CONFIG_DEPENDS:=\
+       CONFIG_PACKAGE_libdnet \
+       CONFIG_PACKAGE_pydnet
+
+PKG_BUILD_DEPENDS:=PACKAGE_pydnet:python
 
 include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
 
-define Package/libdnet
+define Package/libdnet/Default
   SECTION:=libs
   CATEGORY:=Libraries
   TITLE:=Low-level network library
   URL:=http://sourceforge.net/projects/libdnet/
 endef
 
-define Package/libdnet/description
-       libdnet is a library of simplified, portable interface to several 
+define Package/libdnet/Default/description
+       libdnet is a library of simplified, portable interface to several
        low-level networking routines.
 endef
 
+define Package/libdnet
+  $(call Package/libdnet/Default)
+endef
+
+define Package/libdnet/description
+  $(call Package/libdnet/Default/description)
+endef
+
 define Package/pydnet
-  SECTION:=libs
+  $(call Package/libdnet/Default)
   DEPENDS:=libdnet +python-mini
-  CATEGORY:=Libraries
-  TITLE:=Low-level network library
-  URL:=http://sourceforge.net/projects/libdnet/
 endef
 
 define Package/pydnet/description
-       libdnet is a library of simplified, portable interface to several 
-       low-level networking routines.
+  $(call Package/libdnet/Default/description)
+  This package contains the python dnet library.
 endef
 
 TARGET_CFLAGS += $(FPIC)
@@ -54,9 +68,25 @@ CONFIGURE_ARGS += \
 CONFIGURE_VARS += \
        ac_cv_dnet_bsd_bpf=no
 
-MAKE_FLAGS += \
-       DESTDIR="$(PKG_INSTALL_DIR)" \
-       all install
+define Build/Compile
+       $(call Build/Compile/Default)
+       $(if $(CONFIG_PACKAGE_pydnet), \
+               $(call Build/Compile/PyMod, \
+                       python/, \
+                       build \
+               ) \
+       )
+endef
+
+define Build/Install
+       $(call Build/Install/Default)
+       $(if $(CONFIG_PACKAGE_pydnet), \
+               $(call Build/Compile/PyMod, \
+                       python/, \
+                       install --no-compile --prefix $(PKG_INSTALL_DIR)/usr \
+               ) \
+       )
+endef
 
 define Build/InstallDev
        $(INSTALL_DIR) $(2)/bin
@@ -95,11 +125,7 @@ endef
 
 define Package/pydnet/install
        $(INSTALL_DIR) $(1)/usr/lib
-       cd $(PKG_BUILD_DIR)/python; \
-       CFLAGS="$(TARGET_CFLAGS)" \
-       $(STAGING_DIR)/usr/bin/hostpython ./setup.py install \
-               --no-compile --prefix $(PKG_INSTALL_DIR)/usr
-       cp -a $(PKG_INSTALL_DIR)/usr/lib/python* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/python* $(1)/usr/lib/
 endef