Merge pull request #349 from ecsv/batadv-2018.0
[feed/routing.git] / batman-adv / 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
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=batman-adv
11
12 PKG_VERSION:=2018.0
13 PKG_RELEASE:=0
14 PKG_MD5SUM:=c39d67cdb5509bf638efc9083e0dd41e
15 PKG_HASH:=4826f838e8a2914a9470da25ea2f17f6325c464a130093b20dc7fb4e93f7576c
16
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
18 PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
19 PKG_LICENSE:=GPL-2.0
20
21 include $(INCLUDE_DIR)/kernel.mk
22 include $(INCLUDE_DIR)/package.mk
23
24 define KernelPackage/batman-adv
25 URL:=https://www.open-mesh.org/
26 MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
27 SUBMENU:=Network Support
28 DEPENDS:=+KMOD_BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-crypto-crc32c +kmod-lib-crc32c +kmod-cfg80211
29 TITLE:=B.A.T.M.A.N. Adv
30 FILES:=$(PKG_BUILD_DIR)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX)
31 AUTOLOAD:=$(call AutoLoad,50,cfg80211 batman-adv)
32 endef
33
34 define KernelPackage/batman-adv/description
35 B.A.T.M.A.N. advanced is a kernel module which allows to
36 build layer 2 mesh networks. This package builds
37 version $(PKG_VERSION) of the kernel module.
38 endef
39
40 define KernelPackage/batman-adv/config
41 source "$(SOURCE)/Config.in"
42 endef
43
44 define Package/kmod-batman-adv/conffiles
45 /etc/config/batman-adv
46 endef
47
48 PKG_EXTRA_KCONFIG:= \
49 CONFIG_BATMAN_ADV=m \
50 CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),y,n) \
51 CONFIG_BATMAN_ADV_DEBUGFS=$(if $(CONFIG_KMOD_BATMAN_ADV_DEBUGFS),y,n) \
52 CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_KMOD_BATMAN_ADV_BLA),y,n) \
53 CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_KMOD_BATMAN_ADV_DAT),y,n) \
54 CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_KMOD_BATMAN_ADV_MCAST),y,n) \
55 CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_KMOD_BATMAN_ADV_NC),y,n) \
56 CONFIG_BATMAN_ADV_BATMAN_V=$(if $(CONFIG_KMOD_BATMAN_ADV_BATMAN_V),y,n) \
57
58 PKG_EXTRA_CFLAGS:= \
59 $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \
60 $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \
61
62 NOSTDINC_FLAGS = \
63 -I$(PKG_BUILD_DIR)/net/batman-adv \
64 -I$(STAGING_DIR)/usr/include/mac80211-backport \
65 -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
66 -I$(STAGING_DIR)/usr/include/mac80211 \
67 -I$(STAGING_DIR)/usr/include/mac80211/uapi \
68 -I$(PKG_BUILD_DIR)/include/ \
69 -include backport/backport.h \
70 -include $(PKG_BUILD_DIR)/compat-hacks.h
71
72 COMPAT_SOURCES = \
73 $(if $(CONFIG_KMOD_BATMAN_ADV_MCAST),../../compat-sources/net/core/skbuff.o,) \
74 $(if $(CONFIG_KMOD_BATMAN_ADV_MCAST),../../compat-sources/net/ipv4/igmp.o,) \
75 $(if $(CONFIG_KMOD_BATMAN_ADV_MCAST),../../compat-sources/net/ipv6/mcast_snoop.o,) \
76
77 define Build/Compile
78 +env "batman-adv-y=$(COMPAT_SOURCES)" \
79 $(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
80 ARCH="$(LINUX_KARCH)" \
81 CROSS_COMPILE="$(TARGET_CROSS)" \
82 SUBDIRS="$(PKG_BUILD_DIR)/net/batman-adv" \
83 $(PKG_EXTRA_KCONFIG) \
84 EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS)" \
85 NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
86 modules
87 endef
88
89 define Build/Prepare
90 $(call Build/Prepare/Default)
91 $(CP) ./files/compat-hacks.h $(PKG_BUILD_DIR)/
92 endef
93
94 define Build/Clean
95 rm -rf $(BUILD_DIR)/$(PKG_NAME)/
96 endef
97
98 define KernelPackage/batman-adv/install
99 $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(1)/lib/batman-adv $(1)/usr/sbin $(1)/lib/netifd/proto
100 $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
101 $(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv
102 $(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net
103 $(INSTALL_BIN) ./files/lib/netifd/proto/batadv.sh $(1)/lib/netifd/proto
104 $(INSTALL_BIN) ./files/lib/netifd/proto/batadv_vlan.sh $(1)/lib/netifd/proto
105 endef
106
107 $(eval $(call KernelPackage,batman-adv))