svn cleanup
[anytun.git] / openvpn / openvpn.spec.in
blob041ffdd113acdbd145ffaea0d60d27c91307dd8f
1 # OpenVPN spec file, used to drive rpmbuild
3 # OPTIONS
5 # Disable LZO
6 # rpmbuild -tb [openvpn.x.tar.gz] --define 'without_lzo 1'
8 # Disable PAM plugin
9 # rpmbuild -tb [openvpn.x.tar.gz] --define 'without_pam 1'
11 # Allow passwords to be read from files
12 # rpmbuild -tb [openvpn.x.tar.gz] --define 'with_password_save 1'
14 # Use this on RH9 and RHEL3
15 # rpmbuild -tb [openvpn.x.tar.gz] --define 'with_kerberos 1'
17 Summary: OpenVPN is a robust and highly flexible VPN daemon by James Yonan.
18 Name: @PACKAGE@
19 Version: @VERSION@
20 Release: 1
21 URL: http://openvpn.net/
22 Source0: http://prdownloads.sourceforge.net/openvpn/%{name}-%{version}.tar.gz
24 License: GPL
25 Group: Applications/Internet
26 Vendor: James Yonan <jim@yonan.net>
27 Packager: James Yonan <jim@yonan.net>
28 BuildRoot: %{_tmppath}/%{name}-%(id -un)
31 # Include dependencies manually
34 AutoReq: 0
36 BuildRequires: openssl-devel >= 0.9.6
37 Requires: openssl >= 0.9.6
39 %if "%{_vendor}" == "Mandrakesoft"
40 %{!?without_lzo:BuildRequires: liblzo1-devel >= 1.07}
41 %{!?without_lzo:Requires: liblzo1 >= 1.07}
42 %else
43 %if "%{_vendor}" == "MandrakeSoft"
44 %{!?without_lzo:BuildRequires: liblzo1-devel >= 1.07}
45 %{!?without_lzo:Requires: liblzo1 >= 1.07}
46 %else
47 %{!?without_lzo:BuildRequires: lzo-devel >= 1.07}
48 %{!?without_lzo:Requires: lzo >= 1.07}
49 %endif
50 %endif
52 %{!?without_pam:BuildRequires: pam-devel}
53 %{!?without_pam:Requires: pam}
56 # Description
59 %description
60 OpenVPN is a robust and highly flexible VPN daemon by James Yonan.
61 OpenVPN supports SSL/TLS security,
62 ethernet bridging,
63 TCP or UDP tunnel transport through proxies or NAT,
64 support for dynamic IP addresses and DHCP,
65 scalability to hundreds or thousands of users,
66 and portability to most major OS platforms.
69 # Define vendor type
72 %if "%{_vendor}" == "suse" || "%{_vendor}" == "pc"
73 %define VENDOR SuSE
74 %else
75 %define VENDOR %_vendor
76 %endif
79 # Should we build the auth-pam module?
82 %define build_auth_pam 1
83 %{?without_pam:%define build_auth_pam 0}
86 # Other definitions
89 %define debug_package %{nil}
92 # Build OpenVPN binary
95 %prep
96 %setup -q
98 %build
99 %configure --disable-dependency-tracking %{?with_password_save:--enable-password-save} %{?without_lzo:--disable-lzo} %{?with_kerberos:--with-ssl-headers=/usr/kerberos/include}
100 %__make
101 %__strip %{name}
103 # Build down-root plugin
104 pushd plugin/down-root
105 %__make
106 popd
108 # Build auth-pam plugin
109 %if %{build_auth_pam}
110 pushd plugin/auth-pam
111 %__make
112 popd
113 %endif
116 # Installation section
119 %install
120 [ %{buildroot} != "/" ] && rm -rf %{buildroot}
122 # Install man page
123 %__install -c -d -m 755 %{buildroot}%{_mandir}/man8
124 %__install -c -m 755 %{name}.8 %{buildroot}%{_mandir}/man8
126 # Install binary
127 %__install -c -d -m 755 %{buildroot}%{_sbindir}
128 %__install -c -m 755 %{name} %{buildroot}%{_sbindir}
130 # Install init script
131 %if "%{VENDOR}" == "SuSE"
132 %__install -c -d -m 755 %{buildroot}/etc/init.d
133 %__sed -e 's#openvpn=\"/usr/local/sbin/openvpn\"#openvpn=\"/usr/sbin/openvpn\"#' < suse/%{name}.init > %{_tmppath}/%{name}.init
134 %__install -c -m 755 %{_tmppath}/%{name}.init %{buildroot}/etc/init.d/%{name}
135 %__rm %{_tmppath}/%{name}.init
136 %else
137 %__install -c -d -m 755 %{buildroot}/etc/rc.d/init.d
138 %__install -c -m 755 sample-scripts/%{name}.init %{buildroot}/etc/rc.d/init.d/%{name}
139 %endif
141 # Install /etc/openvpn
142 %__install -c -d -m 755 %{buildroot}/etc/%{name}
145 # Build /usr/share/openvpn
148 %__mkdir_p %{buildroot}%{_datadir}/%{name}
151 # Install the plugins
154 %__mkdir_p %{buildroot}%{_datadir}/%{name}/plugin/lib
156 for pi in auth-pam down-root; do
157 %__mv -f plugin/$pi/README plugin/README.$pi
158 if [ -e plugin/$pi/openvpn-$pi.so ]; then
159 %__install -c -m 755 plugin/$pi/openvpn-$pi.so %{buildroot}%{_datadir}/openvpn/plugin/lib/openvpn-$pi.so
161 done
163 %__mv -f plugin/README plugin/README.plugins
166 # Clean section
169 %clean
170 [ %{buildroot} != "/" ] && rm -rf %{buildroot}
173 # On Linux 2.4, make the device node
176 %post
177 case "`uname -r`" in
178 2.4*)
179 /bin/mkdir /dev/net >/dev/null 2>&1
180 /bin/mknod /dev/net/tun c 10 200 >/dev/null 2>&1
182 esac
185 # Handle the init script
188 /sbin/chkconfig --add %{name}
189 %if "%{VENDOR}" == "SuSE"
190 /etc/init.d/openvpn restart
191 %else
192 /sbin/service %{name} condrestart
193 %endif
194 %preun
195 if [ "$1" = 0 ]
196 then
197 %if "%{VENDOR}" == "SuSE"
198 /etc/init.d/openvpn stop
199 %else
200 /sbin/service %{name} stop
201 %endif
202 /sbin/chkconfig --del %{name}
206 # Files section
209 %files
210 %defattr(-,root,root)
211 %doc AUTHORS ChangeLog COPYING COPYRIGHT.GPL INSTALL NEWS PORTS README
212 %{_mandir}/man8/%{name}.8*
213 %{_sbindir}/%{name}
214 %{_datadir}/%{name}
215 %dir /etc/%{name}
216 %if "%{VENDOR}" == "SuSE"
217 /etc/init.d/%{name}
218 %else
219 /etc/rc.d/init.d/%{name}
220 %endif
222 # Install extra %doc stuff
223 %doc contrib/ easy-rsa/ management/ sample-*/ plugin/README.*
225 %changelog
227 * Mon Aug 2 2005 James Yonan
228 - Fixed build problem with --define 'without_pam 1'
230 * Mon Apr 4 2005 James Yonan
231 - Moved some files from /usr/share/openvpn to %doc for compatibility
232 with Dag Wieers' RPM repository
234 * Sat Mar 12 2005 Tom Walsh
235 - Added MandrakeSoft liblzo1 require
237 * Fri Dec 10 2004 James Yonan
238 - Added AutoReq: 0 for manual dependencies
240 * Fri Dec 10 2004 James Yonan
241 - Packaged the plugins
243 * Sun Nov 7 2004 Umberto Nicoletti
244 - SuSE support
246 * Wed Aug 18 2004 Bishop Clark (LC957) <bishop@platypus.bc.ca>
247 - restrict what we claim in /etc/ to avoid ownership conflicts
249 * Sun Feb 23 2003 Matthias Andree <matthias.andree@gmx.de> 1.3.2.14-1.
250 - Have the version number filled in by autoconf.
252 * Wed Jul 10 2002 James Yonan <jim@yonan.net> 1.3.1-1
253 - Fixed %preun to only remove service on final uninstall
255 * Mon Jun 17 2002 bishop clark (LC957) <bishop@platypus.bc.ca> 1.2.2-1
256 - Added condrestart to openvpn.spec & openvpn.init.
258 * Wed May 22 2002 James Yonan <jim@yonan.net> 1.2.0-1
259 - Added mknod for Linux 2.4.
261 * Wed May 15 2002 Doug Keller <dsk@voidstar.dyndns.org> 1.1.1.16-2
262 - Added init scripts
263 - Added conf file support
265 * Mon May 13 2002 bishop clark (LC957) <bishop@platypus.bc.ca> 1.1.1.14-1
266 - Added new directories for config examples and such
268 * Sun May 12 2002 bishop clark (LC957) <bishop@platypus.bc.ca> 1.1.1.13-1
269 - Updated buildroot directive and cleanup command
270 - added easy-rsa utilities
272 * Mon Mar 25 2002 bishop clark (LC957) <bishop@platypus.bc.ca> 1.0-1
273 - Initial build.