[packages] This patch adds uanytun a tiny implementaion of SATP the
[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.2
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:=d861328e33ec0d34cccecd9ca2a284b6
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
92
93 ifneq ($(CONFIG_PACKAGE_uanytun-nocrypt),)
94 define Build/Configure/uanytun-nocrypt
95 rm -rf $(PKG_BUILD_DIR)/uanytun-nocrypt
96 mkdir -p $(PKG_BUILD_DIR)/uanytun-nocrypt
97 $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun-nocrypt
98 (cd $(PKG_BUILD_DIR)/uanytun-nocrypt/src; \
99 touch include.mk; \
100 ln -s linux/tun.c . \
101 )
102 endef
103
104 define Build/Compile/uanytun-nocrypt
105 $(MAKE) -C $(PKG_BUILD_DIR)/uanytun-nocrypt/src \
106 $(TARGET_CONFIGURE_OPTS) \
107 NO_CRYPT_OBJ=1 \
108 TARGET=Linux \
109 CFLAGS="$(TARGET_CFLAGS) -DNO_CRYPT" \
110 LDFLAGS="$(TARGET_LDFLAGS) -ldl"
111 $(STRIP) $(PKG_BUILD_DIR)/uanytun-nocrypt/src/uanytun
112 endef
113 endif
114
115 ifneq ($(CONFIG_PACKAGE_uanytun-sslcrypt),)
116 define Build/Configure/uanytun-sslcrypt
117 rm -rf $(PKG_BUILD_DIR)/uanytun-sslcrypt
118 mkdir -p $(PKG_BUILD_DIR)/uanytun-sslcrypt
119 $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun-sslcrypt
120 (cd $(PKG_BUILD_DIR)/uanytun-sslcrypt/src; \
121 touch include.mk; \
122 ln -s linux/tun.c . \
123 )
124 endef
125
126 define Build/Compile/uanytun-sslcrypt
127 $(MAKE) -C $(PKG_BUILD_DIR)/uanytun-sslcrypt/src \
128 $(TARGET_CONFIGURE_OPTS) \
129 TARGET=Linux \
130 CFLAGS="$(TARGET_CFLAGS) -DUSE_SSL_CRYPTO -I$(STAGING_DIR)/usr/include" \
131 LDFLAGS="$(TARGET_LDFLAGS) -ldl -lcrypto"
132 $(STRIP) $(PKG_BUILD_DIR)/uanytun-sslcrypt/src/uanytun
133 endef
134 endif
135
136 ifneq ($(CONFIG_PACKAGE_uanytun),)
137 define Build/Configure/uanytun-default
138 rm -rf $(PKG_BUILD_DIR)/uanytun
139 mkdir -p $(PKG_BUILD_DIR)/uanytun
140 $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun
141 (cd $(PKG_BUILD_DIR)/uanytun/src; \
142 touch include.mk; \
143 ln -s linux/tun.c . \
144 )
145 endef
146
147 define Build/Compile/uanytun-default
148 $(MAKE) -C $(PKG_BUILD_DIR)/uanytun/src \
149 $(TARGET_CONFIGURE_OPTS) \
150 TARGET=Linux \
151 CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
152 LDFLAGS="$(TARGET_LDFLAGS) -ldl -lgcrypt -lgpg-error"
153 $(STRIP) $(PKG_BUILD_DIR)/uanytun/src/uanytun
154 endef
155 endif
156
157
158 define Build/Configure
159 $(call Build/Configure/uanytun-nocrypt)
160 $(call Build/Configure/uanytun-sslcrypt)
161 $(call Build/Configure/uanytun-default)
162 endef
163
164 define Build/Compile
165 $(call Build/Compile/uanytun-nocrypt)
166 $(call Build/Compile/uanytun-sslcrypt)
167 $(call Build/Compile/uanytun-default)
168 endef
169
170 define Build/Clean
171 rm -rf $(PKG_BUILD_DIR)/uanytun-nocrypt
172 rm -rf $(PKG_BUILD_DIR)/uanytun-sslcrypt
173 rm -rf $(PKG_BUILD_DIR)/uanytun
174 endef
175
176
177
178 define Package/uanytun/install-generic
179 $(INSTALL_DIR) $(1)/etc/config
180 $(INSTALL_DATA) ./files/$(3) $(1)/etc/config/$(2)
181 $(INSTALL_DIR) $(1)/usr/sbin
182 $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(2)/src/uanytun $(1)/usr/sbin/$(2)
183 $(INSTALL_DIR) $(1)/etc/init.d
184 $(INSTALL_BIN) ./files/uanytun.init $(1)/etc/init.d/$(2)
185 @sed -e 's/BIN=uanytun/BIN=$(2)/' -i $(1)/etc/init.d/$(2)
186 endef
187
188 define Package/uanytun/install
189 $(call Package/uanytun/install-generic,$(1),uanytun,uanytun.config)
190 endef
191
192 define Package/uanytun-sslcrypt/install
193 $(call Package/uanytun/install-generic,$(1),uanytun-sslcrypt,uanytun.config)
194 endef
195
196 define Package/uanytun-nocrypt/install
197 $(call Package/uanytun/install-generic,$(1),uanytun-nocrypt,uanytun-nocrypt.config)
198 endef
199
200
201
202 $(eval $(call BuildPackage,uanytun))
203 $(eval $(call BuildPackage,uanytun-sslcrypt))
204 $(eval $(call BuildPackage,uanytun-nocrypt))