File freerdp.spec of Package freerdp1

#
# spec file for package freerdp
#
# 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/
#


%define major_version 1
%define libname libfreerdp
%define soname 1_0

Name:           freerdp
Version:        1.0.3.0.git20140210
Release:        0
Summary:        Remote Desktop Viewer Client
License:        Apache-2.0
Group:          Productivity/Networking/Other
Url:            http://www.freerdp.com/
Source0:        https://github.com/downloads/FreeRDP/FreeRDP/%{name}-%{version}.tar.bz2
Source1:        FindALSA.cmake
# PATCH-FIX-UPSTREAM freerdp-fix-FindPCSC-macro.patch https://github.com/FreeRDP/FreeRDP/issues/562 gberh@opensuse.org -- Fix the build by setting PCSC_LIBRARIES and PCSC_INCLUDE_DIRS variables explicitly which are otherwise empty
Patch1:         freerdp-fix-FindPCSC-macro.patch
# PATCH-FIX-UPSTREAM freerdp-fix-pulse-no-device-name.patch bnc#785437 gber@opensuse.org -- Fix a segfault in case device name is not provided
Patch4:         freerdp-handle-null-device-name.patch
# PATCH-FIX-UPSTREAM freerdp-CVE-2014-0250.patch bnc#880317 dliang@suse.com - backport from upstream 
Patch6:         freerdp-CVE-2014-0250.patch
Patch7:         freerdp-CVE-2014-0791.patch
# patch to avoid crashes, when smartcards are used
Patch10:        freerdp_branch-1.0.x_smartcard-crash-fix.patch
Patch11:        freerdp_branch-1.0.x_extend-geom-argument-with-position.patch
Patch12:        freerdp_branch-1.0.x_provide-correct-multi-monitor-data.patch
BuildRequires:  alsa-devel
BuildRequires:  cmake
BuildRequires:  cups-devel
%if %{?suse_version} >= 1500
BuildRequires:  libopenssl-1_0_0-devel
%else
BuildRequires:  libopenssl-devel
%endif
BuildRequires:  libpulse-devel
BuildRequires:  pcsc-lite-devel
BuildRequires:  xmlto
BuildRequires:  xorg-x11-devel
BuildRequires:  zlib-devel
Recommends:     %{libname}-plugins
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
FreeRDP is a client-side implementation of the Remote Desktop Protocol (RDP)
following the Microsoft Open Specifications. This package provides the client
application.

%package -n %{libname}%{soname}
Summary:        Remote Desktop Viewer Library
Group:          System/Libraries

%description -n %{libname}%{soname}
FreeRDP is a client-side implementation of the Remote Desktop Protocol (RDP)
following the Microsoft Open Specifications. This package provides the shared
library.

%package -n %{libname}%{soname}-plugins
Summary:        Plugins for %{libname}
Group:          System/Libraries
Provides:       libfreerdp-plugins = %{version}
Requires:       %{libname}%{soname} = %{version}

%description -n %{libname}%{soname}-plugins
This package provides plugins for %{libname}.

%package -n %{name}%{major_version}-devel
Summary:        Development Files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{libname}%{soname} = %{version}

%description -n %{name}%{major_version}-devel
This package contains development files necessary for developing applications
based on libfreerdp.

%prep
%setup -q -n freerdp-%{version}
%patch1 -p1
%patch4 -p1
%patch6 -p1
%patch7 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
# use a versioned subdirectory for plugins in order to comply with the shared
# library policy
sed -i 's/FREERDP_PLUGIN_PATH "\${CMAKE_INSTALL_PREFIX}\/\${CMAKE_INSTALL_LIBDIR}\/freerdp"/FREERDP_PLUGIN_PATH "\${CMAKE_INSTALL_PREFIX}\/\${CMAKE_INSTALL_LIBDIR}\/%{libname}"/g' CMakeLists.txt
%if 0%{?sles_version} == 11
    cp %SOURCE1 cmake/
%endif

%build
mkdir build
cd build
export CFLAGS="%{optflags} -DOPENSSL_LOAD_CONF"
cmake \
    -DCMAKE_INSTALL_PREFIX=%{_prefix} \
    -DCMAKE_INSTALL_LIBDIR=%{_lib} \
    -DCMAKE_BUILD_TYPE=Release \
    -DWITH_ALSA=ON \
    -DWITH_PULSEAUDIO=ON \
    -DWITH_PCSC=ON \
    -DWITH_CUPS=ON \
    -DWITH_FFMPEG=OFF \
%ifarch %ix86 x86_64
    -DWITH_SSE2=ON \
%endif
    -DWITH_DEBUG_X11_MONITOR=ON \
    ..
make %{?_smp_mflags} VERBOSE=1

%install
cd build
make install 'DESTDIR=%{buildroot}'

# remove keymaps as we make use of libxkbfile
# rm -rf $RPM_BUILD_ROOT/usr/share/freerdp/keymaps/

%post   -n %{libname}%{soname} -p /sbin/ldconfig

%postun -n %{libname}%{soname} -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc LICENSE README ChangeLog
%{_bindir}/xfreerdp
%{_datadir}/%{name}
%{_mandir}/man1/xfreerdp.1%{ext_man}

%files -n %{libname}%{soname}
%defattr(-,root,root)
%doc LICENSE
%{_libdir}/libfreerdp-cache.so.*
%{_libdir}/libfreerdp-channels.so.*
%{_libdir}/libfreerdp-codec.so.*
%{_libdir}/libfreerdp-core.so.*
%{_libdir}/libfreerdp-gdi.so.*
%{_libdir}/libfreerdp-kbd.so.*
%{_libdir}/libfreerdp-rail.so.*
%{_libdir}/libfreerdp-utils.so.*

%files -n %{libname}%{soname}-plugins
%defattr(-,root,root)
%doc LICENSE
%dir %{_libdir}/%{libname}
%{_libdir}/%{libname}/audin.so
%{_libdir}/%{libname}/audin_alsa.so
%{_libdir}/%{libname}/audin_pulse.so
%{_libdir}/%{libname}/cliprdr.so
%{_libdir}/%{libname}/disk.so
%{_libdir}/%{libname}/drdynvc.so
%{_libdir}/%{libname}/parallel.so
%{_libdir}/%{libname}/printer.so
%{_libdir}/%{libname}/rdpdr.so
%{_libdir}/%{libname}/rdpsnd.so
%{_libdir}/%{libname}/rdpsnd_alsa.so
%{_libdir}/%{libname}/rdpsnd_pulse.so
%{_libdir}/%{libname}/scard.so
%{_libdir}/%{libname}/serial.so
%{_libdir}/%{libname}/rail.so
%{_libdir}/%{libname}/rdpdbg.so
%{_libdir}/%{libname}/tsmf.so
%{_libdir}/%{libname}/tsmf_alsa.so
%{_libdir}/%{libname}/tsmf_pulse.so

%files -n %{name}%{major_version}-devel
%defattr(-,root,root)
%dir %{_includedir}/freerdp
%dir %{_includedir}/freerdp/*
%{_includedir}/freerdp/*.h
%{_includedir}/freerdp/*/*.h
%{_libdir}/libfreerdp-*.so
%{_libdir}/pkgconfig/freerdp.pc

%changelog
openSUSE Build Service is sponsored by