File openambit.spec of Package openambit

#
# spec file for package openambit
#
# Copyright (c) 2020 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#

%define currentVersion 0
Name:           openambit
Version:        0.3
Release:        0
Summary:        Open software for the Suunto Ambit(2)
License:        GPL-3.0-or-later
Group:          Productivity/Other
URL:            https://github.com/openambitproject/openambit
Source:         %{name}-%{version}.tar.xz
Patch0:         patch-openambit.patch
Patch1:         fix-python.patch
BuildRequires:  -post-build-checks
BuildRequires:  cmake >= 3.0
BuildRequires:  hicolor-icon-theme
BuildRequires:  libqt5-linguist-devel
BuildRequires:  libqt5-qtbase-common-devel
BuildRequires:  libqt5-qtbase-devel
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5DBus)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(libudev)
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(zlib)
Requires(post): update-desktop-files
Requires(postun): update-desktop-files
%{?systemd_requires}
%if 0%{?suse_version} <= 1500
BuildRequires:  python3-devel
BuildRequires:  wireshark-ui
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(wireshark)
%endif
%if 0%{?suse_version} >= 1210
BuildRequires:  systemd
%endif

%description
The Openambit project aims at developing open software for the Suunto Ambit(2) outdoor clocks. The motive for this project is Suuntos reluctance of any kind of support for their customers on the Linux platform.

%package -n libambit%{currentVersion}
Summary:        Open software for the Suunto Ambit(2)
Group:          System/Libraries

%description -n libambit%{currentVersion}
The Openambit project aims at developing open software for the Suunto Ambit(2) outdoor clocks. The motive for this project is Suuntos reluctance of any kind of support for their customers on the Linux platform.

%package -n libmovescount%{currentVersion}
Summary:        Open software for the Suunto Ambit(2)
Group:          System/Libraries

%description -n libmovescount%{currentVersion}
The Openambit project aims at developing open software for the Suunto Ambit(2) outdoor clocks. The motive for this project is Suuntos reluctance of any kind of support for their customers on the Linux platform.

%package -n libambit-devel
Summary:        Development files for libopenambit
Group:          Development/Sources
Requires:       libambit%{currentVersion} = %{version}

%description -n libambit-devel
Development files for libopenambit.
The Openambit project aims at developing open software for the Suunto Ambit(2) outdoor clocks. The motive for this project is Suuntos reluctance of any kind of support for their customers on the Linux platform.

%package -n libmovescount-devel
Summary:        Development files for libmovescount
Group:          Development/Sources
Requires:       libmovescount%{currentVersion} = %{version}

%description -n libmovescount-devel
Development files for libmovescount.
The Openambit project aims at developing open software for the Suunto Ambit(2) outdoor clocks. The motive for this project is Suuntos reluctance of any kind of support for their customers on the Linux platform.

%if 0%{?suse_version} <= 1500
%package -n wireshark-plugin-ambit
Summary:        Wireshark plugin for the Suunto Ambit(2)
Group:          Productivity/Networking/Diagnostic
Requires:       libambit%{currentVersion} = %{version}
Requires:       wireshark < 2.0

%description -n wireshark-plugin-ambit
Wireshark dissector plugin for analysis of communication with the Suunto Ambit(2) outdoor clock.
%endif

%prep
%setup -q
%patch0 -p1
%patch1 -p1

%build
%if 0%{?suse_version} <= 1500
    %define wireshark_plugindir %(pkg-config --variable plugindir wireshark)
%endif
%cmake \
  -DCMAKE_INSTALL_UDEVRULESDIR=%{_udevrulesdir} \
  -DUSE_QT5=ON \
  -DCMAKE_BUILD_TYPE=release \
  -DDEBUG_PRINT_INFO=OFF \
  -DBUILD_STATIC_LIBS=OFF \
  -DCMAKE_INSTALL_PREFIX=%{_prefix} \
%if 0%{?suse_version} <= 1500
  -DBUILD_EXTRAS=ON \
  -DCMAKE_INSTALL_WIRESHARKPLUGINSDIR:PATH="%{wireshark_plugindir}" \
%endif
  -DCMAKE_INSTALL_PREFIX=%{_prefix}
%make_build

%install
%cmake_install

mv %{buildroot}%{_prefix}/lib/udev/rules.d/libambit.rules %{buildroot}%{_prefix}/lib/udev/rules.d/99-libambit.rules
%suse_update_desktop_file -r -N Openambit -G Openambit %{name} Utility SyncUtility

%if ! 0%{?suse_version} > 1500
%post
%desktop_database_post
%icon_theme_cache_post
%endif

%if ! 0%{?suse_version} > 1500
%postun
%desktop_database_postun
%icon_theme_cache_postun
%endif

%post -n libambit%{currentVersion} -p /sbin/ldconfig
%post -n libmovescount%{currentVersion} -p /sbin/ldconfig
%postun
%if 0%{?suse_version} >= 1140
%desktop_database_postun
%icon_theme_cache_postun
%endif

%postun -n libambit%{currentVersion} -p /sbin/ldconfig
%postun -n libmovescount%{currentVersion} -p /sbin/ldconfig

%files
%doc README.rst
%{_bindir}/openambit
%{_datadir}/applications/%{name}.desktop
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/icons/hicolor/64x64/apps/openambit.png
%{_prefix}/lib/udev/rules.d/99-libambit.rules
%{_bindir}/openambit-cli

%files -n libambit%{currentVersion}
%{_libdir}/libambit.so.*

%files -n libmovescount%{currentVersion}
%{_libdir}/libmovescount.so.*

%files -n libambit-devel
%{_includedir}/libambit.h
%{_libdir}/libambit.so

%files -n libmovescount-devel
%{_includedir}/movescount
%{_libdir}/libmovescount.so

%if 0%{?suse_version} <= 1500
%files -n wireshark-plugin-ambit
%{wireshark_plugindir}/ambit.so
%endif

%changelog
openSUSE Build Service is sponsored by