# spec created by Crissi
%define suse_release %(suse_release="`cat /etc/SuSE-release | tail -n1 | awk {'print $3'}`" ; echo "$suse_release")
%define release %(release="`echo "%{suse_release} * 10" | bc 2>/dev/null`" ; if test $? != 0 ; then release="" ; fi ; echo "$release")

Name:           kvpnc
Version:        0.6.0.1
Release:	1.suse%{release}
Vendor:		Christoph Thielecke <crissi99@gmx.de>
Packager:	Christoph Thielecke <crissi99@gmx.de>
Summary:        KDE frontend for various vpn clients
Summary(de):    KDE-Oberfläche für verschiedene VPN-Clients
License:	GPL
Group:		X11/KDE/Network
URL: 		http://home.gna.org/kvpnc/
Source0: 	%{name}-%{version}.tar.bz2
# Source1: myfind-requires.sh
# %define __find_requires %{SOURCE1}
BuildRoot:	%{_tmppath}/kvpnc-buildroot
Distribution:	SuSE Linux %{suse_release}

# neededforbuild  kde3-devel-packages
# usedforbuild    aaa_base aaa_dir aaa_version arts arts-devel autoconf automake base bash bindutil binutils bison bzip compat cpio cpp cracklib cyrus-sasl db devs diffutils docbook-dsssl-stylesheets docbook_3 e2fsprogs fam file fileutils findutils flex freetype2 freetype2-devel gawk gcc gcc-c++ gdbm gdbm-devel gettext glibc glibc-devel glibc-locale gpm grep groff gzip iso_ent jade_dsl kbd kdelibs3 kdelibs3-devel less libgcc libjpeg liblcms libmng libmng-devel libpng libpng-devel libstdc++ libstdc++-devel libtiff libtool libxcrypt libxml2 libxml2-devel libxslt libxslt-devel libz m4 make man mesa mesa-devel mesaglu mesaglu-devel mesaglut mesaglut-devel mesasoft mktemp modutils ncurses ncurses-devel net-tools netcfg openssl openssl-devel pam pam-devel pam-modules patch perl ps qt3 qt3-devel rcs readline rpm sed sendmail sh-utils shadow sp sp-devel strace syslogd sysvinit tar texinfo textutils timezone unzip util-linux vim xdevel xf86 xshared

%description -l de
KVpnc ist eine KDE-Oberfläche für verschiedene VPN-Clients. Es unterstützt Cisco VPN (vpnc) und IPSec (FreeS/WAN, racoon). 
vpnc ist eine Ersetzung für den Cisco VPN-Client und er wird als Client für den cisco3000 VPN-Konzentrator benutzt, FreeS/WAN (OpenS/WAN) ist ein IPSec-Client für Linux 2.4.x und racoon ist ein IPSec-Client für Linux 2.6.x und *BSD.
Es unterstützt auch PPTP (pptpclient) und OpenVPN.

%description
KVpnc is a KDE frontend for various vpn clients. It supports Cisco VPN (vpnc) and IPSec (FreeS/WAN, racoon). 
vpnc is a replacement for the cisco VPN client and its used as client for the cisco3000 VPN Concentrator, FreeS/WAN (OpenS/WAN) is a IPSec client for Linux 2.4.x and racoon is a IPSec client for Linux 2.6.x and *BSD.
It supports also PPTP (pptpclient) and OpenVPN.

%prep
export KDEDIR=/opt/kde3
export QTDIR=/usr/lib/qt3

%setup -q
make -f admin/Makefile.common
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/opt/kde3 $LOCALFLAGS

%build
# Setup for parallel builds
numprocs=`egrep -c ^cpu[0-9]+ /proc/stat || :`
if [ "$numprocs" = "0" ]; then
  numprocs=1
fi

make -j $numprocs

%install
make install-strip DESTDIR=$RPM_BUILD_ROOT

cd $RPM_BUILD_ROOT
find . -type d | sed '1,2d;s,^\.,\%attr(-\,root\,root) \%dir ,' > $RPM_BUILD_DIR/file.list.kvpnc
find . -type f | sed 's,^\.,\%attr(-\,root\,root) ,' >> $RPM_BUILD_DIR/file.list.kvpnc
find . -type l | sed 's,^\.,\%attr(-\,root\,root) ,' >> $RPM_BUILD_DIR/file.list.kvpnc

%clean
rm -rf $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_DIR/kvpnc*
rm -rf ../file.list.kvpnc

%files -f ../file.list.kvpnc
