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.

175 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.5
  14. PKG_RELEASE:=1
  15. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  16. PKG_SOURCE_URL:=http://www.anytun.org/download/
  17. PKG_MD5SUM:=ce47ad45003ff1d84eaf5276941b9ddf
  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+
  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_0 "uanytun version '`cat $(PKG_BUILD_DIR)/version`'"' >> version.h; \
  84. echo '#define VERSION_STRING_1 "built on '`hostname`', '`date +"%d.%m.%Y %H:%M:%S %Z"`'"' >> version.h; \
  85. echo '' >> version.h; \
  86. echo '#endif' >> version.h \
  87. )
  88. endef
  89. VARIANT_CFLAGS:=
  90. VARIANT_LDFLAGS:=-ldl
  91. VARIANT_MAKE_OPTS:=
  92. ifeq ($(BUILD_VARIANT),gcrypt)
  93. VARIANT_CFLAGS+=-DUSE_GCRYPT
  94. VARIANT_LDFLAGS+=-lgpg-error -lgcrypt
  95. endif
  96. ifeq ($(BUILD_VARIANT),nettle)
  97. VARIANT_CFLAGS+=-DUSE_NETTLE
  98. VARIANT_LDFLAGS+=-lnettle
  99. endif
  100. ifeq ($(BUILD_VARIANT),sslcrypt)
  101. VARIANT_CFLAGS+=-DUSE_SSL_CRYPTO
  102. VARIANT_LDFLAGS+=-lcrypto
  103. endif
  104. ifeq ($(BUILD_VARIANT),nocrypt)
  105. VARIANT_CFLAGS+=-DNO_CRYPT
  106. VARIANT_MAKE_OPTS+=NO_CRYPT_OBJ=1
  107. endif
  108. define Build/Compile
  109. $(MAKE) -C $(PKG_BUILD_DIR)/src \
  110. $(TARGET_CONFIGURE_OPTS) \
  111. $(VARIANT_MAKE_OPTS) \
  112. TARGET=Linux \
  113. CFLAGS="$(TARGET_CFLAGS) $(VARIANT_CFLAGS)" \
  114. LDFLAGS="$(TARGET_LDFLAGS) $(VARIANT_LDFLAGS)"
  115. $(STRIP) $(PKG_BUILD_DIR)/src/uanytun
  116. endef
  117. define Package/uanytun/install-generic
  118. $(INSTALL_DIR) $(1)/etc/config
  119. $(INSTALL_DATA) ./files/$(2) $(1)/etc/config/$(PKG_NAME)
  120. $(INSTALL_DIR) $(1)/usr/sbin
  121. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/uanytun $(1)/usr/sbin/$(PKG_NAME)
  122. $(INSTALL_DIR) $(1)/etc/init.d
  123. $(INSTALL_BIN) ./files/uanytun.init $(1)/etc/init.d/$(PKG_NAME)
  124. endef
  125. define Package/uanytun/install
  126. $(call Package/uanytun/install-generic,$(1),uanytun.config)
  127. endef
  128. define Package/uanytun-nettle/install
  129. $(call Package/uanytun/install-generic,$(1),uanytun.config)
  130. endef
  131. define Package/uanytun-sslcrypt/install
  132. $(call Package/uanytun/install-generic,$(1),uanytun.config)
  133. endef
  134. define Package/uanytun-nocrypt/install
  135. $(call Package/uanytun/install-generic,$(1),uanytun-nocrypt.config)
  136. endef
  137. $(eval $(call BuildPackage,uanytun))
  138. $(eval $(call BuildPackage,uanytun-nettle))
  139. $(eval $(call BuildPackage,uanytun-sslcrypt))
  140. $(eval $(call BuildPackage,uanytun-nocrypt))