3feb35efd4d3e3231f9c6c750a248b6793b4acce
[feed/routing.git] / cjdns / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=cjdns
4 PKG_VERSION:=0.16
5 PKG_RELEASE:=12
6
7 PKG_SOURCE_URL:=https://github.com/hyperboria/cjdns.git
8 PKG_SOURCE_PROTO:=git
9 PKG_SOURCE_VERSION:=2303ce6585f62f7e8d3cdb1983c0c8e08385ea68
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 PKG_DO_VARS:=
40
41 ifneq ($(CONFIG_KERNEL_SECCOMP_FILTER),y)
42 PKG_DO_VARS+= Seccomp_NO=1
43 endif
44
45 ifneq ($(CONFIG_USE_UCLIBC),)
46 PKG_DO_VARS+= UCLIBC=1
47 endif
48
49 define Build/Compile
50 CROSS="true" \
51 CC="$(TARGET_CC)" \
52 CFLAGS="$(TARGET_CFLAGS)" \
53 LDFLAGS="$(TARGET_LDFLAGS)" \
54 SYSTEM="linux" \
55 TARGET_ARCH="$(CONFIG_ARCH)" \
56 SSP_SUPPORT="$(CONFIG_SSP_SUPPORT)" \
57 $(PKG_DO_VARS) \
58 $(PKG_BUILD_DIR)/do
59 endef
60
61 define Package/cjdns/install
62 $(INSTALL_DIR) \
63 $(1)/usr/sbin \
64 $(1)/usr/bin \
65 $(1)/etc/config \
66 $(1)/etc/init.d \
67 $(1)/etc/uci-defaults \
68 $(1)/usr/lib/lua/cjdns
69
70 $(INSTALL_BIN) \
71 ./files/cjdrouteconf \
72 $(1)/usr/bin
73
74 $(INSTALL_BIN) \
75 $(PKG_BUILD_DIR)/cjdroute \
76 $(1)/usr/sbin
77
78 $(INSTALL_BIN) \
79 $(PKG_BUILD_DIR)/publictoip6 \
80 $(1)/usr/bin
81
82 $(INSTALL_BIN) \
83 ./files/cjdns.init \
84 $(1)/etc/init.d/cjdns
85
86 $(INSTALL_BIN) \
87 ./files/cjdns.defaults \
88 $(1)/etc/uci-defaults/cjdns
89
90 $(CP) \
91 ./lua/cjdns/* \
92 $(1)/usr/lib/lua/cjdns
93 endef
94
95 define Package/cjdns/postinst
96 #!/bin/sh
97 if [ -z $${IPKG_INSTROOT} ] ; then
98 ( . /etc/uci-defaults/cjdns ) && rm -f /etc/uci-defaults/cjdns
99 # TODO: we should have an 'Enable' button instead
100 /etc/init.d/cjdns enabled || /etc/init.d/cjdns enable
101 exit 0
102 fi
103 endef
104
105 $(eval $(call BuildPackage,cjdns))