Makefile 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. #
  2. # Copyright (C) 2012-2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=fastd
  9. PKG_VERSION:=18
  10. PKG_RELEASE:=2.1
  11. PKG_MAINTAINER:=Matthias Schiffer <mschiffer@universe-factory.net>
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  13. PKG_SOURCE_URL:=https://github.com/NeoRaider/fastd/releases/download/v$(PKG_VERSION)
  14. PKG_MD5SUM:=e53236d3049f64f7955ad9556da099eb
  15. PKG_LICENSE:=BSD-2-Clause
  16. PKG_LICENSE_FILES:=COPYRIGHT
  17. PKG_CONFIG_DEPENDS:=\
  18. CONFIG_FASTD_ENABLE_METHOD_CIPHER_TEST \
  19. CONFIG_FASTD_ENABLE_METHOD_COMPOSED_GMAC \
  20. CONFIG_FASTD_ENABLE_METHOD_COMPOSED_UMAC \
  21. CONFIG_FASTD_ENABLE_METHOD_GENERIC_GMAC \
  22. CONFIG_FASTD_ENABLE_METHOD_GENERIC_POLY1305 \
  23. CONFIG_FASTD_ENABLE_METHOD_GENERIC_UMAC \
  24. CONFIG_FASTD_ENABLE_METHOD_NULL \
  25. CONFIG_FASTD_ENABLE_METHOD_XSALSA20_POLY1305 \
  26. CONFIG_FASTD_ENABLE_CIPHER_AES128_CTR \
  27. CONFIG_FASTD_ENABLE_CIPHER_NULL \
  28. CONFIG_FASTD_ENABLE_CIPHER_SALSA20 \
  29. CONFIG_FASTD_ENABLE_CIPHER_SALSA2012 \
  30. CONFIG_FASTD_ENABLE_MAC_GHASH \
  31. CONFIG_FASTD_ENABLE_MAC_UHASH \
  32. CONFIG_FASTD_WITH_CAPABILITIES \
  33. CONFIG_FASTD_WITH_CMDLINE_USER \
  34. CONFIG_FASTD_WITH_CMDLINE_LOGGING \
  35. CONFIG_FASTD_WITH_CMDLINE_OPERATION \
  36. CONFIG_FASTD_WITH_CMDLINE_COMMANDS \
  37. CONFIG_FASTD_WITH_DYNAMIC_PEERS \
  38. CONFIG_FASTD_WITH_STATUS_SOCKET
  39. PKG_BUILD_DEPENDS:=nacl
  40. include $(INCLUDE_DIR)/package.mk
  41. include $(INCLUDE_DIR)/cmake.mk
  42. define Package/fastd
  43. SECTION:=net
  44. CATEGORY:=Network
  45. DEPENDS:=+kmod-tun +librt +libpthread +libuecc +FASTD_WITH_STATUS_SOCKET:libjson-c +FASTD_WITH_CAPABILITIES:libcap
  46. TITLE:=Fast and Secure Tunneling Daemon
  47. URL:=https://github.com/NeoRaider/fastd/
  48. SUBMENU:=VPN
  49. endef
  50. define Package/fastd/config
  51. source "$(SOURCE)/Config.in"
  52. endef
  53. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  54. TARGET_LDFLAGS += -Wl,--gc-sections
  55. CMAKE_OPTIONS += \
  56. -DCMAKE_BUILD_TYPE:STRING=MINSIZEREL \
  57. -DWITH_METHOD_CIPHER_TEST:BOOL=FALSE \
  58. -DWITH_METHOD_COMPOSED_GMAC:BOOL=FALSE \
  59. -DWITH_METHOD_COMPOSED_UMAC:BOOL=FALSE \
  60. -DWITH_METHOD_GENERIC_GMAC:BOOL=FALSE \
  61. -DWITH_METHOD_GENERIC_POLY1305:BOOL=FALSE \
  62. -DWITH_METHOD_GENERIC_UMAC:BOOL=FALSE \
  63. -DWITH_METHOD_NULL:BOOL=FALSE \
  64. -DWITH_METHOD_XSALSA20_POLY1305:BOOL=FALSE \
  65. -DWITH_CIPHER_AES128_CTR:BOOL=FALSE \
  66. -DWITH_CIPHER_NULL:BOOL=FALSE \
  67. -DWITH_CIPHER_SALSA20:BOOL=FALSE \
  68. -DWITH_CIPHER_SALSA2012:BOOL=FALSE \
  69. -DWITH_MAC_GHASH:BOOL=FALSE \
  70. -DWITH_MAC_UHASH:BOOL=FALSE \
  71. -DWITH_CAPABILITIES:BOOL=FALSE \
  72. -DWITH_CMDLINE_USER:BOOL=FALSE \
  73. -DWITH_CMDLINE_LOGGING:BOOL=FALSE \
  74. -DWITH_CMDLINE_OPERATION:BOOL=FALSE \
  75. -DWITH_CMDLINE_COMMANDS:BOOL=FALSE \
  76. -DWITH_DYNAMIC_PEERS:BOOL=FALSE \
  77. -DWITH_STATUS_SOCKET:BOOL=FALSE \
  78. -DENABLE_SYSTEMD:BOOL=FALSE \
  79. -DENABLE_LIBSODIUM:BOOL=FALSE \
  80. -DENABLE_LTO:BOOL=TRUE
  81. ifeq ($(CONFIG_FASTD_ENABLE_METHOD_CIPHER_TEST),y)
  82. CMAKE_OPTIONS += -DWITH_METHOD_CIPHER_TEST:BOOL=TRUE
  83. endif
  84. ifeq ($(CONFIG_FASTD_ENABLE_METHOD_COMPOSED_GMAC),y)
  85. CMAKE_OPTIONS += -DWITH_METHOD_COMPOSED_GMAC:BOOL=TRUE
  86. endif
  87. ifeq ($(CONFIG_FASTD_ENABLE_METHOD_COMPOSED_UMAC),y)
  88. CMAKE_OPTIONS += -DWITH_METHOD_COMPOSED_UMAC:BOOL=TRUE
  89. endif
  90. ifeq ($(CONFIG_FASTD_ENABLE_METHOD_GENERIC_GMAC),y)
  91. CMAKE_OPTIONS += -DWITH_METHOD_GENERIC_GMAC:BOOL=TRUE
  92. endif
  93. ifeq ($(CONFIG_FASTD_ENABLE_METHOD_GENERIC_POLY1305),y)
  94. CMAKE_OPTIONS += -DWITH_METHOD_GENERIC_POLY1305:BOOL=TRUE
  95. endif
  96. ifeq ($(CONFIG_FASTD_ENABLE_METHOD_GENERIC_UMAC),y)
  97. CMAKE_OPTIONS += -DWITH_METHOD_GENERIC_UMAC:BOOL=TRUE
  98. endif
  99. ifeq ($(CONFIG_FASTD_ENABLE_METHOD_NULL),y)
  100. CMAKE_OPTIONS += -DWITH_METHOD_NULL:BOOL=TRUE
  101. endif
  102. ifeq ($(CONFIG_FASTD_ENABLE_METHOD_XSALSA20_POLY1305),y)
  103. CMAKE_OPTIONS += -DWITH_METHOD_XSALSA20_POLY1305:BOOL=TRUE
  104. endif
  105. ifeq ($(CONFIG_FASTD_ENABLE_CIPHER_AES128_CTR),y)
  106. CMAKE_OPTIONS += -DWITH_CIPHER_AES128_CTR:BOOL=TRUE
  107. endif
  108. ifeq ($(CONFIG_FASTD_ENABLE_CIPHER_NULL),y)
  109. CMAKE_OPTIONS += -DWITH_CIPHER_NULL:BOOL=TRUE
  110. endif
  111. ifeq ($(CONFIG_FASTD_ENABLE_CIPHER_SALSA20),y)
  112. CMAKE_OPTIONS += -DWITH_CIPHER_SALSA20:BOOL=TRUE
  113. endif
  114. ifeq ($(CONFIG_FASTD_ENABLE_CIPHER_SALSA2012),y)
  115. CMAKE_OPTIONS += -DWITH_CIPHER_SALSA2012:BOOL=TRUE
  116. endif
  117. ifeq ($(CONFIG_FASTD_ENABLE_MAC_GHASH),y)
  118. CMAKE_OPTIONS += -DWITH_MAC_GHASH:BOOL=TRUE
  119. endif
  120. ifeq ($(CONFIG_FASTD_ENABLE_MAC_UHASH),y)
  121. CMAKE_OPTIONS += -DWITH_MAC_UHASH:BOOL=TRUE
  122. endif
  123. ifeq ($(CONFIG_FASTD_WITH_CAPABILITIES),y)
  124. CMAKE_OPTIONS += -DWITH_CAPABILITIES:BOOL=TRUE
  125. endif
  126. ifeq ($(CONFIG_FASTD_WITH_CMDLINE_USER),y)
  127. CMAKE_OPTIONS += -DWITH_CMDLINE_USER:BOOL=TRUE
  128. endif
  129. ifeq ($(CONFIG_FASTD_WITH_CMDLINE_LOGGING),y)
  130. CMAKE_OPTIONS += -DWITH_CMDLINE_LOGGING:BOOL=TRUE
  131. endif
  132. ifeq ($(CONFIG_FASTD_WITH_CMDLINE_OPERATION),y)
  133. CMAKE_OPTIONS += -DWITH_CMDLINE_OPERATION:BOOL=TRUE
  134. endif
  135. ifeq ($(CONFIG_FASTD_WITH_CMDLINE_COMMANDS),y)
  136. CMAKE_OPTIONS += -DWITH_CMDLINE_COMMANDS:BOOL=TRUE
  137. endif
  138. ifeq ($(CONFIG_FASTD_WITH_DYNAMIC_PEERS),y)
  139. CMAKE_OPTIONS += -DWITH_DYNAMIC_PEERS:BOOL=TRUE
  140. endif
  141. ifeq ($(CONFIG_FASTD_WITH_STATUS_SOCKET),y)
  142. CMAKE_OPTIONS += -DWITH_STATUS_SOCKET:BOOL=TRUE
  143. endif
  144. define Package/fastd/description
  145. Fast and secure tunneling daemon, which is optimized on small code size and few dependencies
  146. endef
  147. define Package/fastd/conffiles
  148. /etc/config/fastd
  149. endef
  150. define Package/fastd/install
  151. $(INSTALL_DIR) $(1)/usr/bin
  152. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/fastd $(1)/usr/bin/
  153. $(INSTALL_DIR) $(1)/etc/init.d/
  154. $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/openwrt/fastd.init $(1)/etc/init.d/fastd
  155. $(INSTALL_DIR) $(1)/etc/config
  156. $(INSTALL_CONF) $(PKG_BUILD_DIR)/doc/examples/openwrt/fastd.config $(1)/etc/config/fastd
  157. $(INSTALL_DIR) $(1)/etc/fastd
  158. $(INSTALL_DIR) $(1)/lib/upgrade/keep.d
  159. $(INSTALL_DATA) files/fastd.upgrade $(1)/lib/upgrade/keep.d/fastd
  160. endef
  161. $(eval $(call BuildPackage,fastd))