#global prerel 06

Name:           fldigi
Version:        3.23.20
%if 0%{?prerel}
Release:        1%{?dist}
%else
Release:        1%{?dist}
%endif
Summary:        Digital modem program for Linux
License:        GPLv3+  

URL:            http://www.w1hkj.com/Fldigi.html
Source0:        http://downloads.sourceforge.net/%{name}/%{name}-%{version}%{?prerel:.%{prerel}}.tar.gz
Source1:        http://downloads.sourceforge.net/%{name}/%{name}-help.pdf
Source100:      fldigi.appdata.xml

BuildRequires:  hamlib-devel
BuildRequires:  fltk-devel >= 1.3
%if 0%{?rhel}
BuildRequires:  fltk-static libXcursor-devel
%endif
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  portaudio-devel >= 19-4
BuildRequires:  libsndfile-devel
BuildRequires:  desktop-file-utils
BuildRequires:  libsamplerate-devel
BuildRequires:  pulseaudio-libs-devel
BuildRequires:  gettext
BuildRequires:  libXinerama-devel

#BuildRequires:  flxmlrpc-devel >= 0.1.0

%if 0%{?fedora}
# For appstream-util
BuildRequires:  libappstream-glib
%endif

%{?fedora:Recommends:     trustedqsl}

Provides:       flarq = %{version}-%{release}

%description
Fldigi is a modem program which supports most of the digital modes used by 
ham radio operators today. You can also use the program for calibrating your 
sound card to WWV or doing a frequency measurement test. The program also comes 
with a CW decoder. fldigi is written with the help of the Fast Light Toolkit X 
GUI. Fldigi is a fast moving project many added features with each update.

Flarq (Fast Light Automatic Repeat Request) is a file transfer application
that is based on the ARQ specification developed by Paul Schmidt, K9PS.
It is capable of transmitting and receiving frames of ARQ data via fldigi.


%package doc
Summary:      PDF User Manual for %{name}
Requires:     %{name} = %{version}-%{release}
BuildArch:    noarch

%description doc
PDF User Manual for %{name}.


%prep
%setup -q -n %{name}-%{version}%{?prerel:.%{prerel}}

# Remove bundled xmlrpc library
#rm -rf src/xmlrpcpp

# Fix header references to xmlrpcpp
#find ./ -type f -exec sed -i "s/xmlrpcpp\//flxmlrpc\//g" {} \;


%build
%configure %{?rhel:--enable-static}
make %{?_smp_mflags} CFLAGS="%{optflags}" LIBS="-lm -lX11 -lpthread" V=1


%install
%make_install

# Add keywords to desktop file for gnome-shell and software center.
echo "Keywords=modem;psk;rtty;cw;fsq;fsk;" >> %{buildroot}%{_datadir}/applications/%{name}.desktop

desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
desktop-file-validate %{buildroot}%{_datadir}/applications/flarq.desktop

# Add fldigi-psk.png as it's in PNG format and higher resolution than the XPM.
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/64x64/apps/
install -pm 0644 data/fldigi-psk.png \
    %{buildroot}%{_datadir}/icons/hicolor/64x64/apps/%{name}.png

%find_lang %{name}

# Install user manual.
mkdir -p %{buildroot}%{_docdir}/%{name}
install -pm 0644 %{SOURCE1} %{buildroot}%{_docdir}/%{name}/

%if 0%{?fedora}
# Install and validate appdata file
mkdir -p %{buildroot}%{_datadir}/appdata
install %{SOURCE100} -pm 0644 %{buildroot}%{_datadir}/appdata/
appstream-util validate-relax --nonet %{buildroot}%{_datadir}/appdata/*.appdata.xml
%endif

%post
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


%files -f %{name}.lang
%license COPYING
%doc AUTHORS ChangeLog README NEWS
%{_bindir}/*
%{_datadir}/icons/hicolor/64x64/apps/%{name}.png
%{_datadir}/pixmaps/%{name}.xpm 
%{_datadir}/pixmaps/flarq.xpm 
%{_mandir}/man1/%{name}.1.gz
%{_mandir}/man1/flarq.1.gz
%{?fedora:%{_datadir}/appdata/fldigi.appdata.xml}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/applications/flarq.desktop
%{_datadir}/%{name}/
%exclude %{_docdir}/%{name}/fldigi-help.pdf

%files doc
%{_docdir}/%{name}/fldigi-help.pdf


%changelog
* Fri Jan  6 2017 Richard Shaw <hobbes1069@gmail.com> - 3.23.20-1
- Update to latest upstream release.

* Fri Dec 23 2016 Richard Shaw <hobbes1069@gmail.com> - 3.23.19-1
- Update to latest upstream release.

* Mon Dec 12 2016 Richard Shaw <hobbes1069@gmail.com> - 3.23.18-1
- Update to latest upstream release.

* Tue Dec 06 2016 Richard Shaw <hobbes1069@gmail.com> - 3.23.17-1
- Update to latest upstream release.

* Fri Nov 11 2016 Richard Shaw <hobbes1069@gmail.com> - 3.23.16-1
- Update to latest upstream release.
- Fldigi can now automatically upload contacts to LoTW through trustedqsl.

* Sun Oct 16 2016 Richard Shaw <hobbes1069@gmail.com> - 3.23.15-1
- Update to latest upstream release.

* Sun Sep 18 2016 Richard Shaw <hobbes1069@gmail.com> - 3.23.14-1
- Update to latest upstream release.

* Sat Aug  6 2016 Richard Shaw <hobbes1069@gmail.com> - 3.23.13-1
- Update to latest upstream release.

* Mon Jun 29 2016 Richard Shaw <hobbes1069@gmail.com> - 3.23.12-1
- Update to latest upstream release.

* Sun Jun 12 2016 Richard Shaw <hobbes1069@gmail.com> - 3.23.11-1
- Update to latest upstream release.

* Sun Apr  3 2016 Richard Shaw <hobbes1069@gmail.com> - 3.23.09-1
- Update to latest upstream release.

* Wed Feb 24 2016 Richard Shaw <hobbes1069@gmail.com> - 3.23.08-1
- Update to latest upstream release.

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.23.07-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Feb 02 2016 Jonathan Wakely <jwakely@redhat.com> - 3.23.07-2
- Patched for C++11 compatibility.

* Fri Jan 22 2016 Richard Shaw <hobbes1069@gmail.com> - 3.23.07-1
- Update to latest upstream release.

* Wed Dec  2 2015 Richard Shaw <hobbes1069@gmail.com> - 3.23.06-1
- Update to latest upstream release.

* Thu Nov 19 2015 Richard Shaw <hobbes1069@gmail.com> - 3.23.05-1
- Update to latest upstream release.

* Fri Oct 16 2015 Richard Shaw <hobbes1069@gmail.com> - 3.23.04-1
- Update to latest upstream release.

* Wed Sep 30 2015 Richard Shaw <hobbes1069@gmail.com> - 3.23.03-1
- Update to latest upstream release.

* Fri Sep 18 2015 Richard Hughes <rhughes@redhat.com> - 3.22.13-2
- Remove now-unused AppData file

* Tue Jul 21 2015 Richard Shaw <hobbes1069@gmail.com> - 3.22.13-1
- Update to latest upstream release.

* Sat Jul 18 2015 Richard Shaw <hobbes1069@gmail.com> - 3.22.12-1
- Update to latest upstream release.

* Wed Jul 15 2015 Richard Shaw <hobbes1069@gmail.com> - 3.22.11-1
- Update to latest upstream release.

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.22.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Mon Jun  1 2015 Richard Shaw <hobbes1069@gmail.com> - 3.22.10-1
- Update to latest upstream release.

* Tue May  5 2015 Richard Shaw <hobbes1069@gmail.com> - 3.22.08-1
- Update to latest upstream release.
- Update build requirements to use separate xmlrpc library.

* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 3.22.07-2
- Rebuilt for GCC 5 C++11 ABI change

* Thu Apr  2 2015 Richard Shaw <hobbes1069@gmail.com> - 3.22.07-1
- Update to latest upstream release.

* Thu Mar 26 2015 Richard Hughes <rhughes@redhat.com> - 3.22.06-2
- Add an AppData file for the software center

* Sun Mar 22 2015 Richard Shaw <hobbes1069@gmail.com> - 3.22.06-1
- Update to latest upstream release.

* Tue Jan 13 2015 Richard Shaw <hobbes1069@gmail.com> - 3.22.05-1
- Update to latest upstream release.

* Fri Dec 26 2014 Richard Shaw <hobbes1069@gmail.com> - 3.22.04-1
- Update to latest upstream release.

* Thu Dec 25 2014 Richard Shaw <hobbes1069@gmail.com> - 3.22.03-1
- Update to latest upstream release.

* Mon Dec  1 2014 Richard Shaw <hobbes1069@gmail.com> - 3.22.02-1
- Update to latest upstream release.

* Mon Oct 20 2014 Richard Shaw <hobbes1069@gmail.com> - 3.22.01-1
- Update to latest upstream release.

* Thu Oct 16 2014 Richard Shaw <hobbes1069@gmail.com> - 3.22.00-1
- Update to latest upstream release.

* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Thu Jul 17 2014 Rex Dieter <rdieter@fedoraproject.org> - 3.21.83-2
- rebuild (for pulseaudio, bug #1117683)

* Sun Jun 29 2014 Richard Shaw <hobbes1069@gmail.com> - 3.21.83-1
- Update to latest upstream release.

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.21.82-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed Apr 30 2014 Richard Shaw <hobbes1069@gmail.com> - 3.21.82-1
- Update to latest upstream release.

* Sun Mar 30 2014 Richard Shaw <hobbes1069@gmail.com> - 3.21.81-1
- Update to latest upstream release.

* Tue Mar 11 2014 Richard Shaw <hobbes1069@gmail.com> - 3.21-79-1
- Update to latest upstream release.

* Tue Mar  4 2014 Richard Shaw <hobbes1069@gmail.com> - 3.21.78-1
- Update to latest upstream release.

* Wed Oct 30 2013 Richard Shaw <hobbes1069@gmail.com> - 3.21.77-1
- Update to latest bugfix release.

* Thu Sep 12 2013 Richard Shaw <hobbes1069@gmail.com> - 3.21.76-1
- Update to latest bugfix release.

* Mon Sep  2 2013 Richard Shaw <hobbes1069@gmail.com> - 3.21.75-1
- Update to latest bugfix release.

* Tue Aug 27 2013 Richard Shaw <hobbes1069@gmail.com> - 3.21.74-1
- Update to latest bugfix release.

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.21.68-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 3.21.68-2
- Perl 5.18 rebuild

* Sat Mar 16 2013 Richard Shaw <hobbes1069@gmail.com> - 3.21.68-1
- Update to latest bugfix release.

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.21.49-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Fri Aug 3 2012 Randall J. Berry, N3LRX <dp67@fedoraproject.org> - 3.21.49-1
- Upstream upddate to 3.21.49

* Mon May 14 2012 Randall J. Berry, N3LRX <dp67@fedoraproject.org> - 3.21.41-1
- Upstream upddate to 3.21.41
- Fix deps for F18/Rawhide

* Sat Jan 28 2012 Randall J. Berry, N3LRX <dp67@fedoraproject.org> - 3.21.37-2
- Upstream upddate to 3.21.37
- Remove patches fixed upstream
- Correct source URL

* Sat Jan 28 2012 Randall J. Berry, N3LRX <dp67@fedoraproject.org> - 3.21.37-1
- Upstream upddate to 3.21.37

* Sun Jan 15 2012 Randall J. Berry, N3LRX <dp67@fedoraproject.org> - 3.21.35-2
- Add patches for testing error correction
- Update rawhide builds

* Sun Jan 15 2012 Randall J. Berry, N3LRX <dp67@fedoraproject.org> - 3.21.35-1
- Upstream upddate to 3.21.35
- Rebuild against gcc 4.7

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.21.34-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Mon Jan 2 2012 Randall J. Berry, N3LRX <dp67@fedoraproject.org> - 3.21.34-2
- Test Build Against FLTK 1.3
