File moolticute-testing.spec of Package moolticute-testing

#
# spec file for package moolticute
#
# Copyright (c) 2021 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/
#

%if "%{_vendor}" == "debbuild"
%global QMAKE_BIN %{_prefix}/lib/qt5/bin/qmake
%global UDEVDIR /etc/udev/rules.d
%else
%global UDEVDIR %{_udevrulesdir}
%global QMAKE_BIN qmake6
%endif

Name:           moolticute-testing
Version:        0.46.3.r0.g7fb1749
Release:        0
Summary:        Companion GUI application for Mooltipass password manager devices
License:        GPL-3.0
URL:            https://github.com/mooltipass/moolticute
Source0:        %{name}-%{version}.tar.gz
Source1:        _service
Source2:        69-mooltipass.rules
Conflicts:      moolticute
%if "%{_vendor}" == "debbuild"
BuildRequires: pkg-config
BuildRequires: libqt5websockets5-dev 
# Ubuntu only?
# BuildRequires: qt-sdk
BuildRequires: qt5-qmake
BuildRequires: qt5-qmake-bin

%if 0%{?debian_version:%{debian_version} == 1000}
BuildRequires: qt5-default
%endif

Buildrequires: qttools5-dev-tools
BuildRequires: libudev-dev
Vendor:        fawz
%else
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(Qt6Core)
BuildRequires:  pkgconfig(Qt6Gui)
BuildRequires:  pkgconfig(Qt6UiTools)
BuildRequires:  pkgconfig(Qt6Linguist)
BuildRequires:  pkgconfig(Qt6Widgets)
BuildRequires:  pkgconfig(Qt6Network)
BuildRequires:  pkgconfig(Qt6WebSockets)
BuildRequires:  pkgconfig(Qt6Test)
BuildRequires:  pkgconfig(Qt6DBus)
BuildRequires:  pkgconfig(libudev)
%endif

# For debbuild, which converts this to "Maintainer"
%if "%{_vendor}" == "debbuild"
Packager:       fawz
%endif



%description
This project aims to be an easy to use companion to your Mooltipass device and extend the power of the device to more platform/tools. With it you can manage your Mooltipass with a cross-platform app, as well as provide a daemon service that handles all USB communication with the device.

This tool comes with a daemon that runs in background, and a user interface app to control your Mooltipass. Other clients can also connect and talk to the daemon (it uses a websocket connection and simple JSON messages).

It is completely cross platform, and runs on Linux (using native hidraw API), OS X (native IOKit API), and Windows (native HID API).

%prep
%autosetup

sed -i "s/APP_VERSION \"git\"/APP_VERSION \"%{version}\"/" %_sourcedir/%name-%version/src/version.h

%build

%{QMAKE_BIN} PREFIX=%{_prefix} DESTDIR= %{_sourcedir}/%name-%version/Moolticute.pro
%if "%{_vendor}" != "debbuild"

%make_build sub-daemon-pro-all sub-gui-pro-all

%else

%if 0%{?debian_version:%{debian_version} >= 1100}
export QT_SELECT="qt5"
qtchooser -qt5
%endif

make -O -j$(nproc) V=1 VERBOSE=1 sub-daemon-pro-all sub-gui-pro-all

%endif


%install

# Debbuild doesn't clean up automatically
%if "%{_vendor}" == "debbuild"
rm -rf %{buildroot}/%name-%version
mkdir -p %{buildroot}
mkdir %{buildroot}/%name-%version
%endif

install -d 555 %{buildroot}%{_sbindir}
install -d 555 %{buildroot}%{_bindir}
install -d 755 %{buildroot}%{UDEVDIR}
install -m 644 %{_sourcedir}/69-mooltipass.rules %{buildroot}%{UDEVDIR}/.

%make_install PREFIX=%{_prefix} INSTALL_ROOT="%{buildroot}"

ln -s %{_prefix}/sbin/service %{buildroot}%{_prefix}/sbin/rcmoolticuted

%if "%{_vendor}" == "debbuild"
cp %{_sourcedir}/%name-%version/LICENSE %{_builddir}
%endif

# Remove unneeded header file
# https://github.com/mooltipass/moolticute/issues/1230
rm %{buildroot}%{_prefix}/include/QZXing.h
rm %{buildroot}%{_prefix}/include/QZXing_global.h

%files
%license LICENSE
%{_bindir}/moolticute
%{_bindir}/moolticuted
%{UDEVDIR}/69-mooltipass.rules
%{_sbindir}/rcmoolticuted
/usr/lib/systemd/system/moolticuted.service
/usr/share/applications/moolticute.desktop
%dir /usr/share/icons/hicolor
%dir /usr/share/icons/hicolor/32x32
%dir /usr/share/icons/hicolor/32x32/apps
%dir /usr/share/icons/hicolor/128x128
%dir /usr/share/icons/hicolor/128x128/apps
%dir /usr/share/icons/hicolor/scalable
%dir /usr/share/icons/hicolor/scalable/apps/
/usr/share/icons/hicolor/128x128/apps/moolticute.png
/usr/share/icons/hicolor/32x32/apps/moolticute.png
/usr/share/icons/hicolor/scalable/apps/moolticute.svg
/usr/share/metainfo/moolticute.metainfo.xml

%if "%{_vendor}" != "debbuild"
%pre
%service_add_pre moolticuted.service

%post
%service_add_post moolticuted.service

%preun
%service_del_preun moolticuted.service

%postun
%service_del_postun moolticuted.service
%endif

%changelog
openSUSE Build Service is sponsored by