File kvpnc.spec of Package kvpnc

#
# spec file for package kvpnc
#
# Copyright (c) 2013 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/
#


Name:           kvpnc
Version:        0.9.6a
Release:        0
Summary:        GUI Front-End for various VPN clients
License:        GPL-2.0+
Group:          Productivity/Networking/System
Url:            http://home.gna.org/kvpnc/
Source0:        http://download.gna.org/kvpnc/%{name}-%{version}-kde4.tar.bz2
Source1:        http://download.gna.org/kvpnc/%{name}-0.9.6-kde4-locale.tar.bz2
Patch0:         kvpnc-gcc47.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# only needed to patch broken images in the upstream tarball
BuildRequires:  ImageMagick
BuildRequires:  fdupes
BuildRequires:  libgcrypt-devel
BuildRequires:  libkde4-devel
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%endif
%kde4_runtime_requires
Recommends:     ksshaskpass
Recommends:     opensc
Recommends:     openssl
Provides:       kde4-kvpnc = %{version}
Obsoletes:      kde4-kvpnc < %{version}

%description
The application can create configurations for various kinds of VPN connections.
You should also install a vpn package (e.g. openvpn, strongswan, vpnc).

%prep
%setup -q -n %{name}-%{version}-kde4 -a1
%patch0 -p1
echo "find_package(Msgfmt REQUIRED)" >> CMakeLists.txt
echo "find_package(Gettext REQUIRED)" >> CMakeLists.txt
echo "add_subdirectory( po )" >> CMakeLists.txt

# Remove build time references so build-compare can do its work
FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M')
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
sed -i "s/__TIME__/\"$FAKE_BUILDTIME\"/" src/main.cpp
sed -i "s/__DATE__/\"$FAKE_BUILDDATE\"/" src/main.cpp
sed -i "s/__DATE__/\"$FAKE_BUILDDATE\"/" src/kvpncconfig.cpp

# This image looks corrupt?
rm $RPM_BUILD_DIR/%{name}-%{version}-kde4/src/icons/actions/lo22-action-connecting.png
# Patch image with wrong dimensions - Fixes rpmlint warning "wrong-icon-size"
for d in src/icons src/icons/actions; do
  pushd "$d"
  for s in 16 22 32 48 64; do
    ls *"$s"-*.png || break
    for f in *"$s"-*.png *"$s"-*.png *"$s"-*.png *"$s"-*.png; do
      geom=$(identify -ping "$f"|cut -f3 -d" ")
      x=${geom%x*}
      y=${geom#*x}
      if [ "$x" != "$s" -o "$y" != "$s" ]; then
        if [ "$x" -gt "$y" ]; then
          nugeom="${x}x${x}"
          grav=south
        elif [ "$x" -lt "$y" ]; then
          nugeom="${y}x${y}"
          grav=center
        else
          nugeom=""
        fi
        [ -n "$nugeom" ] && mogrify -extent "$nugeom" -background transparent -gravity "$grav" "$f"
        mogrify -scale "$s"x"$s" -background transparent "$f"
      fi
    done
  done
  popd
done

%build
%cmake_kde4 -d build
%make_jobs

%install
cd build
%kde4_makeinstall
cd ..

# Fix permissions
chmod 755 %{buildroot}%{_kde4_appsdir}/kvpnc/ping_check.sh

%if 0%{?suse_version}
%suse_update_desktop_file -G "VPNC FrontEnd" kvpnc Qt KDE Network RemoteAccess
%endif

# Remove unneeded locales
%if 0%{?suse_version} && 0%{?suse_version} < 1140
rm -rf %{buildroot}%{_datadir}/locale/hne/
rm -rf %{buildroot}%{_datadir}/locale/x-test/
%endif

%fdupes -s %{buildroot}%{_datadir}

%find_lang %{name}

%clean
rm -rf %{buildroot}

%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING ChangeLog README TODO
%{_kde4_bindir}/kvpnc
%{_kde4_applicationsdir}/kvpnc.desktop
%{_kde4_iconsdir}/*/*/*/*
%{_kde4_appsdir}/kvpnc/

%changelog
openSUSE Build Service is sponsored by