# 
# Copyright (C) 2010 Chess Embedded Technology
#

include $(TOPDIR)/rules.mk

PKG_NAME:=cppunit
PKG_VERSION:=1.12.1
PKG_VERSION_SHORT:=1.12
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/cppunit
PKG_MD5SUM:=bd30e9cf5523cdfc019b94f5e1d7fd19

include $(INCLUDE_DIR)/package.mk

define Package/libcppunit
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=C++ unit testing framework
  URL:=http://sourceforge.net/apps/mediawiki/cppunit/index.php?title=Main_Page
  DEPENDS:=+libncurses
endef

define Package/libcppunit/description
	CppUnit is a C++ unit testing framework. It started its life as a port of JUnit to C++ by Michael Feathers.
endef

TARGET_CPPFLAGS:=-I. -I.. $(TARGET_CPPFLAGS)

TARGET_CFLAGS += $(FPIC)

define Build/Compile
	echo "Build compile"
	echo "Doing autoreconf"
	autoreconf -fvi $(PKG_BUILD_DIR) 
	$(MAKE) -C $(PKG_BUILD_DIR) \
		DESTDIR="$(PKG_INSTALL_DIR)" \
		all install
endef

define Build/InstallDev
	$(INSTALL_DIR) $(1)/usr/include
	$(CP) $(PKG_INSTALL_DIR)/usr/include/$(PKG_NAME) $(1)/usr/include/
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$(PKG_NAME).{a,so*} $(1)/usr/lib/
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$(PKG_NAME)-$(PKG_VERSION_SHORT).so* $(1)/usr/lib/
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$(PKG_NAME)_curses.{a,so*} $(1)/usr/lib/
endef

define Package/libcppunit/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$(PKG_NAME).so* $(1)/usr/lib/
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$(PKG_NAME)-$(PKG_VERSION_SHORT).so* $(1)/usr/lib/
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$(PKG_NAME)_curses.so* $(1)/usr/lib/
endef

$(eval $(call BuildPackage,libcppunit))
