summaryrefslogtreecommitdiff
path: root/openwrt/kamikaze/uanytun/Makefile
blob: 045e75988d1e7d721e1f99af744dc3f142863e5f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# 
# Copyright (C) 2008 Christian Pointner,
#                    <equinox@anytun.org>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# This Makefile builds uAnytun Package for OpenWRT
#
# $Id: $

include $(TOPDIR)/rules.mk

PKG_NAME:=uanytun
PKG_VERSION:=0.3-rc1
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.anytun.org/~equinox/
PKG_MD5SUM:=97854b33081f7685ff174db4c7083d8e

PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install

include $(INCLUDE_DIR)/package.mk

define Package/uanytun/template
  SECTION:=net
  CATEGORY:=Network
  TITLE:=micro anycast tunneling daemon
  URL:=http://www.anytun.org/
  MAINTAINER:=Christian Pointner <equinox@anytun.org>
  SUBMENU:=VPN
endef

define Package/uanytun/desc-template
uAnytun is a tiny implementation of SATP. Unlike Anytun which is a full
  featured implementation uAnytun has no support for multiple connections
  or synchronisation. It is a small single threaded implementation intended
  to act as a client on small platforms.
endef

define Package/uanytun
  $(call Package/uanytun/template)
  DEPENDS:=+kmod-tun +libgcrypt
endef

define Package/uanytun/conffiles
/etc/config/uanytun
endef

define Package/uanytun/description
  $(call Package/uanytun/desc-template)
endef


define Package/uanytun-sslcrypt
  $(call Package/uanytun/template)
  DEPENDS:=+kmod-tun +libopenssl
endef

define Package/uanytun-sslcrypt/conffiles
/etc/config/uanytun-sslcrypt
endef

define Package/uanytun-sslcrypt/description
  $(call Package/uanytun/desc-template)
endef


define Package/uanytun-nocrypt
  $(call Package/uanytun/template)
  DEPENDS:=+kmod-tun
endef

define Package/uanytun-nocrypt/conffiles
/etc/config/uanytun-nocrypt
endef

define Package/uanytun-nocrypt/description
  $(call Package/uanytun/desc-template)
endef



define Build/Configure
  (cd $(PKG_BUILD_DIR)/src; \
    touch include.mk; \
    ln -s linux/tun.c . \
  )
endef

define Build/Compile
  rm -rf $(PKG_INSTALL_DIR)
  mkdir -p $(PKG_INSTALL_DIR) 

  $(MAKE) -C $(PKG_BUILD_DIR)/src \
    $(TARGET_CONFIGURE_OPTS) \
    NO_CRYPT_OBJ=1 \
    TARGET=Linux \
    CFLAGS="$(TARGET_CFLAGS) -DNO_CRYPT" \
    LDFLAGS="$(TARGET_LDFLAGS) -ldl" 
  cp $(PKG_BUILD_DIR)/src/uanytun $(PKG_BUILD_DIR)/src/uanytun-nocrypt
  $(MAKE) -C $(PKG_BUILD_DIR)/src clean

  $(MAKE) -C $(PKG_BUILD_DIR)/src \
    $(TARGET_CONFIGURE_OPTS) \
    TARGET=Linux \
    CFLAGS="$(TARGET_CFLAGS) -DUSE_SSL_CRYPTO -I$(STAGING_DIR)/usr/include" \
    LDFLAGS="$(TARGET_LDFLAGS) -ldl -lcrypto" 
  cp $(PKG_BUILD_DIR)/src/uanytun $(PKG_BUILD_DIR)/src/uanytun-sslcrypt
  $(MAKE) -C $(PKG_BUILD_DIR)/src clean

  $(MAKE) -C $(PKG_BUILD_DIR)/src \
    $(TARGET_CONFIGURE_OPTS) \
    TARGET=Linux \
    CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
    LDFLAGS="$(TARGET_LDFLAGS) -ldl -lgcrypt -lgpgerror" 

  $(STRIP) $(PKG_BUILD_DIR)/src/uanytun-nocrypt
  $(STRIP) $(PKG_BUILD_DIR)/src/uanytun-sslcrypt
  $(STRIP) $(PKG_BUILD_DIR)/src/uanytun
endef



define Package/uanytun/install-generic
  $(INSTALL_DIR) $(1)/etc/config
  $(INSTALL_DATA) ./files/$(3) $(1)/etc/config/$(2)
  $(INSTALL_DIR) $(1)/usr/sbin
  $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/$(2) $(1)/usr/sbin/
  $(INSTALL_DIR) $(1)/etc/init.d
  $(INSTALL_BIN) ./files/uanytun.init $(1)/etc/init.d/$(2)
  sed -e 's/BIN=uanytun/BIN=$(2)/' -i $(1)/etc/init.d/$(2)
endef

define Package/uanytun/install
  $(call Package/uanytun/install-generic, $(1), uanytun, uanytun.config)
endef

define Package/uanytun-sslcrypt/install
  $(call Package/uanytun/install-generic, $(1), uanytun-sslcrypt, uanytun.config)
endef

define Package/uanytun-nocrypt/install
  $(call Package/uanytun/install-generic, $(1), uanytun-nocrypt, uanytun-nocrypt.config)
endef



$(eval $(call BuildPackage,uanytun))
$(eval $(call BuildPackage,uanytun-sslcrypt))
$(eval $(call BuildPackage,uanytun-nocrypt))