Blob Blame History Raw
%global wireshark_ver 1.10.12
%global commit 5f2b7840d91121b44a9a16ac6d945b103a94c5a3
%global shortcommit %(c=%{commit}; echo ${c:0:7})

Name:           openambit
Version:        0.3
Release:        2%{?commit:.git%shortcommit}%{?dist}
Summary:        Open software for the Suunto Ambit(2)

License:        GPLv3+

# Fix some issues with the desktop file (upstreamed)
Patch0:         openambit_desktop-file.patch
# Add appdata file
Patch1:         openambit_appdata.patch
# Fix -Wstrict-aliasing issues, see
Patch2:         openambit_strict-aliasing-fixes.patch
# Fix -Wmaybe-uninitialized, see
Patch3:         openambit_fix-maybe-uninitialized.patch
# Unbundle hidapi (see also %%prep)
Patch4:         openambit_unbundle-hidapi.patch

BuildRequires:  cmake
BuildRequires:  desktop-file-utils
BuildRequires:  libappstream-glib
BuildRequires:  qjson-devel
BuildRequires:  qt4-devel
BuildRequires:  systemd-devel
BuildRequires:  wireshark-devel = %{wireshark_ver}
BuildRequires:  hidapi-devel

Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
Requires:       hicolor-icon-theme

Openambit is application for downloading moves from the Suunto
Ambit(2) outdoor watches, and synchronizing them with the
movescount website.

%package libs
Summary:        Libraries for %{name}
# For %%{_sysconfdir}/udev/rules.d/ ownership
Requires:       systemd

%description libs
The %{name}-libs package contains libraries for %{name}.

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}

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

%package        wireshark
Summary:        Wireshark dissector for %{name}
Requires:       wireshark%{?_isa} = %{wireshark_ver}
License:        BSD

%description    wireshark
The %{name}-wireshark package contains the Wireshark dissector for %{name},
which parses pcap-files made with usbpcap.

%setup -q -n %{name}-%{?commit:%commit}%{!?commit:%version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1

# Remove exec permissions since it is installed as %%doc
chmod -x tools/

# Remove bundled hidapi files
rm -rf src/libambit/hidapi

# libambit (using libambit-build since Findlibambit looks for the library there)
mkdir src/libambit-build
cd src/libambit-build
%cmake ../libambit
make %{?_smp_mflags}

# openambit 
mkdir src/openambit-build
cd src/openambit-build
%cmake ../openambit
make %{?_smp_mflags}

# wireshark dissector
mkdir wireshark_dissector-build
cd wireshark_dissector-build
%cmake ../wireshark_dissector
make %{?_smp_mflags}

%make_install -C src/libambit-build
%make_install -C src/openambit-build
install -Dpm 0755 wireshark_dissector-build/ %{buildroot}%{_libdir}/wireshark/plugins/%{wireshark_ver}/

%{_bindir}/appstream-util validate %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml || :
%{_bindir}/desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop

/usr/bin/update-desktop-database &> /dev/null || :
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

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

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

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig

%license src/openambit/COPYING

%files libs
%license src/libambit/COPYING

%files devel
%doc src/example/ambitconsole.c
%doc tools/*

%files wireshark
%license wireshark_dissector/COPYING

* Tue Jan 27 2015 Sandro Mani <> - 0.3-2.git5f2b784
- Bump wireshark version
- Fix License
- Add openambit_strict-aliasing-fixes.patch
- Add openambit_fix-maybe-uninitialized.patch
- Unbundle hidapi

* Sat Dec 27 2014 Sandro Mani <> - 0.3-1.git5f2b784
- Initial package