Added batman experimental: net/bmxd (#3457)
authorSteven Barth <cyrus@openwrt.org>
Mon, 19 May 2008 18:50:34 +0000 (18:50 +0000)
committerSteven Barth <cyrus@openwrt.org>
Mon, 19 May 2008 18:50:34 +0000 (18:50 +0000)
SVN-Revision: 11216

net/bmxd/Makefile [new file with mode: 0644]
net/bmxd/files/etc/config/bmxd [new file with mode: 0644]
net/bmxd/files/etc/init.d/bmxd [new file with mode: 0644]
net/bmxd/patches/001-makefile-fix.patch [new file with mode: 0644]

diff --git a/net/bmxd/Makefile b/net/bmxd/Makefile
new file mode 100644 (file)
index 0000000..16733e0
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# Copyright (C) 2008 Freifunk Leipzig
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id$
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=bmxd
+PKG_SOURCE_URL:=http://downloads.open-mesh.net/svn/batman/trunk/batman-experimental/
+
+PKG_REV:=$(shell LC_ALL=C svn info $(PKG_SOURCE_URL) | sed -ne 's/^Last Changed Rev: //p')
+PKG_VERSION:=r$(PKG_REV)
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=svn
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
+PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bmxd/Default
+  URL:=https://www.open-mesh.net/
+endef
+
+define Package/bmxd
+$(call Package/bmxd/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpthread +kmod-tun
+  TITLE:=B.A.T.M.A.N. Experimental (BMX) layer 3 routing daemon
+endef
+
+define Package/bmxd/description
+B.A.T.M.A.N. Experimental (BMX) layer 3 routing daemon
+endef
+
+MAKE_ARGS += \
+       EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
+       CCFLAGS="$(TARGET_CFLAGS)" \
+       OFLAGS="$(TARGET_CFLAGS)" \
+       REVISION="$(PKG_REV)" \
+       CC="$(TARGET_CC)" \
+       NODEBUG=1 \
+       UNAME="Linux" \
+       INSTALL_DIR="$(PKG_INSTALL_DIR)" \
+       STRIP="/bin/true" \
+       batmand install
+
+define Build/Configure
+       mkdir -p $(PKG_INSTALL_DIR)/bin
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS)
+endef
+
+define Package/bmxd/install
+       $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/batmand $(1)/usr/sbin/bmxd
+       $(INSTALL_BIN) ./files/etc/init.d/bmxd $(1)/etc/init.d
+       $(INSTALL_DATA) ./files/etc/config/bmxd $(1)/etc/config
+endef
+
+$(eval $(call BuildPackage,bmxd))
diff --git a/net/bmxd/files/etc/config/bmxd b/net/bmxd/files/etc/config/bmxd
new file mode 100644 (file)
index 0000000..ad14d17
--- /dev/null
@@ -0,0 +1,10 @@
+config bmxd general
+       option interface                ath0
+       option announce                 
+       option gateway_class            
+       option originator_interval
+       option preferred_gateway        
+       option routing_class
+       option visualisation_srv
+       option policy_routing_script
+       
diff --git a/net/bmxd/files/etc/init.d/bmxd b/net/bmxd/files/etc/init.d/bmxd
new file mode 100644 (file)
index 0000000..9eb1095
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/sh /etc/rc.common
+START=91
+. /lib/config/uci.sh
+uci_load bmxd
+start () {
+       interface=$(uci get bmxd.general.interface)
+       if [ "$interface" = "" ]; then
+               echo $1 Error, you must specify at least a network interface
+               exit
+       fi
+       announce=$(uci get bmxd.general.announce)
+       gateway_class=$(uci get bmxd.general.gateway_class)
+       originator_interval=$(uci get bmxd.general.originator_interval)
+       preferred_gateway=$(uci get bmxd.general.preferred_gateway)
+       routing_class=$(uci get bmxd.general.routing_class)
+       visualisation_srv=$(uci get bmxd.general.visualisation_srv)
+       policy_routing_script=$(uci get bmxd.general.policy_routing_script)
+       bmx_args=""
+
+       if [ $announce ]; then
+               bmx_args=${bmx_args}'-a '$announce' '
+       fi
+
+       if [ $gateway_class ]; then
+               bmx_args=${bmx_args}'-g '$gateway_class' '
+       fi
+
+       if [ $originator_interval ]; then
+               bmx_args=${bmx_args}'-o '$originator_interval' '
+       fi
+
+       if [ $preferred_gateway ]; then
+               bmx_args=${bmx_args}'-p '$preferred_gateway' '
+       fi
+
+       if [ $routing_class ]; then
+               bmx_args=${bmx_args}'-r '$routing_class' '
+       fi
+               
+       if [ $visualisation_srv ]; then
+               bmx_args=${bmx_args}'-s '$visualisation_srv' '
+       fi
+       
+       if [ $policy_routing_script ]; then
+               bmx_args=${bmx_args}'--policy-routing-script '$policy_routing_script' '
+       fi
+
+       bmx_args=${bmx_args}$interface
+       bmxd $bmx_args >/dev/null 2>&1
+}
+
+restart () {
+       $0 stop
+       sleep 3
+       $0 start
+}
+        
+stop () {
+       killall bmxd
+}
diff --git a/net/bmxd/patches/001-makefile-fix.patch b/net/bmxd/patches/001-makefile-fix.patch
new file mode 100644 (file)
index 0000000..2c47db4
--- /dev/null
@@ -0,0 +1,21 @@
+diff -urb bmxd-r1042.orig/Makefile bmxd-r1042/Makefile
+--- bmxd-r1042.orig/Makefile   2008-05-08 00:07:50.000000000 +0200
++++ bmxd-r1042/Makefile        2008-05-08 00:07:16.000000000 +0200
+@@ -19,11 +19,15 @@
+ # CC =                gcc
+-CFLAGS =      -Wall -O1 -g -pg
++# JoW: "-pg" results in "gcrt1.o: No such file" ?!
++#CFLAGS =     -Wall -O1 -g -pg
++CFLAGS =      -Wall -O1 -g
+ #-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA
+-LDFLAGS =     -lpthread -static -g -pg
++# JoW: "-pg" results in "gcrt1.o: No such file" ?!
++#LDFLAGS =    -lpthread -static -g -pg
++LDFLAGS =     -lpthread -static -g
+ #STRIP=                       strip