#
# Copyright (C) 2020-2023 Iopsys
#

include $(TOPDIR)/rules.mk

PKG_NAME:=libdpp
PKG_VERSION:=2.1.1

LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=6024efd3db9dd490c07465ea9b0c15120063165c
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/libdpp.git
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
endif

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=LGPL-2.1-only
PKG_LICENSE_FILES:=LICENSE

include $(INCLUDE_DIR)/package.mk


define Package/libdpp/description
  Library providing APIs for DPP EasyConnect frame generation and handling
endef

define Package/libdpp
  TITLE:= DPP EasyConnect library (libdpp)
  DEPENDS:= +libeasy +libopenssl +libgcrypt +libubox +libwifiutils
endef

MAKE_PATH:=lib


define Build/InstallDev/libdpp
	$(INSTALL_DIR) $(1)/usr/include
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_BUILD_DIR)/lib/dpp_api.h $(1)/usr/include/
	$(CP) $(PKG_BUILD_DIR)/lib/dpputils.h $(1)/usr/include/
	$(CP) $(PKG_BUILD_DIR)/lib/libdpp.so* $(1)/usr/lib/
endef


define Build/InstallDev
	$(call Build/InstallDev/libdpp,$(1),$(2))
endef

define Package/libdpp/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_BUILD_DIR)/lib/libdpp.so* $(1)/usr/lib/
endef

$(eval $(call BuildPackage,libdpp))
