File xorg-x11-Xvnc.spec of Package xorg-x11-Xvnc

#
# spec file for package xorg-x11-Xvnc
#
# 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/
#


%define tigervnc 1

Name:           xorg-x11-Xvnc
%if %tigervnc
Version:        7.6_1.0.1
Release:        0
%else
Version:        7.6_0.1
Release:        0
%endif
%if %tigervnc
BuildRequires:  Mesa-devel
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  cmake
BuildRequires:  fltk-devel
BuildRequires:  font-util
BuildRequires:  gcc-c++
BuildRequires:  libXfont-devel
BuildRequires:  libgnutls-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libopenssl-devel
BuildRequires:  libtool
BuildRequires:  nasm
BuildRequires:  pam-devel
BuildRequires:  xorg-x11-server-sdk
%else
Requires:       x11vnc
%endif
Requires:       xinetd
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if %tigervnc
Summary:        TigerVNC implementation of Xvnc
License:        GPL-2.0
Group:          System/X11/Servers/XF86_4
%else
Summary:        Xvnc wrapper script which makes use of Xvfb/x11vnc
Group:          System/X11/Servers/XF86_4
#License:        MIT License (or similar)
%endif
%if %tigervnc
Source1:        tigervnc-1.3.0.tar.bz2
Source2:        xorg-server-1.13.0.tar.bz2
Source3:        vnc.xinetd
Source4:        10-libvnc.conf
Patch1:         tigervnc-1.2.80-fix-int-to-pointer.patch
Patch2:         u_aarch64-support.patch
Patch3:         N_xorg-server-xdmcp.patch
Patch4:         u_tigervnc-1.3.0-fix-use-after-free.patch
%else
Source0:        Xvnc.pl
%endif

%description
%if %tigervnc
This is the TigerVNC implementation of Xvnc.
%else
This is a wrapper script, which makes use of Xvfb/x11vnc to implement
a Xvnc server.
%endif

%prep
%if %tigervnc
%setup -T -n tigervnc-1.3.0/unix/xserver -b1 -b2
cp -r ../../../xorg-server-*/* .
patch -p1 < ../xserver113.patch
%patch1 -p1
%patch2 -p1
%patch3 -p1
pushd ../..
%patch4 -p1
popd
%endif

%build
%if %tigervnc
pushd ../..
cmake . -DCMAKE_BUILD_TYPE=Debug \
      	-DCMAKE_VERBOSE_MAKEFILE=on \
      	-DCMAKE_C_FLAGS="$RPM_OPT_FLAGS" \
      	-DCMAKE_CXX_FLAGS="$RPM_OPT_FLAGS"
make %{?jobs:-j %jobs}

popd
autoreconf -fi
%configure \
        --disable-xorg --disable-xnest --disable-xvfb --disable-dmx \
        --disable-xwin --disable-xephyr --disable-kdrive --with-pic \
        --disable-static --disable-xinerama \
        --with-xkb-path="/usr/share/X11/xkb" \
        --with-xkb-output="/var/lib/xkb/compiled" \
        --enable-glx --enable-dri --enable-dri2 \
        --disable-config-dbus \
        --disable-config-hal \
        --disable-config-udev \
        --without-dtrace \
        --disable-unit-tests \
        --disable-devel-docs \
        --with-fontrootdir=/usr/share/fonts \
        --disable-selective-werror
make %{?jobs:-j %jobs} V=1
%endif

%install
%if %tigervnc
make install DESTDIR=$RPM_BUILD_ROOT
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/Xserver.1*
rm -f $RPM_BUILD_ROOT/usr/%{_lib}/xorg/modules/extensions/libvnc.la
rm -f $RPM_BUILD_ROOT/usr/%{_lib}/xorg/protocol.txt
rm -rf $RPM_BUILD_ROOT/var/lib/xkb
mkdir -p $RPM_BUILD_ROOT/etc/X11/xorg.conf.d
install -m 644 %{SOURCE4} $RPM_BUILD_ROOT/etc/X11/xorg.conf.d/10-libvnc.conf
%else
mkdir -p $RPM_BUILD_ROOT/usr/bin
install -m 755 $RPM_SOURCE_DIR/Xvnc.pl  $RPM_BUILD_ROOT/usr/bin/Xvnc
%endif
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig/SuSEfirewall2.d/services
cat > $RPM_BUILD_ROOT/etc/sysconfig/SuSEfirewall2.d/services/%{name} << EOF
## Name: VNC Server
## Description: Opens ports for VNC Server
TCP="5801 5901"
EOF
mkdir -m755 -p $RPM_BUILD_ROOT/etc/xinetd.d/
cp %{SOURCE3} $RPM_BUILD_ROOT/etc/xinetd.d/vnc

%clean
rm -rf "$RPM_BUILD_ROOT"

%files
%defattr(-,root,root)
/etc/sysconfig/SuSEfirewall2.d/services/%{name}
/usr/bin/Xvnc
%if %tigervnc
%{_mandir}/man1/Xvnc.1*
%{_libdir}/xorg/modules/extensions/libvnc.so
%config(noreplace) /etc/X11/xorg.conf.d/10-libvnc.conf
%endif
%config(noreplace) /etc/xinetd.d/vnc

%changelog
openSUSE Build Service is sponsored by