File rawtherapee.spec of Package rawtherapee

%define section         Graphics
%define title           RawTherapee
%define Summary         Image processing software for high quality and efficient RAW photo development



Summary:        %Summary
Name:           rawtherapee
Version:        3.0.1
Release:        1
License:        GPLv3
%if 0%{?suse_version} >= 1120
Group:          Productivity/Graphics/Other
%endif
%if 0%{?mdkversion} >= 2009
Group:          Graphics
%endif
URL:            http://www.rawtherapee.com/

# The source for this package was pulled from upstream's vcs.
# Use the following commands to generate the tarball:
#  hg clone https://rawtherapee.googlecode.com/hg/ rawtherapee
#  cd rawtherapee
#  hg archive -r 1455 -X "rawzor*" ../rawtherapee-3.0.1.tar.bz2
  
Source0:        %{name}-%{version}.tar.bz2
Source1:        rawtherapee-icons-%{version}.tar

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot


Buildrequires:  gcc-c++
Buildrequires:  gtk2-devel >= 2.12
Buildrequires:  glib2-devel >= 2.16
Buildrequires:  cmake >= 2.6
Buildrequires:  libiptcdata-devel
Buildrequires:  libjpeg-devel
Buildrequires:  libpng-devel
Buildrequires:  libtiff-devel
Buildrequires:  zlib-devel
%if 0%{?mdkversion} >= 2009
Buildrequires:  glibmm2.4-devel >= 2.16
Buildrequires:  gtkmm2.4-devel >= 2.12
Buildrequires:  libsigc++2.0-devel
Buildrequires:  lcms-devel
Buildrequires:  libgomp-devel
%else
%if 0%{?suse_version} >= 1120
Buildrequires:  glibmm2-devel >= 2.16
Buildrequires:  gtkmm2-devel >= 2.12
Buildrequires:  libsigc++2-devel
Buildrequires:  liblcms-devel
Buildrequires:  update-desktop-files
Buildrequires:  fdupes
%else
%if 0%{?fedora} >= 12
Buildrequires:  glibmm24-devel >= 2.16
Buildrequires:  gtkmm24-devel >= 2.12
Buildrequires:  libsigc++20-devel
Buildrequires:  lcms-devel

%endif
%endif
%endif

%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
%setup -q
%setup -b 1

# fix wrong line endings
sed -i "s|\r||g" AUTHORS.txt

# Do not install docs
sed -i "s|install (FILES AUTHOR.*$||" CMakeLists.txt
sed -i "s|install (FILES LICENSE.*$||" CMakeLists.txt
sed -i "s|install (FILES AboutThisBuild.*$||" CMakeLists.txt

# Do not install useless rtstart:
sed -i "s|install (PROGRAMS rtstart|\#install (PROGRAMS rtstart|" CMakeLists.txt

# Tell version
cat > rtgui/version.h << EOF
#ifndef _VERSION_
#define _VERSION_

#define VERSION "%{version}"
#define CACHEFOLDERNAME "RawTherapee${CACHE_NAME_SUFFIX}"
#endif
EOF

# create AboutThisBuild.txt
cat > AboutThisBuild.txt << EOF
See package information
EOF

%build

%if 0%{?mdkversion} >= 2009
        %define _disable_ld_no_undefined        1
        %cmake \
                -DAUTOMATED_BUILD_SYSTEM:BOOL=ON \
                -DLIBDIR=%_libdir \
                -DDOCDIR=%{_datadir}/doc/%{name} \
                -DCREDITSDIR=%{_datadir}/doc/%{name} \
                -DLICENCEDIR=%{_datadir}/doc/%{name}
        %make
%else
        cmake \
                -DAUTOMATED_BUILD_SYSTEM:BOOL=ON \
                -DCMAKE_INSTALL_PREFIX=%{_prefix} \
                -DLIBDIR=%{_libdir} \
                -DCMAKE_BUILD_TYPE=release \
                -DBUILD_SHARED_LIBS:BOOL=ON \
                -DDOCDIR=%{_datadir}/doc/packages/%{name} \
                -DCREDITSDIR=%{_datadir}/doc/packages/%{name} \
                -DLICENCEDIR=%{_datadir}/doc/packages/%{name}
        make
%endif


%install

%if 0%{?mdkversion} >= 2009
        cd build
%endif

%__make install DESTDIR=%{buildroot}

# Icons
for size in 16 24 32 48 128 256
do
        %__install -D -m 644 %{_builddir}/%{?buildsubdir}/rtdata/icons/hi${size}-app-%{name}.png \
                %{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps/%{name}.png
done
%__install -D -m 644 %{_builddir}/%{?buildsubdir}/rtdata/icons/rawtherapee.svg \
        %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%if 0%{?mdkversion} >= 2009
        %__mkdir_p %{buildroot}%{_miconsdir}
        %__mkdir_p %{buildroot}%{_liconsdir}
        %__ln_s ./hicolor/32x32/apps/%{name}.png \
                %{buildroot}%{_iconsdir}/%{name}.png
        %__ln_s ../hicolor/16x16/apps/%{name}.png \
                %{buildroot}%{_miconsdir}/%{name}.png
        %__ln_s ../hicolor/48x48/apps/%{name}.png \
                %{buildroot}%{_liconsdir}/%{name}.png
%endif

# Create desktop file
%__mkdir_p %{buildroot}%{_datadir}/applications
%__cat > %{buildroot}%{_datadir}/applications/%{name}.desktop << EOF
[Desktop Entry]
Name=RawTherapee
GenericName=RAW photo editor and organizer
Comment=The RAW converter and digital photo processing software
Type=Application
Exec=rawtherapee %U
Terminal=false
Categories=Graphics;Photography;GTK;
Icon=%{name}
MimeType=image/x-dcraw;image/jpeg;image/png;image/tiff;image/x-adobe-dng;image/x-canon-crw;image/x-canon-cr2;image/x-fuji-raf;image/x-kodak-dcr;image/x-kodak-kdc;image/x-kodak-k25;image/x-minolta-mrw;image/x-nikon-nef;image/x-olympus-orf;image/x-panasonic-raw;image/x-pentax-pef;image/x-sony-arw;image/x-sony-srf;image/x-sony-sr2;
EOF

%if 0%{?suse_version} >= 1120
        %suse_update_desktop_file %name
        %fdupes -s %{buildroot}%{_datadir}/%{name}/images/
%endif


%if 0%{?mdkversion} >= 2009
%post
%update_desktop_database
%update_menus
%endif


%if 0%{?mdkversion} >= 2009
%postun
%clean_desktop_database
%clean_menus
%endif


%clean
%__rm -rf %buildroot


%files
%defattr(-,root,root,-)
%_bindir/*
%_libdir/*.so
%_datadir/applications/%{name}.desktop
%_datadir/%{name}/
%_datadir/icons/hicolor/*/apps/*
  
%if 0%{?mdkversion} >= 2009
%{_iconsdir}/%{name}.png
%{_miconsdir}/%{name}.png
%{_liconsdir}/%{name}.png
%endif

%doc AUTHORS.txt LICENSE.txt AboutThisBuild.txt
openSUSE Build Service is sponsored by