%global link_tcmalloc 1
Name: rawtherapee
Version: 5.8
Release: %autorelease
Summary: Raw image processing software
License: GPLv3 and MIT and IJG
URL: http://www.rawtherapee.com/
Source0: https://github.com/Beep6581/RawTherapee/releases/download/%{version}/%{name}-%{version}.tar.xz
# Fix linking against system's KLT
# Upstream PR https://github.com/Beep6581/RawTherapee/pull/5539
Patch: RT_5.8_system_klt.patch
# Backport patch for fixing rhbz#1820907
Patch: RT_5.8_fix_crop.patch
# Backport patch for fixing build with glibc 2.34
# https://github.com/Beep6581/RawTherapee/issues/6324
Patch: RT_5.8_glibc234.patch
# Backport patch for fixing Canon sRAW/mRAW
# https://github.com/Beep6581/RawTherapee/issues/5898
Patch: RT_5.8_fix_canon_sraw.patch
BuildRequires: cmake
BuildRequires: desktop-file-utils
BuildRequires: gcc-c++
BuildRequires: klt-devel
BuildRequires: libappstream-glib
BuildRequires: libatomic
BuildRequires: pkgconfig(exiv2)
BuildRequires: pkgconfig(expat)
BuildRequires: pkgconfig(fftw3f)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(glibmm-2.4)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(gtkmm-3.0)
BuildRequires: pkgconfig(lcms2)
BuildRequires: pkgconfig(lensfun)
BuildRequires: pkgconfig(libcanberra)
BuildRequires: pkgconfig(libiptcdata)
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(librsvg-2.0)
%if 0%{?link_tcmalloc}
BuildRequires: pkgconfig(libtcmalloc)
%endif
BuildRequires: pkgconfig(libtiff-4)
BuildRequires: pkgconfig(sigc++-2.0)
BuildRequires: pkgconfig(zlib)
Requires: hicolor-icon-theme
# https://fedorahosted.org/fpc/ticket/530
# to find: `grep DCRAW_VERSION: rawtherapee-*/rtengine/dcraw.c`
Provides: bundled(dcraw) = 9.27
%description
Rawtherapee is a RAW image processing software. It gives full control over
many parameters to enhance the raw picture before finally exporting it
to some common image format.
%prep
%autosetup -p1 -n %{name}-%{version}
# fix wrong line endings
sed -i "s|\r||g" LICENSE.txt
# remove bundled KLT, so we're sure to use system provided KLT
rm -rf rtengine/klt/
%build
# do not build shared libs
# https://github.com/Beep6581/RawTherapee/pull/5479
%{cmake} %{?BUILD_TESTS} \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DLIBDIR=%{_libdir} \
-DCMAKE_BUILD_TYPE=release \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DAUTOMATED_BUILD_SYSTEM:BOOL=ON \
-DCACHE_NAME_SUFFIX="" \
-DCMAKE_CXX_FLAGS="$RPM_OPT_FLAGS" \
-DCMAKE_C_FLAGS="$RPM_OPT_FLAGS" \
%if 0%{?link_tcmalloc}
-DENABLE_TCMALLOC=ON \
%endif
-DWITH_SYSTEM_KLT=ON
%cmake_build
%install
%cmake_install
# These file are taken from the root already
rm -rf %{buildroot}/%{_datadir}/doc
%check
desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/com.%{name}.RawTherapee.appdata.xml
%files
%doc AUTHORS.txt LICENSE.txt RELEASE_NOTES.txt
%{_mandir}/man1/%{name}.1.gz
%{_bindir}/%{name}
%{_bindir}/%{name}-cli
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/metainfo/com.%{name}.RawTherapee.appdata.xml
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%changelog
%autochangelog