1%{!?__id_u: %define __id_u %([ -x /bin/id ]&&echo /bin/id||([ -x /usr/bin/id ]&&echo /usr/bin/id|| echo /bin/true)) -u}
2
3# Available rpmbuild options:
4#
5# --without libwrap
6# --with    bsdppp
7# --with    slirp
8# --with    ipalloc
9# --without bcrelay
10#
11
12Summary:        PoPToP Point to Point Tunneling Server
13Name:           pptpd
14Version:        1.3.4
15Release:        1%{?dist}
16License:        GPL
17Group:          Applications/Internet
18URL:            http://poptop.sourceforge.net/
19Source0:        http://dl.sf.net/poptop/pptpd-%{version}.tar.gz
20Buildroot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
21Requires:       ppp >= 2.4.3
22
23%if %{?_without_libwrap:0}%{!?_without_libwrap:1}
24BuildRequires: tcp_wrappers
25%endif
26
27Requires(post):   /sbin/chkconfig
28Requires(preun):  /sbin/chkconfig, /sbin/service
29Requires(postun): /sbin/service
30
31%description
32This implements a Virtual Private Networking Server (VPN) that is
33compatible with Microsoft VPN clients. It allows windows users to
34connect to an internal firewalled network using their dialup.
35
36%prep
37%setup -q
38
39# Fix permissions for debuginfo package
40%{__chmod} 644 *.[ch]
41
42# Fix for distros with %{_libdir} = /usr/lib64
43%{__perl} -pi -e 's,/usr/lib/pptpd,%{_libdir}/pptpd,;' pptpctrl.c
44
45%build
46%configure \
47	%{!?_without_libwrap:--with-libwrap} \
48	%{?_without_libwrap:--without-libwrap} \
49	%{!?_with_bsdppp:--without-bsdppp} \
50	%{?_with_bsdppp:--with-bsdppp} \
51	%{!?_with_slirp:--without-slirp} \
52	%{?_with_slirp:--with-slirp} \
53	%{!?_with_ipalloc:--without-pppd-ip-alloc} \
54	%{?_with_ipalloc:--with-pppd-ip-alloc} \
55	%{!?_without_bcrelay:--with-bcrelay} \
56	%{?_without_bcrelay:--without-bcrelay}
57(echo '#undef VERSION'; echo '#define VERSION "2.4.3"') >> plugins/patchlevel.h
58%{__make} CFLAGS='-fno-builtin -fPIC -DSBINDIR=\"%{_sbindir}\" %{optflags}'
59
60%install
61%{__rm} -rf %{buildroot}
62%{__mkdir_p} %{buildroot}/etc/rc.d/init.d
63%{__mkdir_p} %{buildroot}/etc/ppp
64%{__mkdir_p} %{buildroot}%{_bindir}
65%{__mkdir_p} %{buildroot}%{_mandir}/man{5,8}
66%{__make} \
67	DESTDIR=%{buildroot} \
68	INSTALL=%{__install} \
69	LIBDIR=%{buildroot}%{_libdir}/pptpd \
70	install
71%{__install} -m 0755 pptpd.init %{buildroot}/etc/rc.d/init.d/pptpd
72%{__install} -m 0644 samples/pptpd.conf %{buildroot}/etc/pptpd.conf
73%{__install} -m 0644 samples/options.pptpd %{buildroot}/etc/ppp/options.pptpd
74%{__install} -m 0755 tools/vpnuser %{buildroot}%{_bindir}/vpnuser
75%{__install} -m 0755 tools/vpnstats.pl %{buildroot}%{_bindir}/vpnstats.pl
76%{__install} -m 0755 tools/pptp-portslave %{buildroot}%{_sbindir}/pptp-portslave
77%{__install} -m 0644 pptpd.conf.5 %{buildroot}%{_mandir}/man5/pptpd.conf.5
78%{__install} -m 0644 pptpd.8 %{buildroot}%{_mandir}/man8/pptpd.8
79%{__install} -m 0644 pptpctrl.8 %{buildroot}%{_mandir}/man8/pptpctrl.8
80
81%post
82/sbin/chkconfig --add pptpd || :
83OUTD="" ; for i in d manager ctrl ; do
84    test -x /sbin/pptp$i && OUTD="$OUTD /sbin/pptp$i" ;
85done
86test -z "$OUTD" || \
87{ echo "possible outdated executable detected; we now use %{_sbindir}/pptp*, perhaps you should run the following command:"; echo "rm -i $OUTD" ;}
88
89%postun
90[ $1 -gt 0 ] && /sbin/service pptpd condrestart &> /dev/null || :
91
92%preun
93if [ "$1" -lt 1 ]; then
94    /sbin/service pptpd stop &> /dev/null || :
95    /sbin/chkconfig --del pptpd || :
96fi
97
98%clean
99%{__rm} -rf %{buildroot}
100
101%files
102%defattr(-,root,root,0755)
103%doc AUTHORS COPYING INSTALL README* TODO ChangeLog* samples
104%{_sbindir}/pptpd
105%{_sbindir}/pptpctrl
106%{_sbindir}/pptp-portslave
107%{!?_without_bcrelay:%{_sbindir}/bcrelay}
108%{_libdir}/pptpd/pptpd-logwtmp.so
109%{_bindir}/vpnuser
110%{_bindir}/vpnstats.pl
111%{_mandir}/man5/pptpd.conf.5*
112%{_mandir}/man8/pptpd.8*
113%{_mandir}/man8/pptpctrl.8*
114/etc/rc.d/init.d/pptpd
115%config(noreplace) /etc/pptpd.conf
116%config(noreplace) /etc/ppp/options.pptpd
117
118%changelog
119* Tue Sep  5 2006 Paul Howarth <paul@city-fan.org> - 1.3.3-1
120- Update to 1.3.3
121- Add dist tag
122- Add %%postun scriptlet dependency for /sbin/service
123
124* Fri Mar 31 2006 Paul Howarth <paul@city-fan.org> - 1.3.1-1
125- Update to 1.3.1
126
127* Fri Mar 31 2006 Paul Howarth <paul@city-fan.org> - 1.3.0-1
128- update to 1.3.0
129- remove redundant macro definitions
130- change Group: to one listed in rpm's GROUPS file
131- use full URL for source
132- simplify conditional build code
133- use macros for destination directories
134- honour %%{optflags}
135- general spec file cleanup
136- initscript updates:
137    don't enable the service by default
138    add reload and condrestart options
139- condrestart service on package upgrade
140- fix build on x86_64
141- add buildreq tcp_wrappers
142
143* Fri Feb 18 2005 James Cameron <james.cameron@hp.com>
144- fix to use ppp 2.4.3 for plugin
145
146* Thu Nov 11 2004 James Cameron <james.cameron@hp.com>
147- adjust for building on Red Hat Enterprise Linux, per Charlie Brady
148- remove vpnstats, superceded by vpnstats.pl
149
150* Fri May 21 2004 James Cameron <james.cameron@hp.com>
151- adjust for packaging naming and test
152
153* Fri Apr 23 2004 James Cameron <james.cameron@hp.com>
154- include vpnwho.pl
155
156* Thu Apr 22 2004 James Cameron <james.cameron@hp.com>
157- change description wording
158- change URL for upstream
159- release first candidate for 1.2.0
160
161* Fri Jul 18 2003 R. de Vroede <richard@oip.tudelft.nl>
162- Check the ChangeLog files.
163
164