include $(TOPDIR)/rules.mk
include $(TOPDIR)/draytek_include/draytek_info

PKG_NAME:=tspc
PKG_VERSION:=2.1.1-6
PKG_RELEASE:=1
PKG_LICENSE:=GPLv2
PKG_FIXUP:=autoreconf
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk

define Package/tspc
	SECTION:=apps
	CATEGORY:=DrayOS5
	SUBMENU:=System
	TITLE:=Tunnel Setup Protocol Client for IPv6
	DEPENDS:=+bmx7 +bmx7-tun
endef

define Package/tspc/description
	Tunnel Setup Protocol Client for IPv6
endef

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

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

define Build/Compile
	$(MAKE) -C $(PKG_BUILD_DIR) \
	$(TARGET_CONFIGURE_OPTS) \
	target=linux ;


endef

define Package/tspc/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_DIR) $(1)/etc/tsp
	$(INSTALL_DIR) $(1)/etc/tsp/template
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/tspc $(1)/usr/bin/
	$(INSTALL_DATA) ./files/linux.sh $(1)/etc/tsp/template/setup.sh
	@chmod 777 $(1)/etc/tsp/template/setup.sh
	

endef

$(eval $(call BuildPackage,tspc))
