[packages/openvpn-devel] rework openvpn-devel package
[openwrt/svn-archive/archive.git] / net / openvpn-devel / Makefile
1 #
2 # Copyright (C) 2010-2012 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:=openvpn-devel
11
12 PKG_REV:=10b4b65e0318ce305e05cdec4b44b8f6bcd3915f
13 PKG_VERSION:=r$(PKG_REV)
14 PKG_RELEASE=1
15
16 PKG_SOURCE_PROTO:=git
17 PKG_SOURCE_URL:=git://openvpn.git.sourceforge.net/gitroot/openvpn/openvpn.git
18 PKG_SOURCE_VERSION:=$(PKG_REV)
19 PKG_SOURCE:=openvpn-$(PKG_VERSION).tar.gz
20 PKG_SOURCE_SUBDIR:=openvpn-$(PKG_VERSION)
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/openvpn-$(PKG_VERSION)
23
24 PKG_INSTALL:=1
25 PKG_FIXUP:=autoreconf
26 PKG_BUILD_PARALLEL:=1
27
28 include $(INCLUDE_DIR)/package.mk
29
30 define Package/openvpn-devel/Default
31 TITLE:=Open source VPN solution using $(2)
32 SECTION:=net
33 CATEGORY:=Network
34 URL:=http://openvpn.net
35 SUBMENU:=VPN
36 MENU:=1
37 DEPENDS:=+kmod-tun +OPENVPN_DEVEL_$(1)_ENABLE_LZO:liblzo +OPENVPN_DEVEL_$(1)_ENABLE_IPROUTE2:ip $(3)
38 VARIANT:=$(1)
39 MAINTAINER:=Mirko Vogt <mirko@openwrt.org>
40 endef
41
42 Package/openvpn-devel-openssl=$(call Package/openvpn-devel/Default,openssl,OpenSSL,+libopenssl)
43 Package/openvpn-devel-polarssl=$(call Package/openvpn-devel/Default,polarssl,PolarSSL,+libpolarssl)
44 Package/openvpn-devel-nossl=$(call Package/openvpn-devel/Default,nossl,plaintext (no SSL))
45
46 define Package/openvpn-devel/config/Default
47 source "$(SOURCE)/Config-$(1).in"
48 endef
49
50 Package/openvpn-devel-openssl/config=$(call Package/openvpn-devel/config/Default,openssl)
51 Package/openvpn-devel-polarssl/config=$(call Package/openvpn-devel/config/Default,polarssl)
52 Package/openvpn-devel-nossl/config=$(call Package/openvpn-devel/config/Default,nossl)
53
54 #define Package/openvpn-devel-easy-rsa
55 # $(call Package/openvpn-devel-openssl)
56 # DEPENDS:=+openssl-util
57 # TITLE:=Simple shell scripts to manage a Certificate Authority
58 #endef
59
60 #define Package/openvpn-devel-easy-rsa/conffiles
61 #/etc/easy-rsa/keys/serial
62 #/etc/easy-rsa/keys/index.txt
63 #/etc/easy-rsa/vars
64 #endef
65
66
67 ifeq ($(BUILD_VARIANT),polarssl)
68 CONFIG_OPENVPN_DEVEL_POLARSSL:=y
69 endif
70 ifeq ($(BUILD_VARIANT),openssl)
71 CONFIG_OPENVPN_DEVEL_OPENSSL:=y
72 endif
73 ifeq ($(BUILD_VARIANT),nossl)
74 CONFIG_OPENVPN_DEVEL_NOSSL:=y
75 endif
76
77 CONFIGURE_VARS += \
78 IFCONFIG=/sbin/ifconfig \
79 ROUTE=/sbin/route \
80 IPROUTE=/usr/sbin/ip \
81 NETSTAT=/sbin/netstat
82
83 define Build/Configure
84 $(call Build/Configure/Default, \
85 --enable-small \
86 --disable-selinux \
87 --disable-systemd \
88 --disable-plugins \
89 --disable-debug \
90 --disable-eurephia \
91 --disable-pkcs11 \
92 $(if $(CONFIG_OPENVPN_DEVEL_$(BUILD_VARIANT)_ENABLE_LZO),--enable,--disable)-lzo \
93 $(if $(CONFIG_OPENVPN_DEVEL_$(BUILD_VARIANT)_ENABLE_CRYPTO),--enable,--disable)-crypto \
94 $(if $(CONFIG_OPENVPN_DEVEL_$(BUILD_VARIANT)_ENABLE_X509_ALT_USERNAME),enable,disable-x509-alt-username)-ssl \
95 $(if $(CONFIG_OPENVPN_DEVEL_$(BUILD_VARIANT)_ENABLE_SERVER),--enable,--disable)-server \
96 $(if $(CONFIG_OPENVPN_DEVEL_$(BUILD_VARIANT)_ENABLE_MANAGEMENT),--enable,--disable)-management \
97 $(if $(CONFIG_OPENVPN_DEVEL_$(BUILD_VARIANT)_ENABLE_SOCKS),--enable,--disable)-socks \
98 $(if $(CONFIG_OPENVPN_DEVEL_$(BUILD_VARIANT)_ENABLE_HTTP),--enable,--disable)-http \
99 $(if $(CONFIG_OPENVPN_DEVEL_$(BUILD_VARIANT)_ENABLE_FRAGMENT),--enable,--disable)-fragment \
100 $(if $(CONFIG_OPENVPN_DEVEL_$(BUILD_VARIANT)_ENABLE_MULTIHOME),--enable,--disable)-multihome \
101 $(if $(CONFIG_OPENVPN_DEVEL_$(BUILD_VARIANT)_ENABLE_IPROUTE2),--enable,--disable)-iproute2 \
102 $(if $(CONFIG_OPENVPN_DEVEL_$(BUILD_VARIANT)_ENABLE_DEF_AUTH),--enable,--disable)-def-auth \
103 $(if $(CONFIG_OPENVPN_DEVEL_$(BUILD_VARIANT)_ENABLE_PF),--enable,--disable)-pf \
104 $(if $(CONFIG_OPENVPN_DEVEL_NOSSL),--disable-ssl --disable-crypto,--enable-ssl --enable-crypto) \
105 $(if $(CONFIG_OPENVPN_DEVEL_OPENSSL),--with-crypto-library=openssl) \
106 $(if $(CONFIG_OPENVPN_DEVEL_POLARSSL),--with-crypto-library=polarssl) \
107 )
108 endef
109
110 define Package/openvpn-devel-$(BUILD_VARIANT)/conffiles
111 /etc/config/openvpn
112 endef
113
114 define Package/openvpn-devel-$(BUILD_VARIANT)/install
115 $(INSTALL_DIR) \
116 $(1)/usr/sbin \
117 $(1)/etc/init.d \
118 $(1)/etc/config \
119 $(1)/etc/openvpn \
120 $(1)/lib/upgrade/keep.d
121
122 $(INSTALL_BIN) \
123 $(PKG_INSTALL_DIR)/usr/sbin/openvpn \
124 $(1)/usr/sbin/
125
126 $(INSTALL_BIN) \
127 files/openvpn.init \
128 $(1)/etc/init.d/openvpn
129
130 $(INSTALL_CONF) files/openvpn.config \
131 $(1)/etc/config/openvpn
132
133 $(INSTALL_DATA) \
134 files/openvpn.upgrade \
135 $(1)/lib/upgrade/keep.d/openvpn
136 endef
137
138 #define Package/openvpn-devel-easy-rsa/install
139 # $(INSTALL_DIR) $(1)/usr/sbin
140 # $(CP) $(PKG_BUILD_DIR)/easy-rsa/2.0/{build-*,clean-all,inherit-inter,list-crl,pkitool,revoke-full,sign-req,whichopensslcnf} $(1)/usr/sbin/
141 # $(INSTALL_DIR) $(1)/etc/easy-rsa
142 # $(INSTALL_DATA) $(PKG_BUILD_DIR)/easy-rsa/2.0/openssl-1.0.0.cnf $(1)/etc/easy-rsa/openssl-1.0.0.cnf
143 # $(INSTALL_DATA) $(PKG_BUILD_DIR)/easy-rsa/2.0/vars $(1)/etc/easy-rsa/vars
144 # $(INSTALL_DIR) $(1)/etc/easy-rsa/keys
145 # $(INSTALL_DATA) files/easy-rsa.index $(1)/etc/easy-rsa/keys/index.txt
146 # $(INSTALL_DATA) files/easy-rsa.serial $(1)/etc/easy-rsa/keys/serial
147 #endef
148
149 $(eval $(call BuildPackage,openvpn-devel-openssl))
150 $(eval $(call BuildPackage,openvpn-devel-polarssl))
151 $(eval $(call BuildPackage,openvpn-devel-nossl))
152 #$(eval $(call BuildPackage,openvpn-devel-easy-rsa))