3253532669588bc8c0144efb11e45cb83350e51b
[feed/routing.git] / cjdns / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=cjdns
4 PKG_VERSION:=0.16
5 PKG_RELEASE:=9
6
7 PKG_SOURCE_URL:=https://github.com/cjdelisle/cjdns.git
8 PKG_SOURCE_PROTO:=git
9 PKG_SOURCE_VERSION:=2138a1f6a94fc009958cde7b002c077a1eee929a
10 PKG_LICENSE:=GPL-3.0
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.bz2
12 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
13 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
14
15 include $(INCLUDE_DIR)/package.mk
16
17
18 define Package/cjdns
19 SECTION:=net
20 CATEGORY:=Network
21 SUBMENU:=Routing and Redirection
22 TITLE:=Encrypted near-zero-conf mesh routing protocol
23 URL:=https://github.com/hyperboria/cjdns
24 MAINTAINER:=Lars Gierth <larsg@systemli.org>
25 DEPENDS:=+kmod-tun +kmod-ipv6 +libnl-tiny +libpthread +librt \
26 +libuci-lua +lua-bencode +dkjson +luasocket +lua-sha2
27 endef
28
29 define Package/cjdns/description
30 Cjdns implements an encrypted IPv6 network using public-key cryptography \
31 for address allocation and a distributed hash table for routing. \
32 This provides near-zero-configuration networking, and prevents many \
33 of the security and scalability issues that plague existing networks.
34 endef
35
36 define Build/Configure
37 endef
38
39 ifneq ($(CONFIG_KERNEL_SECCOMP_FILTER),y)
40 PKG_DO_VARS:=Seccomp_NO=1
41 endif
42
43 define Build/Compile
44 CROSS="true" \
45 CC="$(TARGET_CC)" \
46 CFLAGS="$(TARGET_CFLAGS)" \
47 LDFLAGS="$(TARGET_LDFLAGS)" \
48 SYSTEM="linux" \
49 TARGET_ARCH="$(CONFIG_ARCH)" \
50 UCLIBC=1 \
51 SSP_SUPPORT="$(CONFIG_SSP_SUPPORT)" \
52 $(PKG_DO_VARS) \
53 $(PKG_BUILD_DIR)/do
54 endef
55
56 define Package/cjdns/install
57 $(INSTALL_DIR) \
58 $(1)/usr/sbin \
59 $(1)/usr/bin \
60 $(1)/etc/config \
61 $(1)/etc/init.d \
62 $(1)/etc/uci-defaults \
63 $(1)/usr/lib/lua/cjdns
64
65 $(INSTALL_BIN) \
66 ./files/cjdrouteconf \
67 $(1)/usr/bin
68
69 $(INSTALL_BIN) \
70 $(PKG_BUILD_DIR)/cjdroute \
71 $(1)/usr/sbin
72
73 $(INSTALL_BIN) \
74 $(PKG_BUILD_DIR)/publictoip6 \
75 $(1)/usr/bin
76
77 $(INSTALL_BIN) \
78 ./files/cjdns.init \
79 $(1)/etc/init.d/cjdns
80
81 $(INSTALL_BIN) \
82 ./files/cjdns.defaults \
83 $(1)/etc/uci-defaults/cjdns
84
85 $(CP) \
86 ./lua/cjdns/* \
87 $(1)/usr/lib/lua/cjdns
88 endef
89
90 define Package/cjdns/postinst
91 #!/bin/sh
92 if [ -z $${IPKG_INSTROOT} ] ; then
93 ( . /etc/uci-defaults/cjdns ) && rm -f /etc/uci-defaults/cjdns
94 # TODO: we should have an 'Enable' button instead
95 /etc/init.d/cjdns enabled || /etc/init.d/cjdns enable
96 exit 0
97 fi
98 endef
99
100 $(eval $(call BuildPackage,cjdns))