-
Notifications
You must be signed in to change notification settings - Fork 10
/
6lbr.patch
111 lines (111 loc) · 4.11 KB
/
6lbr.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
--- /dev/null 2015-12-30 19:47:42.548000000 +0300
+++ package/network/ipv6/6lbr/Makefile 2015-12-30 23:39:20.809011496 +0300
@@ -0,0 +1,94 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=6lbr
+PKG_VERSION:=1.4
+PKG_RELEASE:=0
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/cetic/6lbr.git
+PKG_SOURCE_VERSION:=develop
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_SOURCE_SUBDIR := $(PKG_NAME)
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+6LBR_DIR := $(PKG_BUILD_DIR)/examples/6lbr
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/6lbr
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=CETIC 6LBR
+ MAINTAINER:=Laurent <[email protected]>
+ DEPENDS:=+libncurses +kmod-tun +kmod-usb-serial-ftdi +logrotate
+endef
+
+define Package/6lbr/description
+6LBR
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+ mkdir -p $(6LBR_DIR)/bin
+ $(MAKE) -C $(6LBR_DIR) clean
+ CFLAGS="$(TARGET_CFLAGS)" LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(6LBR_DIR) \
+ TARGET=native CC="$(TARGET_CC)" LD="$(TARGET_CC)" AR="$(TARGET_AR)" V=1 CETIC_6LBR_ROUTER=1 WITH_UDPCLIENT=0
+ mv $(6LBR_DIR)/cetic-6lbr.native $(6LBR_DIR)/bin/cetic_6lbr_router
+ $(MAKE) -C $(6LBR_DIR) clean
+ CFLAGS="$(TARGET_CFLAGS)" LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(6LBR_DIR) \
+ TARGET=native CC="$(TARGET_CC)" LD="$(TARGET_CC)" AR="$(TARGET_AR)" V=1 CETIC_6LBR_SMARTBRIDGE=1 WITH_UDPCLIENT=0
+ mv $(6LBR_DIR)/cetic-6lbr.native $(6LBR_DIR)/bin/cetic_6lbr_smart_bridge
+ $(MAKE) -C $(6LBR_DIR) clean
+ CFLAGS="$(TARGET_CFLAGS)" LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(6LBR_DIR) \
+ CC="$(TARGET_CC)" LD="$(TARGET_CC)" AR="$(TARGET_AR)" V=1 CETIC_6LBR_6LR=1 WITH_UDPCLIENT=1 WITH_UDPSERVER=0
+ mv $(6LBR_DIR)/cetic-6lbr.native $(6LBR_DIR)/bin/cetic_6lbr_6lr
+ $(MAKE) -C $(6LBR_DIR) clean
+ CFLAGS="$(TARGET_CFLAGS)" LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(6LBR_DIR) \
+ TARGET=native CC="$(TARGET_CC)" LD="$(TARGET_CC)" AR="$(TARGET_AR)" V=1 plugins
+ $(MAKE) -C $(6LBR_DIR)/tools clean
+ CFLAGS="$(TARGET_CFLAGS)" LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(6LBR_DIR)/tools \
+ CC="$(TARGET_CC)" LD="$(TARGET_CC)" AR="$(TARGET_AR)" V=1
+endef
+
+define Package/6lbr/install
+ $(INSTALL_DIR) $(1)/etc/6lbr
+ cp -r $(6LBR_DIR)/package/etc/6lbr $(1)/etc
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) $(6LBR_DIR)/openwrt/init.d/* $(1)/etc/init.d/
+ $(INSTALL_DIR) $(1)/etc/logrotate.d
+ $(INSTALL_CONF) $(6LBR_DIR)/openwrt/logrotate.d/* $(1)/etc/logrotate.d/
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(6LBR_DIR)/package/usr/bin/* $(1)/usr/bin/
+ $(INSTALL_DIR) $(1)/usr/lib/6lbr
+ cp -r $(6LBR_DIR)/package/usr/lib/6lbr $(1)/usr/lib
+ $(INSTALL_DIR) $(1)/usr/lib/6lbr/bin
+ $(INSTALL_BIN) $(6LBR_DIR)/bin/* $(1)/usr/lib/6lbr/bin
+ $(INSTALL_BIN) $(6LBR_DIR)/tools/nvm_tool $(1)/usr/lib/6lbr/bin
+ $(MAKE) -C $(6LBR_DIR) DESTDIR=$(1) plugins-install
+endef
+
+define Package/6lbr/postinst
+#!/bin/sh
+# check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+ echo "Enabling rc.d symlink for 6lbr"
+ /etc/init.d/6lbr enable
+ (crontab -l -u root 2>/dev/null; echo "# 01 * * * * logrotate /etc/logrotate.d/6lbr.conf") | crontab -u root -
+ echo "Please, edit file /etc/6lbr/6lbr.conf and enable cron job!"
+fi
+exit 0
+endef
+
+define Package/6lbr/prerm
+#!/bin/sh
+# check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+ echo "Removing rc.d symlink for 6lbr"
+ /etc/init.d/6lbr disable
+ echo "Don't forget to disable cron job!"
+fi
+exit 0
+endef
+
+$(eval $(call BuildPackage,6lbr))
--- /dev/null 2015-12-30 19:47:42.548000000 +0300
+++ package/network/ipv6/6lbr/patches/100-6lbr-mips-big-endian.patch 2015-12-30 23:13:23.135011496 +0300
@@ -0,0 +1,11 @@
+--- a/platform/native/contiki-conf.h
++++ b/platform/native/contiki-conf.h
+@@ -70,7 +70,7 @@ typedef unsigned int uip_stats_t;
+ #define UIP_CONF_MAX_LISTENPORTS 40
+ #define UIP_CONF_BUFFER_SIZE 420
+ #ifndef UIP_CONF_BYTE_ORDER
+-#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
++#define UIP_CONF_BYTE_ORDER UIP_BIG_ENDIAN
+ #endif
+ #define UIP_CONF_TCP_SPLIT 0
+ #define UIP_CONF_LOGGING 0