Blob Blame History Raw
%global link_tcmalloc 1
%global development 1

%if 0%{?development}
%global commit 68ec1a5bb50b496e255a0b843c36345fbeff2468
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%endif

Name:           rawtherapee
Version:        5.9~20220525git%{shortcommit}
Release:        %autorelease
Summary:        Raw image processing software

License:        GPLv3 and MIT and IJG
URL:            http://www.rawtherapee.com/

%if 0%{?development}
Source0:        https://github.com/Beep6581/RawTherapee/archive/RawTherapee-%{commit}.tar.gz
# File created with ./create_ReleaseInfo.sh 5.9 68ec1a5 2022-05-25
Source1:        create_ReleaseInfo.sh
Source2:        ReleaseInfo.cmake
%else
Source0:        https://github.com/Beep6581/RawTherapee/releases/download/%{version}/%{name}-%{version}.tar.xz
%endif

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
%if 0%{?development}
%autosetup -p1 -n RawTherapee-%{commit}
cp -p %SOURCE2 .
%else
%autosetup -p1 -n %{name}-%{version}
%endif

# 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
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg


%changelog
%autochangelog