File testmanager-ng.spec of Package testmanager-ng

#
# This file is part of Testmanager NG.
#
# Testmanager NG is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# Testmanager NG is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# Testmanager NG. If not, see <http://www.gnu.org/licenses/>.
#
# vim: tw=78 spelllang=en
#

%define use_qt6 (0%{?suse_version} > 1600)

Name: testmanager-ng
Version: 0 # written by set_version service
Release: 1

Summary: Testmanager NG
License: GPL-3.0+
Vendor: Ingenieurgemeinschaft IgH GmbH
Group: Productivity/Other
Url: http://etherlab.org/en/testmanager
Source0: testmanager-ng-%{version}.tar.bz2

Requires: desktop-file-utils
Requires: shared-mime-info
Requires: python3
Requires: python3-numpy

BuildRequires: desktop-file-utils
%if %use_qt6
BuildRequires: libQt6PdCom1-devel
BuildRequires: libQt6PdWidgets2-devel
%else
BuildRequires: libQtPdCom1-devel
BuildRequires: libQtPdWidgets2-devel
%endif
BuildRequires: libpdcom5-devel
BuildRequires: python3-devel
BuildRequires: python3-numpy
BuildRequires: shared-mime-info

%if 0%{?suse_version}
%if %use_qt6
BuildRequires: qt6-core-devel
BuildRequires: qt6-network-devel
BuildRequires: qt6-svg-devel
BuildRequires: qt6-test-devel
BuildRequires: qt6-widgets-devel
BuildRequires: qt6-qt5compat-devel
BuildRequires: qt6-base-common-devel
BuildRequires: qt6-xml-devel
BuildRequires: qt6-linguist-devel
BuildRequires: qt6-tools-linguist
%else
BuildRequires: libQt5Core-devel
BuildRequires: libQt5Network-devel
BuildRequires: libQt5Svg-devel
BuildRequires: libQt5Test-devel
BuildRequires: libQt5Widgets-devel
BuildRequires: libqt5-qtbase-common-devel
BuildRequires: libqt5-qtsvg-devel
BuildRequires: libqt5-qttools-devel
# use_qt6
%endif
BuildRequires: python3-numpy-devel
%else
BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-qtsvg-devel
BuildRequires: qt5-qttools-devel
%endif

%description
Testmanager NG ist the sequel of the automation and visualisation tool by
Dr. Wilhelm Hagemeister.

%prep
%setup

%build
%cmake \
%if %use_qt6
    -DUSE_QT6=1 \
    -DPUT_QT_MAJOR_INTO_LIBNAME=1 \
%endif
    -DVERSION=%{version}

%cmake_build

%install
%cmake_install

# Rename binaries and share directory with suffix -ng
mv %{buildroot}%{_bindir}/testmanager \
    %{buildroot}%{_bindir}/testmanager-ng
mv %{buildroot}%{_datadir}/testmanager \
    %{buildroot}%{_datadir}/testmanager-ng

# Change references in desktop and mime files
sed -i s/Exec=testmanager/Exec=testmanager-ng/ testmanager.desktop
sed -i s/Icon=testmanager/Icon=testmanager-ng/ testmanager.desktop
sed -i s/Manager/Manager\ NG/ testmanager.desktop
sed -i s:application/testmanager:application/testmanager-ng: \
    testmanager.desktop testmanager-mime.xml

# Install desktop file
mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/applications
cp testmanager.desktop \
    ${RPM_BUILD_ROOT}%{_datadir}/applications/testmanager-ng.desktop

# Install images
IMGDIR=${RPM_BUILD_ROOT}%{_datadir}/icons/hicolor/scalable/apps
mkdir -p $IMGDIR
cp images/testmanager.svg $IMGDIR/testmanager-ng.svg
cp images/testmanager-layout.svg $IMGDIR/testmanager-ng-layout.svg

# Install MIME file
mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/mime/packages
cp testmanager-mime.xml \
    ${RPM_BUILD_ROOT}%{_datadir}/mime/packages/testmanager-ng-mime.xml

%post
%{_bindir}/update-mime-database %{_datadir}/mime
touch %{_datadir}/icons/hicolor
%{_bindir}/update-desktop-database

%postun
%{_bindir}/update-mime-database %{_datadir}/mime
touch %{_datadir}/icons/hicolor
%{_bindir}/update-desktop-database

%files
%defattr(-,root,root)
%{_bindir}/testmanager-ng
%{_datadir}/applications/testmanager-ng.desktop
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/scalable
%dir %{_datadir}/icons/hicolor/scalable/apps
%{_datadir}/icons/hicolor/scalable/apps/testmanager-ng.svg
%{_datadir}/icons/hicolor/scalable/apps/testmanager-ng-layout.svg
%{_datadir}/mime/packages/testmanager-ng-mime.xml
%{_datadir}/testmanager-ng
%{_datadir}/testmanager-ng/example.tml

%changelog
* Fri Mar 17 2023 fp@igh.de
- Disabled syntax highlighting
* Fri Feb 23 2018 fp@igh.de
- Desktop files and icons
* Thu Feb 1 2018 fp@igh.de
- Initial revision

openSUSE Build Service is sponsored by