File tightvnc.spec of Package tightvnc

#
# spec file for package tightvnc
#
# Copyright (c) 2014 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:           tightvnc
BuildRequires:  libjpeg-devel
BuildRequires:  unzip
BuildRequires:  xorg-x11-devel
Url:            http://www.tightvnc.com
Requires:       xdpyinfo
Requires:       xinetd
Requires:       xorg-x11-Xvnc
Requires(post):   update-alternatives
Requires(postun): update-alternatives
Provides:       vnc
PreReq:         sed
Summary:        A virtual X-Window System server
License:        GPL-2.0+
Group:          Productivity/Networking/Remote Desktop
Version:        1.3.10
Release:        0
Source0:        http://www.tightvnc.com/download/%{version}/%{name}-%{version}_unixsrc.tar.bz2
Patch0:         vncviewer.patch
Patch1:         tightvnc-X_SetInputFocus.patch
Patch2:         vncconnect.patch
Patch3:         tightvnc-byteorder.patch
Patch4:         tightvnc-vncviewer-scrollbar.patch
Patch5:         tightvnc-newfbsize.patch
Patch6:         tightvnc-rfbversion.patch
Patch7:         tightvnc-fullscreen.patch
Patch8:         tightvnc-man.patch
Patch9:         tightvnc-altgr.patch
# programs set up as xstartup as default
Recommends:     xrdb
Recommends:     xsetroot
Recommends:     xterm
Recommends:     twm
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
With vnc, start a virtual X Windows System server and get access to it
from different machines with the vnc-viewer.  You can change the
machine without terminating your session.

The viewer and server are also available for Windows -- they allow
access to vnc under Windows.  You can find it under /dosutils/tightvnc
on the installation media.

%prep
%setup -q -n vnc_unixsrc
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9

%build
xmkmf
make World CCOPTIONS="$RPM_OPT_FLAGS"

%install
rm -rf $RPM_BUILD_ROOT
mkdir -m755 -p $RPM_BUILD_ROOT%{_bindir}
mkdir -m755 -p $RPM_BUILD_ROOT%_mandir/man1
install -D -m 755 vncviewer/vncviewer $RPM_BUILD_ROOT%{_bindir}/vncviewer-tightvnc
install -D -m 755 vncconnect/vncconnect $RPM_BUILD_ROOT%{_bindir}/vncconnect
install -D -m 644 vncviewer/vncviewer.man $RPM_BUILD_ROOT%{_mandir}/man1/vncviewer-tightvnc.1
install -D -m 644 vncconnect/vncconnect.man $RPM_BUILD_ROOT%{_mandir}/man1/vncconnect.1
ln -s -f %{_sysconfdir}/alternatives/vncviewer $RPM_BUILD_ROOT%{_bindir}/vncviewer
ln -s -f %{_sysconfdir}/alternatives/vncviewer.1.gz $RPM_BUILD_ROOT%{_mandir}/man1/vncviewer.1.gz

# brp-25-symlink from opensuse <= 13.1 doesn't whitelist links leading to /etc/alternatives/*
%if 0%{?suse_version} <= 1310
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/alternatives
touch $RPM_BUILD_ROOT%{_sysconfdir}/alternatives/vncviewer
touch $RPM_BUILD_ROOT%{_sysconfdir}/alternatives/vncviewer.1.gz
%endif

%post
%_sbindir/update-alternatives \
    --install %{_bindir}/vncviewer vncviewer %{_bindir}/vncviewer-tightvnc 10 \
    --slave %{_mandir}/man1/vncviewer.1.gz  vncviewer.1.gz  %{_mandir}/man1/vncviewer-tightvnc.1.gz

%postun
if [ "$1" = 0 ] ; then
   %_sbindir/update-alternatives --remove vncviewer %{_bindir}/vncviewer-tightvnc
fi

%files
%defattr(-,root,root)
%{_bindir}/vncviewer
%{_bindir}/vncviewer-tightvnc
%{_bindir}/vncconnect
%doc README LICENCE.TXT ChangeLog WhatsNew
%doc %_mandir/man1/vncviewer.1.gz
%doc %_mandir/man1/vncviewer-tightvnc.1.gz
%doc %_mandir/man1/vncconnect.1.gz
%ghost %_sysconfdir/alternatives/vncviewer
%ghost %_sysconfdir/alternatives/vncviewer.1.gz

%changelog
openSUSE Build Service is sponsored by