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.

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