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.7 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. include $(INCLUDE_DIR)/package.mk
  20. define Package/uanytun/template
  21. SECTION:=net
  22. CATEGORY:=Network
  23. SUBMENU:=VPN
  24. DEPENDS:=+kmod-tun
  25. TITLE:=micro anycast tunneling daemon
  26. URL:=http://www.anytun.org/
  27. MAINTAINER:=Christian Pointner <equinox@spreadspace.org>
  28. endef
  29. define Package/uanytun
  30. $(call Package/uanytun/template)
  31. TITLE+= (gcrypt)
  32. VARIANT:=gcrypt
  33. DEPENDS+=+libgcrypt
  34. endef
  35. define Package/uanytun/conffiles
  36. /etc/config/uanytun
  37. endef
  38. define Package/uanytun/description
  39. uAnytun is a tiny implementation of SATP the secure anycast tunneling protocol.
  40. SATP defines a protocol used for communication between any combination of
  41. unicast and anycast tunnel endpoints. It has less protocol overhead than
  42. IPSec in Tunnel mode and allows tunneling of every ETHER TYPE protocol (e.g.
  43. ethernet, ip, arp ...). SATP directly includes cryptography and message
  44. authentication based on the methods used by SRTP. It is intended to deliver
  45. a generic, scaleable and secure solution for tunneling and relaying of packets
  46. of any protocol.
  47. Unlike Anytun which is a full featured implementation uAnytun has no support
  48. for multiple connections or synchronisation. It is a small single threaded
  49. implementation intended to act as a client on small platforms.
  50. endef
  51. define Package/uanytun-nettle
  52. $(call Package/uanytun/template)
  53. TITLE+= (nettle)
  54. VARIANT:=nettle
  55. DEPENDS+=+libnettle
  56. endef
  57. Package/uanytun-nettle/conffiles=$(Package/uanytun/conffiles)
  58. Package/uanytun-nettle/description=$(Package/uanytun/description)
  59. define Package/uanytun-sslcrypt
  60. $(call Package/uanytun/template)
  61. TITLE+= (openssl)
  62. VARIANT:=sslcrypt
  63. DEPENDS+=+libopenssl
  64. endef
  65. Package/uanytun-sslcrypt/conffiles=$(Package/uanytun/conffiles)
  66. Package/uanytun-sslcrypt/description=$(Package/uanytun/description)
  67. define Package/uanytun-nocrypt
  68. $(call Package/uanytun/template)
  69. TITLE+= (no crypt)
  70. VARIANT:=nocrypt
  71. endef
  72. Package/uanytun-nocrypt/conffiles=$(Package/uanytun/conffiles)
  73. Package/uanytun-nocrypt/description=$(Package/uanytun/description)
  74. define Build/Configure
  75. (cd $(PKG_BUILD_DIR)/src; \
  76. touch include.mk; \
  77. ln -s linux/tun.c .; \
  78. echo '#ifndef UANYTUN_version_h_INCLUDED' > version.h; \
  79. echo '#define UANYTUN_version_h_INCLUDED' >> version.h; \
  80. echo '' >> version.h; \
  81. echo '#define VERSION_STRING_0 "uanytun version '`cat $(PKG_BUILD_DIR)/version`'"' >> version.h; \
  82. echo '#define VERSION_STRING_1 "built on '`hostname`', '`date +"%d.%m.%Y %H:%M:%S %Z"`'"' >> 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
  92. VARIANT_LDFLAGS+=-lgpg-error -lgcrypt
  93. endif
  94. ifeq ($(BUILD_VARIANT),nettle)
  95. VARIANT_CFLAGS+=-DUSE_NETTLE
  96. VARIANT_LDFLAGS+=-lnettle
  97. endif
  98. ifeq ($(BUILD_VARIANT),sslcrypt)
  99. VARIANT_CFLAGS+=-DUSE_SSL_CRYPTO
  100. VARIANT_LDFLAGS+=-lcrypto
  101. endif
  102. ifeq ($(BUILD_VARIANT),nocrypt)
  103. VARIANT_CFLAGS+=-DNO_CRYPT
  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)" \
  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))