# 
# Copyright (C) 2006-2009 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:=ssltunnel
PKG_VERSION:=0.1
PKG_RELEASE:=1

include $(INCLUDE_DIR)/package.mk

define Package/ssltunnel
  SECTION:=net
  CATEGORY:=Network
  DEPENDS:=+ppp +libopenssl
  TITLE:=DrayTek SSL VPN Tunnel Server
  SUBMENU:=VPN
endef

define Build/Prepare
	$(CP) ${CURDIR}/ssltunnel-0.1/* $(PKG_BUILD_DIR)
endef

define Build/Configure
	$(call Build/Configure/Default, \
		, \
		BUILD_CC="$(TARGET_CC)" \
		HOSTCC="$(HOSTCC)" \
	)
endef

define Build/Compile
	$(MAKE) -C $(PKG_BUILD_DIR) \
		DESTDIR="$(PKG_INSTALL_DIR)" \
		all install
endef

define Package/ssltunnel/install	
	$(INSTALL_DIR) $(1)/usr/sbin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ssltunnel $(1)/usr/sbin/ssltunnel
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/ssltunnel.init $(1)/etc/init.d/ssltunnel
	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_CONF) ./files/ssltunnel_config $(1)/etc/config/ssltunnel_config
endef

$(eval $(call BuildPackage,ssltunnel))
