1
0

Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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:=20.2
  19. PKG_RELEASE:=1
  20. PKG_SOURCE_URL:=https://github.com/cjdelisle/cjdns.git
  21. PKG_SOURCE_PROTO:=git
  22. PKG_SOURCE_VERSION:=77259a49e5bc7ca7bc6dca5bd423e02be563bdc5
  23. PKG_LICENSE:=GPL-3.0
  24. PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.bz2
  25. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
  26. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
  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. MAINTAINER:=Lars Gierth <larsg@systemli.org>
  35. DEPENDS:=@IPV6 +kmod-tun +libnl-tiny +libpthread +librt \
  36. +libuci-lua +lua-bencode +dkjson +luasocket +lua-sha2
  37. endef
  38. define Package/cjdns/description
  39. Cjdns implements an encrypted IPv6 network using public-key cryptography \
  40. for address allocation and a distributed hash table for routing. \
  41. This provides near-zero-configuration networking, and prevents many \
  42. of the security and scalability issues that plague existing networks.
  43. endef
  44. define Package/cjdns-tests
  45. SECTION:=net
  46. CATEGORY:=Network
  47. SUBMENU:=Routing and Redirection
  48. TITLE:=cjdns test cases
  49. URL:=https://github.com/cjdelisle/cjdns
  50. MAINTAINER:=Lars Gierth <larsg@systemli.org>
  51. DEPENDS:=+libpthread +librt
  52. endef
  53. define Package/cjdns-test/description
  54. cjdns test cases
  55. endef
  56. define Build/Configure
  57. endef
  58. PKG_DO_VARS:=CJDNS_RELEASE_VERSION=$(PKG_SOURCE_VERSION)
  59. ifneq ($(CONFIG_KERNEL_SECCOMP_FILTER),y)
  60. PKG_DO_VARS+= Seccomp_NO=1
  61. endif
  62. ifneq ($(CONFIG_USE_UCLIBC),)
  63. PKG_DO_VARS+= UCLIBC=1
  64. endif
  65. define Build/Compile
  66. $(INSTALL_DIR) $(PKG_BUILD_DIR)/tmp
  67. (cd $(PKG_BUILD_DIR) && \
  68. CROSS="true" \
  69. CC="$(TARGET_CC)" \
  70. AR="$(TARGET_AR)" \
  71. RANLIB="$(TARGET_RANLIB)" \
  72. CFLAGS="$(TARGET_CFLAGS) -U_FORTIFY_SOURCE" \
  73. LDFLAGS="$(TARGET_LDFLAGS)" \
  74. SYSTEM="linux" \
  75. TARGET_ARCH="$(CONFIG_ARCH)" \
  76. SSP_SUPPORT="$(CONFIG_SSP_SUPPORT)" \
  77. GYP_ADDITIONAL_ARGS="-f make-linux" \
  78. CJDNS_BUILD_TMPDIR="$(PKG_BUILD_DIR)/tmp" \
  79. $(PKG_DO_VARS) \
  80. exec ./do)
  81. endef
  82. define Package/cjdns/install
  83. $(INSTALL_DIR) \
  84. $(1)/usr/sbin \
  85. $(1)/usr/bin \
  86. $(1)/etc/config \
  87. $(1)/etc/init.d \
  88. $(1)/etc/uci-defaults \
  89. $(1)/usr/lib/lua/cjdns
  90. $(INSTALL_BIN) \
  91. ./files/cjdrouteconf \
  92. $(1)/usr/bin
  93. $(INSTALL_BIN) \
  94. $(PKG_BUILD_DIR)/cjdroute \
  95. $(1)/usr/sbin
  96. $(INSTALL_BIN) \
  97. $(PKG_BUILD_DIR)/publictoip6 \
  98. $(1)/usr/bin
  99. $(INSTALL_BIN) \
  100. ./files/cjdns.init \
  101. $(1)/etc/init.d/cjdns
  102. $(INSTALL_BIN) \
  103. ./files/cjdns.defaults \
  104. $(1)/etc/uci-defaults/cjdns
  105. $(CP) \
  106. ./lua/cjdns/* \
  107. $(1)/usr/lib/lua/cjdns
  108. endef
  109. define Package/cjdns/postinst
  110. #!/bin/sh
  111. if [ -z $${IPKG_INSTROOT} ] ; then
  112. ( . /etc/uci-defaults/cjdns ) && rm -f /etc/uci-defaults/cjdns
  113. # TODO: we should have an 'Enable' button instead
  114. /etc/init.d/cjdns enabled || /etc/init.d/cjdns enable
  115. exit 0
  116. fi
  117. endef
  118. define Package/cjdns-tests/install
  119. $(INSTALL_DIR) $(1)/usr/bin
  120. $(INSTALL_BIN) \
  121. $(PKG_BUILD_DIR)/build_linux/test_testcjdroute_c \
  122. $(1)/usr/bin
  123. endef
  124. $(eval $(call BuildPackage,cjdns))
  125. $(eval $(call BuildPackage,cjdns-tests))