upgrade uanytun to newest release 0.3.4

the new package now makes use of build variants

Signed-off-by: Christian Pointner <equinox@spreadspace.org>
This commit is contained in:
Christian Pointner 2014-06-14 23:43:32 +02:00
parent 4e682f03ef
commit 4d0bfa5371
2 changed files with 61 additions and 115 deletions

View File

@ -1,6 +1,6 @@
# #
# Copyright (C) 2008 Christian Pointner, # Copyright (C) 2008-2014 Christian Pointner,
# <equinox@anytun.org> # <equinox@anytun.org>
# #
# This is free software, licensed under the GNU General Public License v2. # This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information. # See /LICENSE for more information.
@ -12,13 +12,14 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=uanytun PKG_NAME:=uanytun
PKG_VERSION:=0.3.3 PKG_VERSION:=0.3.4
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.anytun.org/download/ PKG_SOURCE_URL:=http://www.anytun.org/download/
PKG_MD5SUM:=ca39dab02e91b0737e2b3f0839e74f6a PKG_MD5SUM:=b4085ab7f0127732818b8b801f280aef
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
@ -26,13 +27,26 @@ include $(INCLUDE_DIR)/package.mk
define Package/uanytun/template define Package/uanytun/template
SECTION:=net SECTION:=net
CATEGORY:=Network CATEGORY:=Network
SUBMENU:=VPN
DEPENDS:=+kmod-tun
TITLE:=micro anycast tunneling daemon TITLE:=micro anycast tunneling daemon
URL:=http://www.anytun.org/ URL:=http://www.anytun.org/
MAINTAINER:=Christian Pointner <equinox@anytun.org> MAINTAINER:=Christian Pointner <equinox@spreadspace.org>
SUBMENU:=VPN
endef endef
define Package/uanytun/desc-template
define Package/uanytun
$(call Package/uanytun/template)
TITLE+= (gcrypt)
VARIANT:=gcrypt
DEPENDS+=+libgcrypt
endef
define Package/uanytun/conffiles
/etc/config/uanytun
endef
define Package/uanytun/description
uAnytun is a tiny implementation of SATP the secure anycast tunneling protocol. uAnytun is a tiny implementation of SATP the secure anycast tunneling protocol.
SATP defines a protocol used for communication between any combination of SATP defines a protocol used for communication between any combination of
unicast and anycast tunnel endpoints. It has less protocol overhead than unicast and anycast tunnel endpoints. It has less protocol overhead than
@ -47,161 +61,93 @@ uAnytun is a tiny implementation of SATP the secure anycast tunneling protocol.
endef endef
define Package/uanytun
$(call Package/uanytun/template)
DEPENDS:=+kmod-tun +libgcrypt
endef
define Package/uanytun/conffiles
/etc/config/uanytun
endef
define Package/uanytun/description
$(call Package/uanytun/desc-template)
endef
define Package/uanytun-sslcrypt define Package/uanytun-sslcrypt
$(call Package/uanytun/template) $(call Package/uanytun/template)
DEPENDS:=+kmod-tun +libopenssl TITLE+= (openssl)
VARIANT:=sslcrypt
DEPENDS+=+libopenssl
endef endef
define Package/uanytun-sslcrypt/conffiles Package/uanytun-sslcrypt/conffiles=$(Package/uanytun/conffiles)
/etc/config/uanytun-sslcrypt Package/uanytun-sslcrypt/description=$(Package/uanytun/description)
endef
define Package/uanytun-sslcrypt/description
$(call Package/uanytun/desc-template)
endef
define Package/uanytun-nocrypt define Package/uanytun-nocrypt
$(call Package/uanytun/template) $(call Package/uanytun/template)
DEPENDS:=+kmod-tun TITLE+= (no crypt)
VARIANT:=nocrypt
endef endef
define Package/uanytun-nocrypt/conffiles Package/uanytun-nocrypt/conffiles=$(Package/uanytun/conffiles)
/etc/config/uanytun-nocrypt Package/uanytun-nocrypt/description=$(Package/uanytun/description)
endef
define Package/uanytun-nocrypt/description
$(call Package/uanytun/desc-template)
endef
define Package/uanytun/configure
(cd $(1)/$(2)/src; \ define Build/Configure
(cd $(PKG_BUILD_DIR)/src; \
touch include.mk; \ touch include.mk; \
ln -s linux/tun.c .; \ ln -s linux/tun.c .; \
echo '#ifndef UANYTUN_version_h_INCLUDED' > version.h; \ echo '#ifndef UANYTUN_version_h_INCLUDED' > version.h; \
echo '#define UANYTUN_version_h_INCLUDED' >> version.h; \ echo '#define UANYTUN_version_h_INCLUDED' >> version.h; \
echo '' >> version.h; \ echo '' >> version.h; \
echo '#define VERSION_STRING_0 "uanytun version '`cat $(1)/version`'"' >> version.h; \ echo '#define VERSION_STRING_0 "uanytun version '`cat $(PKG_BUILD_DIR)/version`'"' >> version.h; \
echo '#define VERSION_STRING_1 "built on '`hostname`', '`date +"%d.%m.%Y %H:%M:%S %Z"`'"' >> version.h; \ echo '#define VERSION_STRING_1 "built on '`hostname`', '`date +"%d.%m.%Y %H:%M:%S %Z"`'"' >> version.h; \
echo '' >> version.h; \ echo '' >> version.h; \
echo '#endif' >> version.h \ echo '#endif' >> version.h \
) )
endef endef
ifneq ($(CONFIG_PACKAGE_uanytun-nocrypt),) VARIANT_CFLAGS:=
define Build/Configure/uanytun-nocrypt VARIANT_LDFLAGS:=-ldl
rm -rf $(PKG_BUILD_DIR)/uanytun-nocrypt VARIANT_MAKE_OPTS:=
mkdir -p $(PKG_BUILD_DIR)/uanytun-nocrypt
$(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun-nocrypt
$(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun-nocrypt)
endef
define Build/Compile/uanytun-nocrypt ifeq ($(BUILD_VARIANT),gcrypt)
$(MAKE) -C $(PKG_BUILD_DIR)/uanytun-nocrypt/src \ VARIANT_LDFLAGS+=-lgpg-error -lgcrypt
$(TARGET_CONFIGURE_OPTS) \
NO_CRYPT_OBJ=1 \
TARGET=Linux \
CFLAGS="$(TARGET_CFLAGS) -DNO_CRYPT" \
LDFLAGS="$(TARGET_LDFLAGS) -ldl"
$(STRIP) $(PKG_BUILD_DIR)/uanytun-nocrypt/src/uanytun
endef
endif endif
ifneq ($(CONFIG_PACKAGE_uanytun-sslcrypt),) ifeq ($(BUILD_VARIANT),sslcrypt)
define Build/Configure/uanytun-sslcrypt VARIANT_CFLAGS+=-DUSE_SSL_CRYPTO
rm -rf $(PKG_BUILD_DIR)/uanytun-sslcrypt VARIANT_LDFLAGS+=-lcrypto
mkdir -p $(PKG_BUILD_DIR)/uanytun-sslcrypt
$(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun-sslcrypt
$(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun-sslcrypt)
endef
define Build/Compile/uanytun-sslcrypt
$(MAKE) -C $(PKG_BUILD_DIR)/uanytun-sslcrypt/src \
$(TARGET_CONFIGURE_OPTS) \
TARGET=Linux \
CFLAGS="$(TARGET_CFLAGS) -DUSE_SSL_CRYPTO -I$(STAGING_DIR)/usr/include" \
LDFLAGS="$(TARGET_LDFLAGS) -ldl -lcrypto"
$(STRIP) $(PKG_BUILD_DIR)/uanytun-sslcrypt/src/uanytun
endef
endif endif
ifneq ($(CONFIG_PACKAGE_uanytun),) ifeq ($(BUILD_VARIANT),nocrypt)
define Build/Configure/uanytun-default VARIANT_CFLAGS+=-DNO_CRYPT
rm -rf $(PKG_BUILD_DIR)/uanytun VARIANT_MAKE_OPTS+=NO_CRYPT_OBJ=1
mkdir -p $(PKG_BUILD_DIR)/uanytun
$(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun
$(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun)
endef
define Build/Compile/uanytun-default
$(MAKE) -C $(PKG_BUILD_DIR)/uanytun/src \
$(TARGET_CONFIGURE_OPTS) \
TARGET=Linux \
CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
LDFLAGS="$(TARGET_LDFLAGS) -ldl -lgcrypt -lgpg-error"
$(STRIP) $(PKG_BUILD_DIR)/uanytun/src/uanytun
endef
endif endif
define Build/Configure
$(call Build/Configure/uanytun-nocrypt)
$(call Build/Configure/uanytun-sslcrypt)
$(call Build/Configure/uanytun-default)
endef
define Build/Compile define Build/Compile
$(call Build/Compile/uanytun-nocrypt) $(MAKE) -C $(PKG_BUILD_DIR)/src \
$(call Build/Compile/uanytun-sslcrypt) $(TARGET_CONFIGURE_OPTS) \
$(call Build/Compile/uanytun-default) $(VARIANT_MAKE_OPTS) \
TARGET=Linux \
CFLAGS="$(TARGET_CFLAGS) $(VARIANT_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS) $(VARIANT_LDFLAGS)"
$(STRIP) $(PKG_BUILD_DIR)/src/uanytun
endef endef
define Build/Clean
rm -rf $(PKG_BUILD_DIR)/uanytun-nocrypt
rm -rf $(PKG_BUILD_DIR)/uanytun-sslcrypt
rm -rf $(PKG_BUILD_DIR)/uanytun
endef
define Package/uanytun/install-generic define Package/uanytun/install-generic
$(INSTALL_DIR) $(1)/etc/config $(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/$(3) $(1)/etc/config/$(2) $(INSTALL_DATA) ./files/$(2) $(1)/etc/config/$(PKG_NAME)
$(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(2)/src/uanytun $(1)/usr/sbin/$(2) $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/uanytun $(1)/usr/sbin/$(PKG_NAME)
$(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/uanytun.init $(1)/etc/init.d/$(2) $(INSTALL_BIN) ./files/uanytun.init $(1)/etc/init.d/$(PKG_NAME)
@sed -e 's/BIN=uanytun/BIN=$(2)/' -i $(1)/etc/init.d/$(2)
endef endef
define Package/uanytun/install define Package/uanytun/install
$(call Package/uanytun/install-generic,$(1),uanytun,uanytun.config) $(call Package/uanytun/install-generic,$(1),uanytun.config)
endef endef
define Package/uanytun-sslcrypt/install define Package/uanytun-sslcrypt/install
$(call Package/uanytun/install-generic,$(1),uanytun-sslcrypt,uanytun.config) $(call Package/uanytun/install-generic,$(1),uanytun.config)
endef endef
define Package/uanytun-nocrypt/install define Package/uanytun-nocrypt/install
$(call Package/uanytun/install-generic,$(1),uanytun-nocrypt,uanytun-nocrypt.config) $(call Package/uanytun/install-generic,$(1),uanytun-nocrypt.config)
endef endef
$(eval $(call BuildPackage,uanytun)) $(eval $(call BuildPackage,uanytun))
$(eval $(call BuildPackage,uanytun-sslcrypt)) $(eval $(call BuildPackage,uanytun-sslcrypt))
$(eval $(call BuildPackage,uanytun-nocrypt)) $(eval $(call BuildPackage,uanytun-nocrypt))

View File

@ -61,7 +61,7 @@ stop_vpn() {
echo -n " $name" echo -n " $name"
local status="OK" local status="OK"
if [ ! -f "$pidfile" ]; then if [ ! -f "$pidfile" ]; then
status="tunnel not active" status="tunnel not active"
else else
kill `cat $pidfile` > /dev/null 2>&1 || status="failed" kill `cat $pidfile` > /dev/null 2>&1 || status="failed"
rm -f $pidfile rm -f $pidfile
@ -71,7 +71,7 @@ stop_vpn() {
start() { start() {
echo -n "Starting $DESC:" echo -n "Starting $DESC:"
config_load $BIN config_load $BIN
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
config_foreach foreach_config_forced "$1" config_foreach foreach_config_forced "$1"