packages/uanytun: fix whitespaces
[openwrt/svn-archive/archive.git] / net / uanytun / Makefile
1 #
2 # Copyright (C) 2008 Christian Pointner,
3 # <equinox@anytun.org>
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8 # This Makefile builds uAnytun Package for OpenWRT
9 #
10 # $Id: $
11
12 include $(TOPDIR)/rules.mk
13
14 PKG_NAME:=uanytun
15 PKG_VERSION:=0.3.3
16 PKG_RELEASE:=1
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
20 PKG_SOURCE_URL:=http://www.anytun.org/download/
21 PKG_MD5SUM:=ca39dab02e91b0737e2b3f0839e74f6a
22
23 include $(INCLUDE_DIR)/package.mk
24
25
26 define Package/uanytun/template
27 SECTION:=net
28 CATEGORY:=Network
29 TITLE:=micro anycast tunneling daemon
30 URL:=http://www.anytun.org/
31 MAINTAINER:=Christian Pointner <equinox@anytun.org>
32 SUBMENU:=VPN
33 endef
34
35 define Package/uanytun/desc-template
36 uAnytun is a tiny implementation of SATP the secure anycast tunneling protocol.
37 SATP defines a protocol used for communication between any combination of
38 unicast and anycast tunnel endpoints. It has less protocol overhead than
39 IPSec in Tunnel mode and allows tunneling of every ETHER TYPE protocol (e.g.
40 ethernet, ip, arp ...). SATP directly includes cryptography and message
41 authentication based on the methodes used by SRTP. It is intended to deliver
42 a generic, scaleable and secure solution for tunneling and relaying of packets
43 of any protocol.
44 Unlike Anytun which is a full featured implementation uAnytun has no support
45 for multiple connections or synchronisation. It is a small single threaded
46 implementation intended to act as a client on small platforms.
47 endef
48
49
50 define Package/uanytun
51 $(call Package/uanytun/template)
52 DEPENDS:=+kmod-tun +libgcrypt
53 endef
54
55 define Package/uanytun/conffiles
56 /etc/config/uanytun
57 endef
58
59 define Package/uanytun/description
60 $(call Package/uanytun/desc-template)
61 endef
62
63
64 define Package/uanytun-sslcrypt
65 $(call Package/uanytun/template)
66 DEPENDS:=+kmod-tun +libopenssl
67 endef
68
69 define Package/uanytun-sslcrypt/conffiles
70 /etc/config/uanytun-sslcrypt
71 endef
72
73 define Package/uanytun-sslcrypt/description
74 $(call Package/uanytun/desc-template)
75 endef
76
77
78 define Package/uanytun-nocrypt
79 $(call Package/uanytun/template)
80 DEPENDS:=+kmod-tun
81 endef
82
83 define Package/uanytun-nocrypt/conffiles
84 /etc/config/uanytun-nocrypt
85 endef
86
87 define Package/uanytun-nocrypt/description
88 $(call Package/uanytun/desc-template)
89 endef
90
91 define Package/uanytun/configure
92 (cd $(1)/$(2)/src; \
93 touch include.mk; \
94 ln -s linux/tun.c .; \
95 echo '#ifndef UANYTUN_version_h_INCLUDED' > version.h; \
96 echo '#define UANYTUN_version_h_INCLUDED' >> version.h; \
97 echo '' >> version.h; \
98 echo '#define VERSION_STRING_0 "uanytun version '`cat $(1)/version`'"' >> version.h; \
99 echo '#define VERSION_STRING_1 "built on '`hostname`', '`date +"%d.%m.%Y %H:%M:%S %Z"`'"' >> version.h; \
100 echo '' >> version.h; \
101 echo '#endif' >> version.h \
102 )
103 endef
104
105 ifneq ($(CONFIG_PACKAGE_uanytun-nocrypt),)
106 define Build/Configure/uanytun-nocrypt
107 rm -rf $(PKG_BUILD_DIR)/uanytun-nocrypt
108 mkdir -p $(PKG_BUILD_DIR)/uanytun-nocrypt
109 $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun-nocrypt
110 $(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun-nocrypt)
111 endef
112
113 define Build/Compile/uanytun-nocrypt
114 $(MAKE) -C $(PKG_BUILD_DIR)/uanytun-nocrypt/src \
115 $(TARGET_CONFIGURE_OPTS) \
116 NO_CRYPT_OBJ=1 \
117 TARGET=Linux \
118 CFLAGS="$(TARGET_CFLAGS) -DNO_CRYPT" \
119 LDFLAGS="$(TARGET_LDFLAGS) -ldl"
120 $(STRIP) $(PKG_BUILD_DIR)/uanytun-nocrypt/src/uanytun
121 endef
122 endif
123
124 ifneq ($(CONFIG_PACKAGE_uanytun-sslcrypt),)
125 define Build/Configure/uanytun-sslcrypt
126 rm -rf $(PKG_BUILD_DIR)/uanytun-sslcrypt
127 mkdir -p $(PKG_BUILD_DIR)/uanytun-sslcrypt
128 $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun-sslcrypt
129 $(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun-sslcrypt)
130 endef
131
132 define Build/Compile/uanytun-sslcrypt
133 $(MAKE) -C $(PKG_BUILD_DIR)/uanytun-sslcrypt/src \
134 $(TARGET_CONFIGURE_OPTS) \
135 TARGET=Linux \
136 CFLAGS="$(TARGET_CFLAGS) -DUSE_SSL_CRYPTO -I$(STAGING_DIR)/usr/include" \
137 LDFLAGS="$(TARGET_LDFLAGS) -ldl -lcrypto"
138 $(STRIP) $(PKG_BUILD_DIR)/uanytun-sslcrypt/src/uanytun
139 endef
140 endif
141
142 ifneq ($(CONFIG_PACKAGE_uanytun),)
143 define Build/Configure/uanytun-default
144 rm -rf $(PKG_BUILD_DIR)/uanytun
145 mkdir -p $(PKG_BUILD_DIR)/uanytun
146 $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun
147 $(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun)
148 endef
149
150 define Build/Compile/uanytun-default
151 $(MAKE) -C $(PKG_BUILD_DIR)/uanytun/src \
152 $(TARGET_CONFIGURE_OPTS) \
153 TARGET=Linux \
154 CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
155 LDFLAGS="$(TARGET_LDFLAGS) -ldl -lgcrypt -lgpg-error"
156 $(STRIP) $(PKG_BUILD_DIR)/uanytun/src/uanytun
157 endef
158 endif
159
160
161 define Build/Configure
162 $(call Build/Configure/uanytun-nocrypt)
163 $(call Build/Configure/uanytun-sslcrypt)
164 $(call Build/Configure/uanytun-default)
165 endef
166
167 define Build/Compile
168 $(call Build/Compile/uanytun-nocrypt)
169 $(call Build/Compile/uanytun-sslcrypt)
170 $(call Build/Compile/uanytun-default)
171 endef
172
173 define Build/Clean
174 rm -rf $(PKG_BUILD_DIR)/uanytun-nocrypt
175 rm -rf $(PKG_BUILD_DIR)/uanytun-sslcrypt
176 rm -rf $(PKG_BUILD_DIR)/uanytun
177 endef
178
179
180
181 define Package/uanytun/install-generic
182 $(INSTALL_DIR) $(1)/etc/config
183 $(INSTALL_DATA) ./files/$(3) $(1)/etc/config/$(2)
184 $(INSTALL_DIR) $(1)/usr/sbin
185 $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(2)/src/uanytun $(1)/usr/sbin/$(2)
186 $(INSTALL_DIR) $(1)/etc/init.d
187 $(INSTALL_BIN) ./files/uanytun.init $(1)/etc/init.d/$(2)
188 @sed -e 's/BIN=uanytun/BIN=$(2)/' -i $(1)/etc/init.d/$(2)
189 endef
190
191 define Package/uanytun/install
192 $(call Package/uanytun/install-generic,$(1),uanytun,uanytun.config)
193 endef
194
195 define Package/uanytun-sslcrypt/install
196 $(call Package/uanytun/install-generic,$(1),uanytun-sslcrypt,uanytun.config)
197 endef
198
199 define Package/uanytun-nocrypt/install
200 $(call Package/uanytun/install-generic,$(1),uanytun-nocrypt,uanytun-nocrypt.config)
201 endef
202
203
204
205 $(eval $(call BuildPackage,uanytun))
206 $(eval $(call BuildPackage,uanytun-sslcrypt))
207 $(eval $(call BuildPackage,uanytun-nocrypt))