File GoldenCheetah.spec of Package GoldenCheetah

#
# spec file for package GoldenCheetah
#
# Copyright (c) 2013-2016 Malcolm J Lewis <malcolmlewis@opensuse.org>
#
# 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/
#

Name:           GoldenCheetah
Version:        3.5
Release:        0
Summary:        Cycling Performance Software
License:        GPL-3.0
Group:          Hardware/Other
Url:            http://goldencheetah.org/
Source0:        %{name}-%{version}.tar.gz
#Source0 via https://codeload.github.com/GoldenCheetah/GoldenCheetah/tar.gz/v3.4
Source99:       %{name}.changes
BuildRequires:	bison
BuildRequires:	flex
BuildRequires:	gcc-c++
BuildRequires:  srmio-devel-static
BuildRequires:	qwtplot3d-devel-static
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5OpenGL)
BuildRequires:  pkgconfig(Qt5Script)
BuildRequires:  pkgconfig(Qt5Svg)
BuildRequires:  pkgconfig(Qt5WebKit)
BuildRequires:  pkgconfig(Qt5WebKitWidgets)
BuildRequires:  pkgconfig(Qt5WebEngine)
BuildRequires:  pkgconfig(Qt5WebEngineCore)
BuildRequires:  pkgconfig(Qt5SerialPort)
BuildRequires:  pkgconfig(Qt5Multimedia)
BuildRequires:  pkgconfig(Qt5MultimediaWidgets)
BuildRequires:  pkgconfig(Qt5Bluetooth)
BuildRequires:  pkgconfig(Qt5Charts)
BuildRequires:  pkgconfig(Qt5Concurrent)
BuildRequires:  pkgconfig(Qt5Xml)
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(libclucene-core)
BuildRequires:  pkgconfig(libical)
BuildRequires:  pkgconfig(libusb)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(zlib)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
GoldenCheetah is a software package that:
- Downloads ride data directly from the CycleOps PowerTap and the SRM
  PowerControl V. Support for SRM PowerControl VI and VII is planned for
  the future.

- Imports ride data downloaded with other programs, including WKO+
  and the manufacturers' software for the Ergomo, Garmin, Polar,
  PowerTap, and SRM devices.

- Provides a rich set of analysis tools, including a critical
  power graph, BikeScore calculation, histogram analysis, a best interval
  finder, and a pedal force versus pedal velocity chart, to name just a few.

%prep
%setup -q
# Fix "Your file uses  __DATE and __TIME__ this causes the package to rebuild when not needed warning"
set_date=`date --date "@\`stat --format %Y %{_sourcedir}/%{name}.changes\`" +"%B %Y"`
set_time=`date --date "@\`stat --format %Y %{_sourcedir}/%{name}.changes\`" +"%H:%M"`
sed -i -e "s/\_\_DATE\_\_/\"$set_date\"/g" src/Gui/GcCrashDialog.cpp
sed -i -e "s/\_\_TIME\_\_/\"$set_time\"/g" src/Gui/GcCrashDialog.cpp

%build
cp qwt/qwtconfig.pri.in qwt/qwtconfig.pri
cp src/gcconfig.pri.in src/gcconfig.pri
#Add our own libraries to build
echo SRMIO_INSTALL = %{_prefix} >> src/gcconfig.pri
echo SRMIO_INCLUDE = %{_includedir} >> src/gcconfig.pri
echo SRMIO_LIBS = %{_libdir}/libsrmio.a >> src/gcconfig.pri
echo QWT3D_INSTALL = %{_prefix} >> src/gcconfig.pri
echo QWT3D_INCLUDE = %{_includedir}/qwtplot3d/ >> src/gcconfig.pri
echo QWT3D_LIBS = %{_libdir}/libqwtplot3d.a >> src/gcconfig.pri
echo LIBZ_INCLUDE = %{_includedir} >> src/gcconfig.pri
echo QJSON_INCLUDE = %{_includedir}/qjson/ >> src/gccconfig.pri
echo LIBZ_LIBS = -lz >> src/gcconfig.pri
cat > .qmake.cache <<EOF
CONFIG += release
QMAKE_CFLAGS_RELEASE = -O3 -fmessage-length=0 -grecord-gcc-switches -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
QMAKE_CXXFLAGS_RELEASE = -O3 -fmessage-length=0 -grecord-gcc-switches -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
QMAKE_LRELEASE="/usr/bin/lrelease"
EOF
qmake-qt5 -recursive
make VERBOSE=1 %{?_smp_mflags}

%install
install -Dm0755 src/GoldenCheetah %{buildroot}%{_bindir}/GoldenCheetah

%files
%defattr(-,root,root)
%doc COPYING
%doc doc/user/*.pdf
%{_bindir}/GoldenCheetah

%changelog