include $(TOPDIR)/rules.mk

PKG_NAME:=cmph
PKG_VERSION:=2.0.2
PKG_RELEASE:=1

PKG_SOURCE:=cmph-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/cmph/
PKG_MD5SUM:=51ec5329b47774d251a96eaaafdb409e

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
PKG_FIXUP:=autoreconf

PKG_LICENSE:=LGPLv2
PKG_LICENSE_FILES:=LGPL-2

include $(INCLUDE_DIR)/package.mk

define Package/$(PKG_NAME)
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=C Minimal Perfect Hashing library
  URL:=https://sourceforge.net/projects/cmph/
endef

define Package/$(PKG_NAME)/description
  C Minimal Perfect Hashing (CMPH) library allows the creation of minimal perfect hash functions for large data sets.
endef

define Build/Configure
	$(call Build/Configure/Default)
endef

define Build/InstallDev
	$(INSTALL_DIR) $(1)/usr/include
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/cmph.h $(1)/usr/include/
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/cmph_time.h $(1)/usr/include/
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/cmph_types.h $(1)/usr/include/

	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_BUILD_DIR)/src/.libs/libcmph.a $(1)/usr/lib/
	$(CP) $(PKG_BUILD_DIR)/src/.libs/libcmph.so* $(1)/usr/lib/
endef

define Package/$(PKG_NAME)/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_BUILD_DIR)/src/.libs/libcmph.so* $(1)/usr/lib/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))

