Blob Blame History Raw
%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:        5.3.5
%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:         0001-Do-not-override-distribution-compiler-flags.patch
# Do not check the project website on startup in order to prompt the user to
# upgrade if a newer version is available. This makes sense for standalone
# installations but not for a distribution package.
Patch1:         FastTrack-5.3.5-no-version-check.patch

# https://bugzilla.redhat.com/show_bug.cgi?id=1298011
# handled by qt5-srpm-macros, which defines %%qt5_qtwebengine_arches
ExclusiveArch: %{qt5_qtwebengine_arches}

BuildRequires:  gcc-c++
BuildRequires:  make

# Note that the source is not compatible with Qt6.

# src/FastTrack.pro, src/FastTrack-Cli.pro
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(Qt5WebEngineWidgets)

# dependencies.sh
BuildRequires:  pkgconfig(opencv4)

# generateDocumentation.sh
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:  pkgconfig(gtest)
# 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
%set_build_flags

%qmake_qt5 src/FastTrack-Cli.pro
mv -v Makefile Makefile.cli
%qmake_qt5 src/FastTrack.pro
# test.sh
pushd Test
cp -r dataSet/images/Groundtruth/Tracking_Result/ \
    dataSet/images/Groundtruth/Tracking_Result_Copy/
%qmake_qt5 Test.pro
popd

%make_build -f Makefile.cli
%make_build
# test.sh
pushd Test
%make_build
popd

# We do not really need to build and install the Doxygen documentation, which
# covers the internals and is targeted at upstream developers and contributors.
# That would be useful if FastTrack were a library; for an application, we want
# only the user manual.
mkdir -p dummybin
ln -s %{_bindir}/true dummybin/doxygen
export PATH="${PWD}/dummybin:${PATH}"

bash -x ./generateDocumentation.sh


%install
%make_install -f Makefile.cli INSTALL_ROOT='%{buildroot}'
%make_install 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
%pytest Test/accuracyTest.py


%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
%doc user_manual/assets
%doc user_manual/css
%doc user_manual/user_manual.html
%doc user_manual/user_manual.pdf


%changelog
%autochangelog