# $Id: Makefile 2230 2005-10-22 12:12:59Z nbd $

include $(TOPDIR)/rules.mk
PKG_NAME:=owcapi-example
PKG_VERSION:=2.7p5
PKG_RELEASE:=1
PKG_MD5SUM:=

#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
#PKG_SOURCE_URL:=@SF/$(PKG_NAME)
#PKG_MD5SUM:=x
PKG_SOURCE_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk

PKG_BUILD_DIR:=$(BUILD_DIR)/owcapi-example-$(PKG_VERSION)
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install


define Package/owcapi-example/Default
  TITLE:=Owcapi-Example 
  DEPENDS:=
  DESCRIPTION:=Owcapi-Example \\\
          Just some test...
  URL:=http://owfs.sourceforge.net/
endef

define Package/owcapi-example
  $(call Package/owcapi-example/Default)
  SECTION:=utils
  CATEGORY:=Utilities
  DEPENDS:=+owfs
  TITLE+= (binaries)
  DESCRIPTION+=\\\
	\\\
	This package contains owcapi-example
endef

define Build/Prepare
	$(call Build/Prepare/Default)
	$(CP) example/* $(PKG_BUILD_DIR)
endef

define Build/Configure
	(cd $(PKG_BUILD_DIR); rm -rf config.{status,cache} ; \
		$(TARGET_CONFIGURE_OPTS) \
		CFLAGS="$(TARGET_CFLAGS)" \
		CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
		LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
		shrext_cmds=".so" \
		./configure \
			--target=$(GNU_TARGET_NAME) \
			--host=$(GNU_TARGET_NAME) \
			--build=$(GNU_HOST_NAME) \
			--program-prefix="" \
			--program-suffix="" \
			--prefix=/usr \
			--exec-prefix=/usr \
			--bindir=/usr/bin \
			--datadir=/usr/share \
			--includedir=/usr/include \
			--infodir=/usr/share/info \
			--libdir=/usr/lib \
			--libexecdir=/usr/lib \
			--localstatedir=/var \
			--mandir=/usr/share/man \
			--sbindir=/usr/sbin \
			--sysconfdir=/etc \
			--enable-shared=yes \
			--enable-static=yes \
			--disable-rpath \
			--with-owcapiinclude="$(STAGING_DIR)/usr/include" \
			--with-owcapilib="$(STAGING_DIR)/usr/lib" \
			--with-gnu-ld \
	);
endef

define Build/Compile
	rm -rf $(PKG_INSTALL_DIR)
	mkdir -p $(PKG_INSTALL_DIR)
	$(MAKE) -C $(PKG_BUILD_DIR) \
		DESTDIR="$(PKG_INSTALL_DIR)" \
		shrext_cmds=".so" \
		all install
endef

define Package/owcapi-example/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/owcapi-example $(1)/usr/bin/
endef

$(eval $(call BuildPackage,owcapi-example))
