[PATCHTEAM] - WING Wireless Mesh Routing Protocol
[packages.git] / net / wing / Makefile
1 #
2 # Copyright (C) 2006-2009 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:=wing
11
12 ifneq ($(CONFIG_WING_STABLE),)
13   PKG_VERSION:=20100805
14   PKG_RELEASE:=1
15   PKG_REV:=21aae2ae5bea85426aded47b055b4fe62c2cea2e
16 else 
17   PKG_VERSION:=$(shell date +%Y%m%d)
18   PKG_RELEASE:=1
19   PKG_REV:=HEAD
20 endif
21
22 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
23 PKG_SOURCE_URL:=http://github.com/create-net/click-wing.git
24 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
25 PKG_SOURCE_VERSION:=$(PKG_REV)
26 PKG_SOURCE_PROTO:=git
27
28 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
29
30 include $(INCLUDE_DIR)/package.mk
31
32 define Package/wing
33   TITLE:=Wireless mesh networking toolkit
34   SECTION:=net
35   CATEGORY:=Network
36   MAINTAINER:=Roberto Riggio (roberto.riggio@create-net.org)
37   DEPENDS:=+kmod-tun
38   URL:=http://www.wing-project.org/
39 endef
40
41 define Package/wing/Description 
42         Wing is a wireless mesh routing software. The routing protocol
43         is derived from Roofnet. It supports multiple radio interfaces and
44         link quality routing using the ETX, ETT, and WCETT metrics.
45 endef 
46
47 define Package/wing/config
48         source "$(SOURCE)/Config.in"
49 endef
50
51 define Build/Configure
52         (cd $(PKG_BUILD_DIR); \
53                 rm -rf config.{cache,status}; \
54                  ./configure \
55                         --prefix=/usr \
56                         --enable-userlevel \
57                         --enable-wifi \
58                         --enable-wing \
59                         --disable-linuxmodule \
60         );
61         $(MAKE) -C $(PKG_BUILD_DIR) tools elementmap.xml
62         (cd $(PKG_BUILD_DIR)/userlevel; \
63                 ../tools/click-mkmindriver/click-mkmindriver -p $(PKG_NAME) -C .. \
64                 -f $(PKG_BUILD_DIR)/conf/wing/sample.click \
65                 -A --all -E Discard -E Print -E Null \
66                 -E InfiniteSource -E RatedSource -E EtherEncap -E UDPIPEncap \
67                 -E AthdescEncap -E AthdescDecap -E RadiotapDecap -E RadiotapEncap \
68                 -E ProbeTXRate -E MadwifiRate -E AutoRateFallback \
69                 -E RoundRobinSched -E DRRSched; \
70         )
71         (cd $(PKG_BUILD_DIR); \
72                 rm -rf config.{cache,status} ; \
73                 $(TARGET_CONFIGURE_OPTS) \
74                 CXXFLAGS="-static -O2 -MD" CFLAGS="-static -MD" \
75                 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
76                 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
77                 ./configure \
78                         --prefix=/usr \
79                         --target=$(GNU_TARGET_NAME) \
80                         --host=$(GNU_TARGET_NAME) \
81                         --build=$(GNU_HOST_NAME) \
82                         --enable-tools=mixed \
83                         --enable-userlevel \
84                         --enable-wifi \
85                         --enable-wing \
86                         --disable-linuxmodule \
87         );
88 endef
89
90 define Build/Compile
91         $(MAKE) -C $(PKG_BUILD_DIR) \
92                 MINDRIVER=$(PKG_NAME) \
93                 DESTDIR="$(PKG_INSTALL_DIR)" \
94                 all install
95 endef
96
97 define Package/wing/install
98         $(INSTALL_DIR) $(1)/usr/bin
99         $(INSTALL_DIR) $(1)/etc/wing
100         $(INSTALL_DIR) $(1)/usr/share/click
101         $(CP) ./files/* $(1)/
102         $(CP) $(PKG_BUILD_DIR)/conf/wing/click_config $(1)/usr/bin/
103         $(CP) $(PKG_BUILD_DIR)/conf/wing/write_handler $(1)/usr/bin/
104         $(CP) $(PKG_BUILD_DIR)/conf/wing/read_handler $(1)/usr/bin/
105         $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME)click $(1)/usr/bin/click
106         $(CP) $(PKG_INSTALL_DIR)/usr/bin/click-align $(1)/usr/bin/click-align
107         $(CP) $(PKG_BUILD_DIR)/conf/wing/*click $(1)/etc/wing/
108         $(CP) $(PKG_INSTALL_DIR)/usr/share/click/elementmap.xml $(1)/usr/share/click/elementmap.xml
109 endef
110
111 $(eval $(call BuildPackage,wing))
112