#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=gcp_addon
VERSION_YEAR=$(shell date +%Y)
VERSION_MAJOR=$(shell expr $(VERSION_YEAR) - 2018)
VERSION_MINOR=$(shell date +%V%u)
PKG_RELEASE:=1
PKG_VERSION:=$(VERSION_MAJOR).$(VERSION_MINOR)-$(PKG_RELEASE)
PKG_MAINTAINER:= Zhang Guohong <guohong.zhang@lnxall.com>
PKG_LICENSE:=GPLv2

PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/gcp_addon
  SECTION:=DYIOT
  CATEGORY:=DYIOT Software
  TITLE:=gcp_addon
  DEPENDS:=+libstdcpp
endef

define Package/gcp_addon/description
  GCP addon for MT7623 gateway
endef

define Build/Prepare
	mkdir -p $(PKG_BUILD_DIR)
	$(CP) ./src/* $(PKG_BUILD_DIR)/
endef

define Build/Configure
endef

define Build/Compile
endef

define Build/Install
endef

define Package/gcp_addon/install
	$(INSTALL_DIR) $(1)/app/gcp
	$(INSTALL_DIR) $(1)/app/gcp/proc
	$(INSTALL_DIR) $(1)/app/gcp/ini/scl
	$(INSTALL_DIR) $(1)/app/gcp/run/ctx
	$(INSTALL_DIR) $(1)/app/gcp/run/dbfiles
	$(INSTALL_DIR) $(1)/app/gcp/run/files/backup
	$(INSTALL_DIR) $(1)/app/gcp/run/img
	$(INSTALL_DIR) $(1)/app/gcp/run/log
	$(INSTALL_DIR) $(1)/app/gcp/run/mnt
	$(INSTALL_DIR) $(1)/app/gcp/run/msg
	$(INSTALL_DIR) $(1)/etc/init.d/
	$(CP) $(PKG_BUILD_DIR)/gcp/* $(1)/app/gcp/
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/gcpdog-ied $(1)/etc/init.d/
endef
# $(INSTALL_BIN) $(PKG_BUILD_DIR)/gcpdog-ied $(1)/etc/init.d/
# $(INSTALL_BIN) $(PKG_BUILD_DIR)/gcpcom.init $(1)/etc/init.d/gcpcom
# $(INSTALL_BIN) $(PKG_BUILD_DIR)/gcpnid.init $(1)/etc/init.d/gcpnid

$(eval $(call BuildPackage,gcp_addon))
