File turnpike.spec of Package turnpike

#
# spec file for package turnpike (Version 0.1.1)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           turnpike
BuildRequires:  gtk2-devel libgcrypt-devel libxml2-devel novell-ipsec-tools-devel openssl-devel perl-XML-Parser update-desktop-files
%define prefix /usr
%define sysconfdir /etc
%define libexecdir %{prefix}/lib/turnpike
%define datadir /usr/share/turnpike
%define plugindir %prefix/lib/turnpike/plugins
%define gnome /gnome
Summary:        IKE Plugin framework for IPSec tools
Version:        0.1.1
Release:        244
License:        BSD 3-Clause
Group:          Productivity/Networking/Security
Source:         %{name}-%{version}.tar.gz
Source1:        vpnlogin.desktop
Source2:        vpnlogin.gif
Source3:        README.SuSE
Patch0:         bug-226387_unenc_pwd.patch
Patch1:         turnpike.patch
Patch2:         turnpike-prototypes.patch
Patch3:         turnpike-nowerror.patch
Url:            http://forge.novell.com/modules/xfmod/project/?turnpike
Requires:       novell-ipsec-tools >= 0.6.1
PreReq:         coreutils
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
This package contains binaries for making use of ipsec-tools with a
plugin framework. This enables to write custom vendor plugins to
process IPSec packets for solutions like VPN.



%prep
%setup -q
cp -v %{S:3} .
%patch
%patch1
%patch2
%patch3

%build
CFLAGS="$RPM_OPT_FLAGS" \
./configure \
    --prefix=%{prefix} \
    --exec-prefix=%{prefix}  \
    --mandir=%{_mandir} \
    --infodir=%{_infodir} \
    --sysconfdir=%{sysconfdir} \
    --datadir=%{datadir} \
    --sharedstatedir=/var/run \
    --localstatedir=/var/run \
    --mandir=%{prefix}/share/man \
    --infodir=%{prefix}/share/info \
    --libdir=%{prefix}/%_lib \
    --libexecdir=%{libexecdir} \
    --with-plugindir=%{plugindir}
make

%install
rm -rf %{buildroot}
mkdir %{buildroot}
make install DESTDIR=%{buildroot}
mkdir -p %{buildroot}/%{sysconfdir}/turnpike
mkdir -p %{buildroot}/etc/racoon/cert
mkdir -p %{buildroot}/%{sysconfdir}/turnpike/usercerts
mkdir -p %{buildroot}/%{sysconfdir}/turnpike/profiles
mkdir -p %{buildroot}/%{sysconfdir}/turnpike/vendorprofiles
# desktop icon
install -d %{buildroot}/%{datadir}/pixmaps
install -m 644 %{S:2} %{buildroot}/%{datadir}/pixmaps/vpnlogin.gif
install -d %{buildroot}/usr/share/applications
install -m 644 %{S:1} %{buildroot}/usr/share/applications/vpnlogin.desktop
%suse_update_desktop_file vpnlogin

%post
if [ -L /usr/bin/vpnlogin ]; then
    rm -rf /usr/bin/vpnlogin
fi
if [ -L /usr/bin/nvpn ] ; then
    rm -rf /usr/bin/nvpn
fi
#remove it even if it doesnt exists 
%{libexecdir}/vpnUpdateMenu -u
%{libexecdir}/vpnUpdateMenu -i
%run_ldconfig

%preun
#Do the following only if it is last uninstall
if [ "$1" = "0" ] ; then
    %{libexecdir}/vpnUpdateMenu -u
    rm -rf %{libexecdir}/vpnUpdateMenu
    rm -rf /usr/bin/vpnlogin
    rm -rf /usr/bin/nvpn
    rm -rf %{sysconfdir}/turnpike
fi
%run_ldconfig

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%{prefix}/bin/nvpn
%{prefix}/bin/vpnlogin
%dir %{sysconfdir}/turnpike
%dir %{sysconfdir}/turnpike/profiles
%dir %{sysconfdir}/turnpike/vendorprofiles
%dir %{sysconfdir}/turnpike/usercerts
%dir /etc/racoon
%dir /etc/racoon/cert
%dir %{datadir}
%dir %{datadir}/pixmaps
%{datadir}/pixmaps/vpnlogin.gif
/usr/share/applications/vpnlogin.desktop
%dir %{libexecdir}
%{libexecdir}/vpnUpdateMenu
%dir %{prefix}/include/turnpike
%{prefix}/include/turnpike/*
%doc README README.SuSE INSTALL

%changelog
* Mon Aug 25 2008 meissner@suse.de
- Build with rpm opt flags, disabled -Werror
* Fri Feb 01 2008 gekker@suse.de
- Set the desktop file for translation
* Wed Jan 30 2008 aj@suse.de
- Fix build.
* Sat Aug 04 2007 aj@suse.de
- Fix build.
* Thu Jun 07 2007 sbrabec@suse.cz
- Removed invalid desktop Category "Application" (#254654).
* Mon Jan 08 2007 tsureshkumar@suse.de
- protect private cert key (#226387)
* Fri Nov 17 2006 tsureshkumar@suse.de
- handle ph1 delete message
* Tue May 23 2006 tsureshkumar@suse.de
- fix for nvpn disconnect in full tunneling. (# 177907)
* Fri May 05 2006 tsureshkumar@suse.de
- removed accidental inclusion of COPYING with GPL. Include BSD.
- 64 bit blocker fix (#162805, #155614, #157875)  for vpnlogin
* Thu May 04 2006 tsureshkumar@novell.com
- 64 bit fixes : #162616, #157875
- clean sizes/ILP/binary-data-transfer to make 64 bit clean.
- locate the right va_copy, otherwise segfaults in 64 bit systems
* Tue Apr 18 2006 tsureshkumar@suse.de
- remove orphan widgets from ui as no longer useful. (thanks to multiple proposal).
- fixed cryptic texts in combo boxes
- few code re-arganization.
* Tue Apr 11 2006 rvinay@suse.de
- restored back the changes for route string handling
* Mon Apr 10 2006 tsureshkumar@suse.de
- print critical errors to stderr.
* Mon Apr 03 2006 rvinay@suse.de
- Fixed route string handling bug.
* Wed Mar 29 2006 rvinay@suse.de
- bumped the version to 0.1.1 (cert support)
- Added Certificate support for ph1 establishment for
  non std gateways.
* Thu Mar 23 2006 tsureshkumar@suse.de
- Moved README inside cvs
- Created README.SuSE for additional configure options
- use %%doc section rather than manual drop
- Use custom INSTALL  text file.
* Mon Mar 20 2006 rvinay@suse.de
- Added file 'Readme' to the turnpike package.
- Related spec file changes to install the Readme file.
* Fri Mar 17 2006 rvinay@suse.de
- Fix for pfs group off if gateway is of standard type
* Mon Mar 13 2006 rvinay@suse.de
- Fix for vpnlogin and nvpn daemon creating heavy cpu load
* Mon Mar 06 2006 rvinay@suse.de
- Fix for spec file errors.
* Sat Mar 04 2006 aj@suse.de
- Fix build.
- Cleanup BuildRequires.
* Thu Mar 02 2006 rvinay@suse.de
- Package resubmitted.
* Tue Feb 28 2006 rvinay@suse.de
- Memory leak fixes
- Handling pfs group 'off'
* Sat Feb 11 2006 rvinay@suse.de
- Added another option 's' to give the pfs group
- Chnged vpnc to nvpn
* Wed Feb 01 2006 tsureshkumar2@suse.de
- removed Conflicts with ipsec-tools.
- removed install of racoon.conf
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Thu Jan 19 2006 tsureshkumar@suse.de
- added missing directories to filelist
* Thu Jan 19 2006 tsureshkumar@novell.com
- added conflicts with ipsec-tools for racoon.conf
* Thu Jan 19 2006 ro@suse.de
- added missing directories to filelist again
- remove wrong requires for libxml2 and kernel again
- remove readline-devel from nfb again
* Wed Jan 18 2006 rvinay@novell.com
- added -Werror and -fno-strict-aliasing
* Fri Jan 13 2006 tsureshkumar@novell.com
- removed empty preun, postun. added coreutils as PreReq
* Fri Jan 13 2006 tsureshkumar@novell.com
- added coreutils to PreReq. don't kill vpnlogin. unnecessary
* Fri Dec 23 2005 tsureshkumar@novell.com
-  include perl-XML-Parser for build dependency
- initial
openSUSE Build Service is sponsored by