Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #
  2. # Copyright (C) 2014,2015 Hyperboria.net
  3. #
  4. # You may redistribute this program and/or modify it under the terms of
  5. # the GNU General Public License as published by the Free Software Foundation,
  6. # either version 3 of the License, or (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. #
  16. include $(TOPDIR)/rules.mk
  17. PKG_NAME:=cjdns
  18. PKG_VERSION:=21.1
  19. PKG_RELEASE:=6
  20. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  21. PKG_SOURCE_URL:=https://codeload.github.com/cjdelisle/cjdns/tar.gz/$(PKG_NAME)-v$(PKG_VERSION)?
  22. PKG_HASH:=a6158ce7847159aa44e86f74ccc7b6ded6910a230ed8f3830db53cda5838f0b0
  23. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_NAME)-v$(PKG_VERSION)
  24. PKG_MAINTAINER:=William Fleurant <meshnet@protonmail.com>
  25. PKG_LICENSE:=GPL-3.0-or-later
  26. PKG_LICENSE_FILES:=LICENSE
  27. include $(INCLUDE_DIR)/package.mk
  28. define Package/cjdns
  29. SECTION:=net
  30. CATEGORY:=Network
  31. SUBMENU:=Routing and Redirection
  32. TITLE:=Encrypted near-zero-conf mesh routing protocol
  33. URL:=https://github.com/cjdelisle/cjdns
  34. DEPENDS:=@!arc @IPV6 +kmod-tun +libnl-tiny +libpthread +librt \
  35. +libuci-lua +lua-bencode +dkjson +luasocket +lua-sha2
  36. endef
  37. define Package/cjdns/description
  38. Cjdns implements an encrypted IPv6 network using public-key cryptography \
  39. for address allocation and a distributed hash table for routing. \
  40. This provides near-zero-configuration networking, and prevents many \
  41. of the security and scalability issues that plague existing networks.
  42. endef
  43. define Package/cjdns-tests
  44. SECTION:=net
  45. CATEGORY:=Network
  46. SUBMENU:=Routing and Redirection
  47. TITLE:=cjdns test cases
  48. URL:=https://github.com/cjdelisle/cjdns
  49. DEPENDS:=+libpthread +librt @!arc
  50. endef
  51. define Package/cjdns-test/description
  52. Builds cjdns test cases binary test_testcjdroute_c
  53. endef
  54. define Build/Configure
  55. endef
  56. PKG_DO_VARS:=CJDNS_RELEASE_VERSION=$(PKG_SOURCE_VERSION)
  57. ifneq ($(CONFIG_KERNEL_SECCOMP_FILTER),y)
  58. PKG_DO_VARS+= Seccomp_NO=1
  59. endif
  60. ifneq ($(CONFIG_USE_UCLIBC),)
  61. PKG_DO_VARS+= UCLIBC=1
  62. endif
  63. define Build/Compile
  64. $(INSTALL_DIR) $(PKG_BUILD_DIR)/tmp
  65. (cd $(PKG_BUILD_DIR) && \
  66. CROSS="true" \
  67. CC="$(TARGET_CC_NOCACHE)" \
  68. AR="$(TARGET_AR)" \
  69. RANLIB="$(TARGET_RANLIB)" \
  70. CFLAGS="$(TARGET_CFLAGS) -U_FORTIFY_SOURCE -Wno-error=array-bounds -Wno-error=stringop-overflow -Wno-error=stringop-overread" \
  71. LDFLAGS="$(TARGET_LDFLAGS)" \
  72. SYSTEM="linux" \
  73. TARGET_ARCH="$(CONFIG_ARCH)" \
  74. SSP_SUPPORT="$(CONFIG_SSP_SUPPORT)" \
  75. GYP_ADDITIONAL_ARGS="-f make-linux" \
  76. CJDNS_BUILD_TMPDIR="$(PKG_BUILD_DIR)/tmp" \
  77. $(PKG_DO_VARS) \
  78. exec ./do)
  79. endef
  80. define Package/cjdns/install
  81. $(INSTALL_DIR) \
  82. $(1)/usr/sbin \
  83. $(1)/usr/bin \
  84. $(1)/etc/config \
  85. $(1)/etc/init.d \
  86. $(1)/etc/uci-defaults \
  87. $(1)/usr/lib/lua/cjdns \
  88. $(1)/usr/share/ucitrack
  89. $(INSTALL_BIN) \
  90. ./files/cjdrouteconf \
  91. $(1)/usr/bin
  92. $(INSTALL_BIN) \
  93. $(PKG_BUILD_DIR)/cjdroute \
  94. $(1)/usr/sbin
  95. $(INSTALL_BIN) \
  96. $(PKG_BUILD_DIR)/publictoip6 \
  97. $(1)/usr/bin
  98. $(INSTALL_BIN) \
  99. ./files/cjdns.init \
  100. $(1)/etc/init.d/cjdns
  101. $(INSTALL_BIN) \
  102. ./files/cjdns.defaults \
  103. $(1)/etc/uci-defaults/cjdns
  104. $(INSTALL_DATA) \
  105. ./files/luci-app-cjdns.json \
  106. $(1)/usr/share/ucitrack
  107. $(CP) \
  108. ./lua/cjdns/* \
  109. $(1)/usr/lib/lua/cjdns
  110. endef
  111. define Package/cjdns/postinst
  112. #!/bin/sh
  113. if [ -z $${IPKG_INSTROOT} ] ; then
  114. ( . /etc/uci-defaults/cjdns ) && rm -f /etc/uci-defaults/cjdns
  115. /etc/init.d/cjdns enabled || /etc/init.d/cjdns enable
  116. exit 0
  117. fi
  118. endef
  119. define Package/cjdns-tests/install
  120. $(INSTALL_DIR) $(1)/usr/bin
  121. $(INSTALL_BIN) \
  122. $(PKG_BUILD_DIR)/build_linux/test_testcjdroute_c \
  123. $(1)/usr/bin
  124. endef
  125. $(eval $(call BuildPackage,cjdns))
  126. $(eval $(call BuildPackage,cjdns-tests))