Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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:=0.17
  19. PKG_RELEASE:=3
  20. PKG_SOURCE_URL:=https://github.com/hyperboria/cjdns.git
  21. PKG_SOURCE_PROTO:=git
  22. PKG_SOURCE_VERSION:=40e87d9419c19063e772e39c7c59a8a8771c5ee8
  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/hyperboria/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/hyperboria/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. CROSS="true" \
  68. CC="$(TARGET_CC)" \
  69. AR="$(TARGET_AR)" \
  70. RANLIB="$(TARGET_RANLIB)" \
  71. CFLAGS="$(TARGET_CFLAGS)" \
  72. LDFLAGS="$(TARGET_LDFLAGS)" \
  73. SYSTEM="linux" \
  74. TARGET_ARCH="$(CONFIG_ARCH)" \
  75. SSP_SUPPORT="$(CONFIG_SSP_SUPPORT)" \
  76. GYP_ADDITIONAL_ARGS="-f make-linux" \
  77. CJDNS_BUILD_TMPDIR="$(PKG_BUILD_DIR)/tmp" \
  78. $(PKG_DO_VARS) \
  79. $(PKG_BUILD_DIR)/do
  80. endef
  81. define Package/cjdns/install
  82. $(INSTALL_DIR) \
  83. $(1)/usr/sbin \
  84. $(1)/usr/bin \
  85. $(1)/etc/config \
  86. $(1)/etc/init.d \
  87. $(1)/etc/uci-defaults \
  88. $(1)/usr/lib/lua/cjdns
  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. $(CP) \
  105. ./lua/cjdns/* \
  106. $(1)/usr/lib/lua/cjdns
  107. endef
  108. define Package/cjdns/postinst
  109. #!/bin/sh
  110. if [ -z $${IPKG_INSTROOT} ] ; then
  111. ( . /etc/uci-defaults/cjdns ) && rm -f /etc/uci-defaults/cjdns
  112. # TODO: we should have an 'Enable' button instead
  113. /etc/init.d/cjdns enabled || /etc/init.d/cjdns enable
  114. exit 0
  115. fi
  116. endef
  117. define Package/cjdns-tests/install
  118. $(INSTALL_DIR) $(1)/usr/bin
  119. $(INSTALL_BIN) \
  120. $(PKG_BUILD_DIR)/build_linux/test_testcjdroute_c \
  121. $(1)/usr/bin
  122. endef
  123. $(eval $(call BuildPackage,cjdns))
  124. $(eval $(call BuildPackage,cjdns-tests))