You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
4.9 KiB

  1. #
  2. # Copyright (C) 2008-2014 Christian Pointner,
  3. # <equinox@anytun.org>
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. # This Makefile builds uAnytun Package for OpenWRT
  9. #
  10. # $Id: $
  11. include $(TOPDIR)/rules.mk
  12. PKG_NAME:=uanytun
  13. PKG_VERSION:=0.3.7
  14. PKG_RELEASE:=2
  15. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  16. PKG_SOURCE_URL:=http://www.anytun.org/download/
  17. PKG_HASH:=076318c771c908386c4408dda0769171542da701785302903641ce23fd33a295
  18. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  19. PKG_MAINTAINER:=Christian Pointner <equinox@spreadspace.org>
  20. PKG_LICENSE:=GPL-3.0-or-later
  21. PKG_LICENSE_FILES:=LICENSE
  22. include $(INCLUDE_DIR)/package.mk
  23. define Package/uanytun/template
  24. SECTION:=net
  25. CATEGORY:=Network
  26. SUBMENU:=VPN
  27. DEPENDS:=+kmod-tun
  28. TITLE:=micro anycast tunneling daemon
  29. URL:=http://www.anytun.org/
  30. endef
  31. define Package/uanytun
  32. $(call Package/uanytun/template)
  33. TITLE+= (gcrypt)
  34. VARIANT:=gcrypt
  35. DEPENDS+=+libgcrypt
  36. endef
  37. define Package/uanytun/conffiles
  38. /etc/config/uanytun
  39. endef
  40. define Package/uanytun/description
  41. uAnytun is a tiny implementation of SATP the secure anycast tunneling protocol.
  42. SATP defines a protocol used for communication between any combination of
  43. unicast and anycast tunnel endpoints. It has less protocol overhead than
  44. IPSec in Tunnel mode and allows tunneling of every ETHER TYPE protocol (e.g.
  45. ethernet, ip, arp ...). SATP directly includes cryptography and message
  46. authentication based on the methods used by SRTP. It is intended to deliver
  47. a generic, scalable and secure solution for tunneling and relaying of packets
  48. of any protocol.
  49. Unlike Anytun which is a full featured implementation uAnytun has no support
  50. for multiple connections or synchronisation. It is a small single threaded
  51. implementation intended to act as a client on small platforms.
  52. endef
  53. define Package/uanytun-nettle
  54. $(call Package/uanytun/template)
  55. TITLE+= (nettle)
  56. VARIANT:=nettle
  57. DEPENDS+=+libnettle
  58. endef
  59. Package/uanytun-nettle/conffiles=$(Package/uanytun/conffiles)
  60. Package/uanytun-nettle/description=$(Package/uanytun/description)
  61. define Package/uanytun-sslcrypt
  62. $(call Package/uanytun/template)
  63. TITLE+= (openssl)
  64. VARIANT:=sslcrypt
  65. DEPENDS+=+libopenssl
  66. endef
  67. Package/uanytun-sslcrypt/conffiles=$(Package/uanytun/conffiles)
  68. Package/uanytun-sslcrypt/description=$(Package/uanytun/description)
  69. define Package/uanytun-nocrypt
  70. $(call Package/uanytun/template)
  71. TITLE+= (no crypt)
  72. VARIANT:=nocrypt
  73. endef
  74. Package/uanytun-nocrypt/conffiles=$(Package/uanytun/conffiles)
  75. Package/uanytun-nocrypt/description=$(Package/uanytun/description)
  76. define Build/Configure
  77. (cd $(PKG_BUILD_DIR)/src; \
  78. touch include.mk; \
  79. ln -s linux/tun.c .; \
  80. echo '#ifndef UANYTUN_version_h_INCLUDED' > version.h; \
  81. echo '#define UANYTUN_version_h_INCLUDED' >> version.h; \
  82. echo '' >> version.h; \
  83. echo '#define VERSION_STRING "uanytun version '`cat $(PKG_BUILD_DIR)/version`'"' >> version.h; \
  84. echo '' >> version.h; \
  85. echo '#endif' >> version.h \
  86. )
  87. endef
  88. VARIANT_CFLAGS:=
  89. VARIANT_LDFLAGS:=-ldl
  90. VARIANT_MAKE_OPTS:=
  91. ifeq ($(BUILD_VARIANT),gcrypt)
  92. VARIANT_CFLAGS+=-DUSE_GCRYPT -DCRYPTO_LIB_NAME=\\\"libgcrypt\\\"
  93. VARIANT_LDFLAGS+=-lgpg-error -lgcrypt
  94. endif
  95. ifeq ($(BUILD_VARIANT),nettle)
  96. VARIANT_CFLAGS+=-DUSE_NETTLE -DCRYPTO_LIB_NAME=\\\"Nettle\\\"
  97. VARIANT_LDFLAGS+=-lnettle
  98. endif
  99. ifeq ($(BUILD_VARIANT),sslcrypt)
  100. VARIANT_CFLAGS+=-DUSE_SSL_CRYPTO -DCRYPTO_LIB_NAME=\\\"OpenSSL\\\"
  101. VARIANT_LDFLAGS+=-lcrypto
  102. endif
  103. ifeq ($(BUILD_VARIANT),nocrypt)
  104. VARIANT_CFLAGS+=-DNO_CRYPT -DCRYPTO_LIB_NAME=\\\"none\\\"
  105. VARIANT_MAKE_OPTS+=NO_CRYPT_OBJ=1
  106. endif
  107. define Build/Compile
  108. $(MAKE) -C $(PKG_BUILD_DIR)/src \
  109. $(TARGET_CONFIGURE_OPTS) \
  110. $(VARIANT_MAKE_OPTS) \
  111. TARGET=Linux \
  112. CFLAGS="$(TARGET_CFLAGS) $(VARIANT_CFLAGS) $(TARGET_CPPFLAGS)" \
  113. LDFLAGS="$(TARGET_LDFLAGS) $(VARIANT_LDFLAGS)"
  114. $(STRIP) $(PKG_BUILD_DIR)/src/uanytun
  115. endef
  116. define Package/uanytun/install-generic
  117. $(INSTALL_DIR) $(1)/etc/config
  118. $(INSTALL_DATA) ./files/$(2) $(1)/etc/config/$(PKG_NAME)
  119. $(INSTALL_DIR) $(1)/usr/sbin
  120. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/uanytun $(1)/usr/sbin/$(PKG_NAME)
  121. $(INSTALL_DIR) $(1)/etc/init.d
  122. $(INSTALL_BIN) ./files/uanytun.init $(1)/etc/init.d/$(PKG_NAME)
  123. endef
  124. define Package/uanytun/install
  125. $(call Package/uanytun/install-generic,$(1),uanytun.config)
  126. endef
  127. define Package/uanytun-nettle/install
  128. $(call Package/uanytun/install-generic,$(1),uanytun.config)
  129. endef
  130. define Package/uanytun-sslcrypt/install
  131. $(call Package/uanytun/install-generic,$(1),uanytun.config)
  132. endef
  133. define Package/uanytun-nocrypt/install
  134. $(call Package/uanytun/install-generic,$(1),uanytun-nocrypt.config)
  135. endef
  136. $(eval $(call BuildPackage,uanytun))
  137. $(eval $(call BuildPackage,uanytun-nettle))
  138. $(eval $(call BuildPackage,uanytun-sslcrypt))
  139. $(eval $(call BuildPackage,uanytun-nocrypt))