f3851236f53436ff4cb22b7b18f99099eb9f4384
[packages.git] / net / click / Makefile
1 # Copyright (C) 2006 OpenWrt.org
2 #
3 # This is free software, licensed under the GNU General Public License v2.
4 # See /LICENSE for more information.
5 #
6 # $Id$
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=click
11 PKG_VERSION:=cvs.2006.03.02
12 PKG_RELEASE:=1
13 PKG_MD5SUM:=7aed4ba94926010d76febb797b288e98
14
15 ROOFNET_VERSION:=0.0.1
16
17 PKG_SOURCE_URL:=http://pdos.csail.mit.edu/~jbicket/click_snapshots/
18 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
19 PKG_CAT:=zcat
20
21 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
22 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define Package/click
27   SECTION:=net
28   CATEGORY:=Network
29   DEPENDS:=@BROKEN
30   MENU:=1
31   TITLE:=The Click Modular Router
32   DESCRIPTION:=The Click Modular Router
33   URL:=http://www.read.cs.ucla.edu/click/
34 endef
35
36 define Package/roofnet
37   SECTION:=net
38   CATEGORY:=Network
39   DEPENDS:=@BROKEN click
40   TITLE:=roofnet mesh networking scripts
41   DESCRIPTION:=roofnet mesh networking scripts
42   URL:=http://pdos.csail.mit.edu/roofnet/
43 endef
44
45 BUILDOPTS = \
46                 BUILD_CXX="g++ -I $(PKG_BUILD_DIR)/include-host" \
47                 BUILD_DL_LIBS="-ldl"
48
49 define Build/Configure
50         (cd $(PKG_BUILD_DIR); \
51                 rm -rf config.{cache,status} ; \
52                 CONFIG_SITE= \
53                 ./configure; \
54                 rm -rf include-host; \
55                 $(CP) include include-host; \
56                 rm -rf config.{cache,status} ; \
57                 $(TARGET_CONFIGURE_OPTS) \
58                 CXXFLAGS="-static -Os -MD" \
59                 CFLAGS="-static -MD" \
60                 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
61                 LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
62                 $(BUILDOPTS) \
63                 ./configure \
64                   --prefix=/usr \
65                   --target=$(GNU_TARGET_NAME) \
66                   --host=$(GNU_TARGET_NAME) \
67                   --build=$(GNU_HOST_NAME) \
68                   --enable-wifi \
69                   --disable-linuxmodule \
70                   --enable-tools=mixed \
71                   --disable-dynamic-linking \
72         )
73 endef
74
75
76 define Build/Compile
77         rm -rf $(PKG_INSTALL_DIR)
78         mkdir -p $(PKG_INSTALL_DIR)
79         $(CONF_OPTS) \
80         $(MAKE) -C $(PKG_BUILD_DIR) \
81                 $(BUILDOPTS) \
82                 tools elementmap.xml
83         (cd $(PKG_BUILD_DIR)/userlevel; \
84                 ../tools/click-mkmindriver/click-mkmindriver -p roofnet -C .. \
85                         -f $(PKG_BUILD_DIR)/conf/wifi/sample.click \
86                         -A --all -E IPNameInfo -E FromHost -E ToHost -E Discard; \
87                 $(MAKE) -f Makefile.roofnet; \
88         )
89 endef
90
91 define Package/click/install
92         $(INSTALL_DIR) $(1)/usr/bin
93         $(CP) $(PKG_BUILD_DIR)/userlevel/roofnetclick $(1)/usr/bin/click 
94         $(CP) $(PKG_BUILD_DIR)/tools/click-align/click-align $(1)/usr/bin/click-align
95 endef
96
97 define Package/roofnet/install
98         $(INSTALL_DIR) $(1)/usr/bin
99         $(CP) $(PKG_BUILD_DIR)/conf/wifi/gen_config_roofnet.sh $(1)/usr/bin
100         $(CP) $(PKG_BUILD_DIR)/conf/wifi/srcr.click $(1)/usr/bin
101         $(CP) $(PKG_BUILD_DIR)/conf/wifi/read_handler $(1)/usr/bin
102         $(CP) $(PKG_BUILD_DIR)/conf/wifi/write_handler $(1)/usr/bin
103         mkdir -p $(1)/etc/init.d
104         $(INSTALL_BIN) ./files/roofnet.init $(1)/etc/init.d/roofnet
105 endef
106
107 $(eval $(call BuildPackage,click))
108 $(eval $(call BuildPackage,roofnet))