File qtVlm.spec of Package qtVlm

# spec file for package qtVlm
# Copyright (c) 2014 Dr. Axel Braun
# 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

Name:           qtVlm
Version:        3.4.4r2293
Release:        0
License:        GPL-2.0+
Summary:        Weather routing software for virtual and real sailing boats
Group:          Productivity/Graphics/Viewers
Source0:        %{name}-%{version}.tar.bz2
# Source0 via svn export -r2293 svn:// qtVlm-3.4.4r2293
# tar cvjf qtVlm-3.4.4r2293.tar.bz2 qtVlm-3.4.4r2293/
Source1:        qtVlm_wrapper
Source2:        qtVlm.desktop
# PATCH-FIX-OPENSUSE qtVlm-fix-makefile.patch -- Modify Makefile for distribution install rather than user.
#FIXME Packages that are not intended for inclusion in openSUSE may want to turn such fatal errors into warnings.
Source99:       qtVlm-rpmlintrc
Patch0:         qtVlm-fix-makefile.patch
# PATCH-FIX-OPENSUSE qtVlm-fix-implicit-definitions.patch -- Add missing includes when building on linux.
Patch1:         qtVlm-fix-implicit-definitions.patch
# PATCH-FIX-OPENSUSE qtVlm-fix-qt-homedir.patch -- Use the users home directory for data.
Patch2:         qtVlm-fix-qt-homedir.patch
# PATCH-FIX=OPENSUSE qtVlm-skip-file-write-test.patch -- Skip file write test for moment. FIXME
Patch3:         qtVlm-skip-file-write-test.patch
BuildRequires:  fdupes
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  libbz2-devel
BuildRequires:  libnova-devel
BuildRequires:  libproj-devel
BuildRequires:  libQt5Multimedia-devel
BuildRequires:  libQt5XmlPatterns-devel
#BuildRequires:  libqt5-qtmultimedia-devel
#BuildRequires:  libqt5-qtxmlpatterns-devel
BuildRequires:  libqt5-qtbase-devel
BuildRequires:  libqt5-qttools-devel
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
BuildRequires:  desktop-file-utils
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

qtVlm is a weather routing software for virtual and real sailing boats.

qtVlm can be used in two modes:
- Virtual Racing designed to manage and pilot virtual boats from Virtual
  loup de mer VLM virtual races.
- Real Boats connected (or not) to a GPS device.

qtVlm uses boat polar diagrams and grib weather files, and includes
Routing module (isochrons method),
Route module respectively allowing route optimization and waypoints

%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1

# Fix script-without-shebang warning, files should be 0644
find base_dir/polar/ -type f -exec chmod a-x {} \;

# Fix "Your file uses __DATE__ this causes the package to rebuild when not needed warning"
# We use the date from the changes file
set_date=`date --date "@\`stat --format %Y %{_sourcedir}/%{name}.changes\`" +"%B %Y"`
sed -i 's/QTVLM_VERSION_DATE  \_\_DATE\_\_/QTVLM_VERSION_DATE \"'"$set_date"'\"/g' src/Version.h

# Create qmake cache file to add rpm optflags to remove informational warning.
cat > .qmake.cache <<EOF

install -Dm 0755 %{S:1} %{buildroot}%{_bindir}/%{name}

%if 0%{?suse_version}
install -Dm0644 base_dir/icon/qtVlm_48x48.png \
%suse_update_desktop_file -i %{name}
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
desktop-file-install                                    \
--dir=%{buildroot}%{_datadir}/applications         \
%fdupes -s %{buildroot}

%if 0%{?suse_version}