%global forgeurl https://github.com/FastTrackOrg/FastTrack
%global app_id sh.fasttrack.fasttrack
# We don’t install the .desktop file for the CLI tool, because it is useless—a
# terminal window just appears briefly with an error message asking the user to
# provide the many necessary arguments.
%bcond_with cli_desktop_file
Name: fasttrack
Summary: Multiple objects tracking software, easy to use, and performant.
Version: 6.0.1
%forgemeta
Release: %autorelease
URL: %{forgeurl}
# The entire source is GPLv3+, except src/assets/dark.qss and
# src/assets/light.qss, which are MIT; the effective license remains GPLv3+.
License: GPLv3+
Source0: %{forgesource}
# Downstream man page in groff_man(7) format, based on --help output
Source1: fasttrack-cli.1
# Do not override distribution compiler flags. This unconditionally patches out
# optimization flags upstream would prefer, so it is not suitable for offering
# upstream.
Patch0: FastTrack-6.0.1-do-not-override-compiler-flags.patch
# Allow building fasttrack-cli without QtWebEngine
# [fix] cli: remove unnecessary webengine requirement
Patch1: %{forgeurl}/commit/3faaade815aa2a0a88677467f5d30c36b5d22801.patch
# Improvements to documentation generator script
# [docs] global: improve error detection
Patch2: %{forgeurl}/commit/551dd145e3e748580d6882274bda9b2a3866c60b.patch
# [docs] global: add optional arguments to docs generation
Patch3: %{forgeurl}/commit/a5bde9ec7d31db0c34e3bde86fb40b6528a654a1.patch
# [docs] global: refactore user manual generation
Patch4: %{forgeurl}/commit/48c1b6911c1287d064fd0f389eb588066411a5cd.patch
# qt6-qtbase missing on s390x
# https://bugzilla.redhat.com/show_bug.cgi?id=2012824
ExcludeArch: s390x
BuildRequires: gcc-c++
BuildRequires: make
# Currently, there is no qt6-qtwebengine package in Fedora, so we must build
# with NO_WEB enabled. This has three consequences:
#
# 1. The check for a newer available version at startup—which we would have
# patched out in src/mainwindow.cpp anyway, as it is not really suitable
# for a distribution package—does not occur.
# 2. The user manual browser for the online documentation is not available.
# 3. The package no longer needs to be
# ExclusiveArch: %%{qt6_qtwebengine_arches}
#
# Overall, this is satisfactory.
# src/FastTrack.pro, src/FastTrack-Cli.pro:
# Qt components: core, gui, network, svg, widgets
BuildRequires: qt6-qtbase-devel
BuildRequires: qt6-qtsvg-devel
# dependencies.sh, src/FastTrack.
BuildRequires: pkgconfig(opencv4)
# generateDocumentation.sh: user manual
BuildRequires: pandoc
# rsvg-convert, needed by pandoc to generate PDF
BuildRequires: librsvg2-tools
# pdflatex, needed by pandoc to generate PDF
BuildRequires: tex(latex)
# Test/Test.pro
BuildRequires: gtest-devel
# test.sh
BuildRequires: python3-devel
BuildRequires: python3dist(pytest)
# Test/accuracyTest.py
BuildRequires: python3dist(numpy)
BuildRequires: python3dist(pandas)
BuildRequires: desktop-file-utils
BuildRequires: libappstream-glib
# For /usr/share/icons/hicolor/*/apps
Requires: hicolor-icon-theme
%global common_description %{expand:
Tracking objects in video recording can be tedious. Existing software are
expensive, the learning curve can be steep, necessitate a powerful computer,
and the workflow can not be easily adapted when the project evolved.
FastTrack is a free (as freedom) desktop tracking software, easy to install,
easy to use, and performant. The software can be downloaded for Linux, macOS,
and Windows, and a public API is available to embed the core of the software in
any C++/Qt project.
Two main features are implemented in the software:
• An automatic tracking algorithm that can detect and track objects
(conserving the objects’ identities across the video recording).
• A manual review of the tracking where errors can be corrected rapidly and
easily to achieve 100% accuracy.}
%description %{common_description}
This package contains the graphical user interface (fasttrack).
%package cli
Summary: %{summary}
%if %{with cli_desktop_file}
# For /usr/share/icons/hicolor/*/apps
Requires: hicolor-icon-theme
%endif
%description cli %{common_description}
This package contains the command-line tool (fasttrack-cli).
%package doc
Summary: Documentation for FastTrack
BuildArch: noarch
%description doc %{common_description}
This package contains the user manual.
%prep
%forgeautosetup -p1
cp -p '%{SOURCE1}' .
%build
pushd Test
%qmake_qt6 Test.pro
popd
%qmake_qt6 'CONFIG += NO_WEB' src/FastTrack-Cli.pro
mv Makefile Makefile-cli
%qmake_qt6 'CONFIG += NO_WEB' src/FastTrack.pro
%make_build
%make_build -f Makefile-cli
pushd Test
%make_build -f Makefile
popd
bash -x ./generateDocumentation.sh user
%install
%make_install INSTALL_ROOT='%{buildroot}'
%make_install -f Makefile-cli INSTALL_ROOT='%{buildroot}'
# This is not the right place to install a raster icon; it should go in
# %%{_datadir}/icons/hicolor/SIZExSIZE/apps/.
rm -vf %{buildroot}%{_datadir}/icons/fasttrack.png
# Furthermore, it is 756x756, so we
# should rescale it to one or more standard sizes instead (16x16, 22x22, 24x24,
# 32x32, 36x36, 48x48, 64x64, 72x72, 96x96, 128x128, 192x192, 256x256, 512x512)
# and install in the corresponding directory or directories.
#
# To keep things simple, we install the scalable icon instead.
install -D -p -m 0644 'src/assets/icon.svg' \
'%{buildroot}%{_datadir}/icons/hicolor/scalable/apps/fasttrack.svg'
install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 fasttrack-cli.1
%check
appstream-util validate-relax --nonet \
'%{buildroot}%{_metainfodir}/%{app_id}.metainfo.xml'
desktop-file-validate \
%if %{with cli_desktop_file}
'%{buildroot}%{_datadir}/applications/%{app_id}cli.desktop' \
%endif
'%{buildroot}%{_datadir}/applications/%{app_id}.desktop'
# test.sh
pushd Test/build
./Test
popd
pushd Test
%pytest accuracyTest.py
popd
%files
%license LICENSE
%doc changelog.md
%doc contributing.md
%doc readme.md
%{_bindir}/fasttrack
%{_metainfodir}/%{app_id}.metainfo.xml
%{_datadir}/applications/%{app_id}.desktop
%{_datadir}/icons/hicolor/scalable/apps/fasttrack.svg
%files cli
%license LICENSE
%{_bindir}/fasttrack-cli
%{_mandir}/man1/fasttrack-cli.1*
%if %{with cli_desktop_file}
%{_datadir}/applications/%{app_id}cli.desktop
# Icons are intentionally shared between base and -cli packages, as they are
# used in both desktop files, but a -data or -common subpackage would be
# overkill for icons.
%{_datadir}/icons/hicolor/scalable/apps/fasttrack.svg
%endif
%files doc
%license LICENSE
# Package only the PDF user manual, because the HTML one has a small amount of
# pre-minified GitHub CSS, which is not acceptable:
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Web_Assets/#_css
%doc manual/user/user_manual.pdf
%changelog
%autochangelog