#
# Copyright (C) 2013-2021 iopsys
#

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=ponmngr
PKG_VERSION:=1.0.3

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=LICENSE

include $(INCLUDE_DIR)/package.mk
include ../bbfdm/bbfdm.mk

define Package/ponmngr
	CATEGORY:=Utilities
	TITLE:=PON Manager
	DEPENDS:=@(TARGET_brcmbca||TARGET_airoha) +libbbfdm-api
endef

define Package/ponmngr/description
	Configures PON
endef

#define Build/Prepare
#	$(CP) -rf ./ponmngr/* $(PKG_BUILD_DIR)/
#endef

define Build/Compile
endef

define Package/ponmngr/install
	$(CP) ./files/common/* $(1)/
ifneq ($(CONFIG_TARGET_brcmbca),)
	$(CP) ./files/broadcom/* $(1)/
else ifneq ($(CONFIG_TARGET_airoha),)
	$(CP) ./files/airoha/* $(1)/
endif
	$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)
	$(BBFDM_INSTALL_MS_DM) ./files/etc/ponmngr/xpon.json $(1) $(PKG_NAME)
endef

$(eval $(call BuildPackage,ponmngr))
