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.

154 lines
4.2 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+= (nettle)
  32. VARIANT:=nettle
  33. DEPENDS+=+libnettle
  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-sslcrypt
  52. $(call Package/uanytun/template)
  53. TITLE+= (openssl)
  54. VARIANT:=sslcrypt
  55. DEPENDS+=+libopenssl
  56. endef
  57. Package/uanytun-sslcrypt/conffiles=$(Package/uanytun/conffiles)
  58. Package/uanytun-sslcrypt/description=$(Package/uanytun/description)
  59. define Package/uanytun-nocrypt
  60. $(call Package/uanytun/template)
  61. TITLE+= (no crypt)
  62. VARIANT:=nocrypt
  63. endef
  64. Package/uanytun-nocrypt/conffiles=$(Package/uanytun/conffiles)
  65. Package/uanytun-nocrypt/description=$(Package/uanytun/description)
  66. define Build/Configure
  67. (cd $(PKG_BUILD_DIR)/src; \
  68. touch include.mk; \
  69. ln -s linux/tun.c .; \
  70. echo '#ifndef UANYTUN_version_h_INCLUDED' > version.h; \
  71. echo '#define UANYTUN_version_h_INCLUDED' >> version.h; \
  72. echo '' >> version.h; \
  73. echo '#define VERSION_STRING_0 "uanytun version '`cat $(PKG_BUILD_DIR)/version`'"' >> version.h; \
  74. echo '#define VERSION_STRING_1 "built on '`hostname`', '`date +"%d.%m.%Y %H:%M:%S %Z"`'"' >> version.h; \
  75. echo '' >> version.h; \
  76. echo '#endif' >> version.h \
  77. )
  78. endef
  79. VARIANT_CFLAGS:=
  80. VARIANT_LDFLAGS:=-ldl
  81. VARIANT_MAKE_OPTS:=
  82. ifeq ($(BUILD_VARIANT),nettle)
  83. VARIANT_CFLAGS+=-DUSE_NETTLE
  84. VARIANT_LDFLAGS+=-lnettle
  85. endif
  86. ifeq ($(BUILD_VARIANT),sslcrypt)
  87. VARIANT_CFLAGS+=-DUSE_SSL_CRYPTO
  88. VARIANT_LDFLAGS+=-lcrypto
  89. endif
  90. ifeq ($(BUILD_VARIANT),nocrypt)
  91. VARIANT_CFLAGS+=-DNO_CRYPT
  92. VARIANT_MAKE_OPTS+=NO_CRYPT_OBJ=1
  93. endif
  94. define Build/Compile
  95. $(MAKE) -C $(PKG_BUILD_DIR)/src \
  96. $(TARGET_CONFIGURE_OPTS) \
  97. $(VARIANT_MAKE_OPTS) \
  98. TARGET=Linux \
  99. CFLAGS="$(TARGET_CFLAGS) $(VARIANT_CFLAGS)" \
  100. LDFLAGS="$(TARGET_LDFLAGS) $(VARIANT_LDFLAGS)"
  101. $(STRIP) $(PKG_BUILD_DIR)/src/uanytun
  102. endef
  103. define Package/uanytun/install-generic
  104. $(INSTALL_DIR) $(1)/etc/config
  105. $(INSTALL_DATA) ./files/$(2) $(1)/etc/config/$(PKG_NAME)
  106. $(INSTALL_DIR) $(1)/usr/sbin
  107. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/uanytun $(1)/usr/sbin/$(PKG_NAME)
  108. $(INSTALL_DIR) $(1)/etc/init.d
  109. $(INSTALL_BIN) ./files/uanytun.init $(1)/etc/init.d/$(PKG_NAME)
  110. endef
  111. define Package/uanytun/install
  112. $(call Package/uanytun/install-generic,$(1),uanytun.config)
  113. endef
  114. define Package/uanytun-sslcrypt/install
  115. $(call Package/uanytun/install-generic,$(1),uanytun.config)
  116. endef
  117. define Package/uanytun-nocrypt/install
  118. $(call Package/uanytun/install-generic,$(1),uanytun-nocrypt.config)
  119. endef
  120. $(eval $(call BuildPackage,uanytun))
  121. $(eval $(call BuildPackage,uanytun-sslcrypt))
  122. $(eval $(call BuildPackage,uanytun-nocrypt))