%global optflags %(echo %{optflags} -fPIE)
%global common_options \\\
    LEGACY=1 \\\
    BUILD=debug \\\
    TRACY_NO_ISA_EXTENSIONS=1

Name:           tracy
Version:        0.10
Release:        2
Summary:        Frame profiler

License:        BSD-3-Clause
URL:            https://github.com/wolfpld/tracy
Source0:        %{url}/archive/refs/tags/v%{version}/%{name}-%{version}.tar.gz

BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  make
BuildRequires:  pkgconfig(glfw3)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(capstone)
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(tbb)

%description
A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications.

%prep
%autosetup

%build
pushd profiler/build/unix
%make_build -f legacy.mk %{common_options}
popd

pushd capture/build/unix
%make_build -f build.mk %{common_options}
popd

%install

mkdir -p %{buildroot}%{_bindir}
install -p -Dm755 profiler/build/unix/Tracy-debug %{buildroot}%{_bindir}/tracy-profiler
install -p -Dm755 capture/build/unix/capture-debug %{buildroot}%{_bindir}/tracy-capture

%files
%license LICENSE
%{_bindir}/tracy-profiler
%{_bindir}/tracy-capture

%changelog
* Thu Feb 22 2024 Jan Drögehoff <sentrycraft123@gmail.com> - 0.10-2
- Rebuilt for Fedora 40

* Sat Oct 28 2023 Jan Drögehoff <sentrycraft123@gmail.com> - 0.10-1
- Update to 0.10

* Tue May 02 2023 Jan Drögehoff <sentrycraft123@gmail.com> - 0.9.1-1
- Initial spec