#define rcnumber rc4

Name:           freerdp
Summary:        Remote Desktop Protocol client
Summary(ja):    リモートデスクトッププロトコルクライアント
Version:        2.11.1
Release:        1%{?rcnumber:.%{rcnumber}}%{?_dist_release}
Group:          office,internet
Vendor:         Project Vine
Distribution:   Vine Linux

License:        GPLv2+
URL:            https://www.freerdp.com/
Source0:        https://pub.freerdp.com/releases/freerdp-%{version}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires:  cmake
BuildRequires:  xmlto
BuildRequires:  alsa-lib-devel
BuildRequires:  cups-devel
BuildRequires:  libX11-devel
BuildRequires:  libXcursor-devel
BuildRequires:  libXdamage-devel
BuildRequires:  libXext-devel
BuildRequires:  libXinerama-devel
BuildRequires:  libxkbfile-devel
BuildRequires:  libXv-devel
BuildRequires:  libusb1-devel
BuildRequires:  zlib-devel
BuildRequires:  openssl-devel
BuildRequires:  pulseaudio-libs-devel
BuildRequires:  pcsc-lite-devel
BuildRequires:  desktop-file-utils

Provides:       xfreerdp = %{version}-%{release}
Obsoletes:      freerdp-plugins < 2.0.0
Requires:       %{name}-libs = %{version}-%{release}

%description 
The xfreerdp Remote Desktop Protocol (RDP) client from the FreeRDP
project.

xfreerdp can connect to RDP servers such as Microsoft Windows
machines, xrdp and VirtualBox.


%package        libs
Summary:        Core libraries implementing the RDP protocol
Summary(ja):    RDPプロトコル実装のコアライブラリ
Group:          system

%description    libs
libfreerdp implements the core of the RDP protocol.

libfreerdpchanman can be used to load plugins that can handle channels
in the RDP protocol.

libfreerdpkbd implements functionality for handling keyboards in X.


%package        devel
Summary:        Development files for %{name}
Summary(ja):    %{name}の開発ファイル
Group:          programming
Requires:       %{name}-libs = %{version}-%{release}
Requires:       pkgconfig

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}-libs.


%debug_package


%prep
%setup -q

cat << EOF > xfreerdp.desktop 
[Desktop Entry]
Type=Application
Name=X FreeRDP
NoDisplay=true
Comment=Connect to RDP server and display remote desktop
Icon=%{name}
Exec=/usr/bin/xfreerdp
Terminal=false
Categories=Network;RemoteAccess;
EOF


%build
%cmake \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_LIBDIR:PATH=%{_lib} \
        -DWITH_ALSA=ON \
        -DWITH_CUPS=ON \
        -DWITH_OPENSSL=ON \
        -DWITH_PCSC=ON \
        -DWITH_PULSE=ON \
        -DWITH_X11=ON \
        -DWITH_XCURSOR=ON \
        -DWITH_XEXT=ON \
        -DWITH_XINERAMA=ON \
        -DWITH_XKBFILE=ON \
        -DWITH_XV=ON \
        -DWITH_ZLIB=ON \
        -DWITH_CUNIT=OFF \
        -DWITH_DIRECTFB=OFF \
        -DWITH_FFMPEG=OFF \
%ifarch x86_64
        -DWITH_SSE2=ON \
%else
        -DWITH_SSE2=OFF \
%endif
        %{nil}

%cmake_build

pushd %{_vpath_builddir}/winpr/tools/makecert-cli
make %{?_smp_mflags}
popd


%install
rm -rf %{buildroot}

%cmake_install
find %{buildroot} -name "*.a" -delete

# No need for keymap files when using xkbfile
rm -rf %{buildroot}/usr/share/freerdp

desktop-file-install --dir=%{buildroot}%{_datadir}/applications xfreerdp.desktop
install -p -D resources/FreeRDP_Icon_256px.png %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/%{name}.png


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%{_datadir}/applications/xfreerdp.desktop
%{_datadir}/icons/hicolor/256x256/apps/%{name}.png
%{_bindir}/winpr-hash
%{_bindir}/winpr-makecert
%{_bindir}/xfreerdp
%{_mandir}/man1/winpr-hash.1.*
%{_mandir}/man1/winpr-makecert.1.*
%{_mandir}/man1/xfreerdp.1.*

%files libs
%defattr(-,root,root,-)
%license LICENSE
%doc README ChangeLog
%{_libdir}/lib*.so.*
%{_mandir}/man7/wlog.*

%files devel
%defattr(-,root,root,-)
%{_includedir}/*
%{_libdir}/cmake/*
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*.pc


%changelog
* Fri Sep 08 2023 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.11.1-1
- updated to 2.11.1.

* Sun Nov 20 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.9.0-1
- updated to 2.9.0.

* Wed Oct 27 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.4.1-1
- updated to 2.4.1.

* Tue Aug 10 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.4.0-1
- updated to 2.4.0.
- dropped ldconfig scriptlets.

* Sun Dec 13 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.2.0-1
- updated to 2.2.0.

* Thu Jul 02 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.1.2-1
- updated to 2.1.2.

* Wed May 27 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.1.1-1
- updated to 2.1.1.

* Sat May 16 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.1.0-1
- updated to 2.1.0.

* Sun Dec 02 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.0.0-1.rc4
- updated to 2.0.0-RC4.
- dropped all patches.
- dropped subpackage 'freerdp-plugins'.

* Sun Jul 19 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.2-2
- add BuildRequires: alsa-lib-devel

* Tue Sep 23 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.0.2-1
- update to 1.0.2
- fixed typo in Group
- dropped Patch0 and Patch1
- added Patch2 to build with current xmlto

* Mon Sep 03 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.1-1
- update to 1.0.1
- import patches from fedora package.
- add BRs.

* Fri May 13 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 0.8.2-1
- initial build for Vine Linux

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Fri Jan 28 2011 Mads Kiilerich <mads@kiilerich.com> - 0.8.2-2
- rebuild on rawhide because of broken dependencies

* Tue Nov 16 2010 Mads Kiilerich <mads@kiilerich.com> - 0.8.2-1
- freerdp-0.8.2

* Mon Nov 08 2010 Mads Kiilerich <mads@kiilerich.com> - 0.8.1-2
- make -devel require pkgconfig
- first official Fedora package

* Sun Nov 07 2010 Mads Kiilerich <mads@kiilerich.com> - 0.8.1-1
- freerdp-0.8.1

* Sat Sep 25 2010 Mads Kiilerich <mads@kiilerich.com> - 0.7.4-2
- hack the generated libtool to not set rpath on x86_64
- configure with alsa explicitly

* Tue Aug 24 2010 Mads Kiilerich <mads@kiilerich.com> - 0.7.4-1
- freerdp-0.7.4
- cleanup of packaging structure

* Wed Jul 28 2010 Mads Kiilerich <mads@kiilerich.com> - 0.7.3-1
- 0.7.3
- fix some minor pylint warnings

* Fri Jul 23 2010 Mads Kiilerich <mads@kiilerich.com> - 0.7.2-2
- 0.7.2
- Address many comments from cwickert:
- - cleanup of old formatting, alignment with spectemplate-lib.spec and
    cwickert spec from #616193
- - add alsa as build requirement
- - remove superfluous configure options and disable static libs
- - add missing rpm groups

* Sun Jun 13 2010 Mads Kiilerich <mads@kiilerich.com> - 0.7.0-1
- First official release, first review request