wing: Attempt to fix cross compile issues.
[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:=20100903
14         PKG_RELEASE:=4
15         PKG_REV:=520e3168a5af4d26bec3779cfa4901d128a4bc6f
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 PKG_INSTALL:=1
30
31 include $(INCLUDE_DIR)/package.mk
32
33 define Package/wing
34         TITLE:=Wireless mesh networking toolkit
35         SECTION:=net
36         CATEGORY:=Network
37         MAINTAINER:=Roberto Riggio <roberto.riggio@create-net.org>
38         DEPENDS:=+kmod-tun
39         URL:=http://www.wing-project.org/
40 endef
41
42 define Package/wing/Description 
43         Wing is a wireless mesh routing software. The routing protocol
44         is derived from Roofnet. It supports multiple radio interfaces and
45         link quality routing using the ETX, ETT, and WCETT metrics.
46 endef 
47
48 define Package/wing/config
49         source "$(SOURCE)/Config.in"
50 endef
51
52 EXTRA_LDFLAGS:=-ldl
53
54 MAKE_FLAGS+=\
55         V=1 \
56         MINDRIVER=$(PKG_NAME) \
57         BUILD_CC=$(TARGET_CC) \
58         BUILD_CXX=$(TARGET_CXX)
59
60 HOST_MAKE_FLAGS:=\
61         V=1 \
62         MINDRIVER=$(PKG_NAME)
63
64 define Build/Configure
65         (cd $(PKG_BUILD_DIR); \
66                 rm -rf config.{cache,status}; \
67                  ./configure \
68                         --prefix=/usr \
69                         --enable-userlevel \
70                         --enable-wifi \
71                         --enable-wing \
72                         --disable-linuxmodule \
73         );
74         $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(HOST_MAKE_FLAGS) tools
75         $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(HOST_MAKE_FLAGS) elementmap.xml
76         $(CP) $(PKG_BUILD_DIR)/tools/click-mkmindriver/click-mkmindriver $(PKG_BUILD_DIR)/
77         rm -rf $(PKG_BUILD_DIR)/config.{cache,status}
78         $(call Build/Configure/Default, \
79                 --enable-tools=mixed \
80                 --enable-userlevel \
81                 --enable-wifi \
82                 --enable-wing \
83                 --disable-linuxmodule \
84         )
85         (cd $(PKG_BUILD_DIR)/userlevel; \
86                 ../click-mkmindriver -p $(PKG_NAME) -C .. \
87                 -f $(PKG_BUILD_DIR)/conf/wing/sample.click \
88                 -A --all -E Discard -E Print -E Null \
89                 -E InfiniteSource -E RatedSource -E EtherEncap -E UDPIPEncap \
90                 -E RadiotapDecap -E RadiotapEncap \
91                 -E ProbeTXRate -E MadwifiRate -E AutoRateFallback \
92                 -E RoundRobinSched -E DRRSched; \
93         )
94 endef
95
96 define Package/wing/install
97         $(INSTALL_DIR) $(1)/usr/bin
98         $(INSTALL_DIR) $(1)/etc/wing
99         $(INSTALL_DIR) $(1)/usr/share/click
100         $(CP) ./files/* $(1)/
101         $(CP) $(PKG_BUILD_DIR)/conf/wing/click_config $(1)/usr/bin/
102         $(CP) $(PKG_BUILD_DIR)/conf/wing/write_handler $(1)/usr/bin/
103         $(CP) $(PKG_BUILD_DIR)/conf/wing/read_handler $(1)/usr/bin/
104         $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME)click $(1)/usr/bin/click
105         $(CP) $(PKG_INSTALL_DIR)/usr/bin/click-align $(1)/usr/bin/click-align
106         $(CP) $(PKG_BUILD_DIR)/conf/wing/*click $(1)/etc/wing/
107         $(CP) $(PKG_INSTALL_DIR)/usr/share/click/elementmap.xml $(1)/usr/share/click/elementmap.xml
108 endef
109
110 $(eval $(call BuildPackage,wing))
111