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