batman-adv: upgrade package to latest release 2012.0.0
[feed/routing.git] / Makefile
1 #
2 # Copyright (C) 2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id: Makefile 5624 2006-11-23 00:29:07Z nbd $
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=batman-adv
12
13 PKG_VERSION:=2012.0.0
14 BATCTL_VERSION:=2012.0.0
15 PKG_MD5SUM:=f1de23457a47ca4369ee1f0e0b7fc405
16 BATCTL_MD5SUM:=27991c2921e18657c7262e917d45106a
17
18 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
19 PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
20
21 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
22 PKG_BATCTL_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/batctl-$(BATCTL_VERSION)
23
24 include $(INCLUDE_DIR)/package.mk
25 include $(INCLUDE_DIR)/kernel.mk
26
27 define KernelPackage/batman-adv
28 URL:=http://www.open-mesh.org/
29 MAINTAINER:=Marek Lindner <lindner_marek@yahoo.de>
30 SUBMENU:=Network Support
31 DEPENDS:=+kmod-lib-crc16
32 TITLE:=B.A.T.M.A.N. Adv
33 FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX)
34 AUTOLOAD:=$(call AutoLoad,50,batman-adv)
35 endef
36
37 define KernelPackage/batman-adv/description
38 B.A.T.M.A.N. advanced is a kernel module which allows to
39 build layer 2 mesh networks. This package contains the
40 version $(PKG_VERSION) of the kernel module plus its user space
41 configuration & managerment tool batctl.
42 endef
43
44 define KernelPackage/batman-adv/config
45 source "$(SOURCE)/Config.in"
46 endef
47
48 MAKE_BATMAN_ADV_ARGS += \
49 CROSS_COMPILE="$(TARGET_CROSS)" \
50 ARCH="$(LINUX_KARCH)" \
51 PATH="$(TARGET_PATH)" \
52 $(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),EXTRA_CFLAGS="-DCONFIG_BATMAN_ADV_DEBUG") \
53 SUBDIRS="$(PKG_BUILD_DIR)" \
54 LINUX_VERSION="$(LINUX_VERSION)" \
55 REVISION="" modules
56
57 MAKE_BATCTL_ARGS += \
58 CFLAGS="$(TARGET_CFLAGS)" \
59 CCFLAGS="$(TARGET_CFLAGS)" \
60 OFLAGS="$(TARGET_CFLAGS)" \
61 REVISION="" \
62 CC="$(TARGET_CC)" \
63 NODEBUG=1 \
64 UNAME="Linux" \
65 DESTDIR="$(PKG_INSTALL_DIR)" \
66 STRIP="/bin/true" \
67 batctl install
68
69 ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
70 define Download/batctl
71 FILE:=batctl-$(BATCTL_VERSION).tar.gz
72 URL:=$(PKG_SOURCE_URL)
73 MD5SUM:=$(BATCTL_MD5SUM)
74 endef
75 $(eval $(call Download,batctl))
76
77 BATCTL_EXTRACT = tar xzf "$(DL_DIR)/batctl-$(BATCTL_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)"
78 BATCTL_PATCH = $(call Build/DoPatch,"$(PKG_BATCTL_BUILD_DIR)","$(PATCH_DIR)","*batctl*")
79 BATCTL_BUILD = $(MAKE) -C $(PKG_BATCTL_BUILD_DIR) $(MAKE_BATCTL_ARGS)
80 BATCTL_INSTALL = $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl $(1)/usr/sbin/
81 endif
82
83 KPATCH ?= $(PATCH)
84 define Build/DoPatch
85 @if [ -d "$(2)" ]; then \
86 if [ "$$$$(ls $(2) | grep -Ec $(3))" -gt 0 ]; then \
87 $(KPATCH) "$(1)" "$(2)" "$(3)"; \
88 fi; \
89 fi
90 endef
91
92 define Build/Patch
93 $(call Build/DoPatch,"$(PKG_BUILD_DIR)","$(PATCH_DIR)","*batman*")
94 $(BATCTL_EXTRACT)
95 $(BATCTL_PATCH)
96 endef
97
98 define Build/Compile
99 cp $(PKG_BUILD_DIR)/Makefile.kbuild $(PKG_BUILD_DIR)/Makefile
100 $(MAKE) -C "$(LINUX_DIR)" $(MAKE_BATMAN_ADV_ARGS)
101 $(BATCTL_BUILD)
102 endef
103
104 define Build/Clean
105 rm -rf $(BUILD_DIR)/$(PKG_NAME)/
106 endef
107
108 define KernelPackage/batman-adv/install
109 $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/lib/batman-adv $(1)/usr/sbin
110 $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
111 $(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv
112 $(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net
113 $(INSTALL_BIN) ./files/usr/sbin/batman-adv $(1)/usr/sbin
114 $(BATCTL_INSTALL)
115 endef
116
117 $(eval $(call KernelPackage,batman-adv))