gmic/gmic.spec

350 lines
12 KiB
RPMSpec

#
# spec file for package gmic
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# Detect SLES12
%if 0%{?suse_version} == 1315
%define no_opencv 1
%if 0%{?suse_version} > 0 && 0%{?suse_version} < 1110
%define no_opencv 1
%else
%define no_opencv 0
%endif
%endif
Name: gmic
Version: 1.6.8
Release: 0
Group: Productivity/Graphics/Bitmap Editors
URL: http://gmic.sourceforge.net/
Packager: kurt@garloff.de
Source: %{name}_%{version}.tar.bz2
Source1: http://gmic.eu/gmic_reference.pdf
Patch1: gmic-cflags.diff
Patch2: gmic-docdir.diff
Patch3: gmic-overflow.diff
Patch10: gmic-x11opts.diff
Patch11: gmic-openmp.diff
Patch15: gmic-oldgimp.diff
Patch20: gmic-zart-qmake.diff
Patch21: gmic-make-zart.diff
Patch31: gmic-unstrip.diff
Summary: GREYC's Magick for Image Computing (denoise and others)
License: CECILL v.2.0 (GPL compatible)
Prefix: /usr
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: procps
BuildRequires: fftw3-devel
BuildRequires: gcc-c++
BuildRequires: libstdc++-devel
BuildRequires: dos2unix
BuildRequires: OpenEXR-devel
BuildRequires: libqt4-devel
BuildRequires: libcurl-devel
%if 0%{?suse_version} >= 1110
BuildRequires: libjpeg-devel
BuildRequires: libtiff-devel
BuildRequires: fftw3-threads-devel
%if 0%{?no_opencv} == 0
BuildRequires: opencv-devel
BuildRequires: libjasper1
%endif
#BuildRequires:cuGraphicsMagick-devel
%else
%if 0%{?fedora_version} > 16
BuildRequires: libjpeg-devel
BuildRequires: libtiff-devel
BuildRequires: opencv-devel
BuildRequires: jasper-libs
#BuildRequires: fftw-libs-threads
%else
%if 0%{?mandriva_version} > 0
BuildRequires: libtiff-devel
%endif
%endif
%endif
%if 0%{?suse_version} == 1030
BuildRequires: gimp-unstable-devel
%else
BuildRequires: gimp-devel
%endif
%if 0%{?sles_version} == 11
BuildRequires: glib2-branding-SLES
%endif
%define openSUSE_submit 1
%description
G'MIC is an open and full-featured framework for image processing, providing several different user interfaces to convert/manipulate/filter/visualize generic image datasets, from 1d scalar signals to 3d+t sequences of multi-spectral volumetric images. Technically speaking, what it does is:
Define a lightweight but powerful script language (the G'MIC language) dedicated to the design of image processing operators and pipelines.
Provide several user interfaces embedding the corresponding interpreter:
A command-line executable gmic, to use the G'MIC framework from a shell.
In this setting, G'MIC may be seen as a serious (and friendly) competitor of the ImageMagick or GraphicsMagick software suites.
A plug-in gmic_gimp, to bring G'MIC capabilities to the GIMP image retouching software. (gmic-gimp)
A web service G'MIC Online, to allow users applying image processing algorithms directly in a web browser.
A Qt-based interface ZArt, for real-time mainpulation of webcam images. (gmic-zart)
A C++ library libgmic, to be linked to third-party applications. (libgmic1, gmic-devel)
G'MIC is focused on the design of possibly complex pipelines for converting, manipulating, filtering and visualizing generic 1d/2d/3d multi-spectral image datasets. This includes of course color images, but also more complex data as image sequences or 3d(+t) volumetric float-valued datasets.
G'MIC is an open framework: the default language can be extended with custom G'MIC-written commands, defining thus new available image filters or effects. By the way, G'MIC already contains a substantial set of pre-defined image processing algorithms and pipelines (more than 1000).
G'MIC has been designed with portability in mind and runs on different platforms (Windows, Unix, MacOSX). It is distributed under the CeCILL license (GPL-compatible). Since 2008, it is developed in the Image Team of the GREYC laboratory, in Caen/France, by permanent researchers working in the field of image processing on a daily basis.
G'MIC has superior denoising and sharpening capabilities.
Authors
-------
David Tschumperle ( http://www.greyc.ensicaen.fr/~dtschump/ ) (source code)
Claude Bulin ( http://www.xcfa.tuxfamily.org/ ) (packaging)
Angelo Lama ( historical developper of EKD : http://ekd.tuxfamily.org,
post-prod software for videos and images) (testing)
Stephane de la Linuxerie (http://linuxerie.midiblogs.com and http://polariscorp.free.fr) (design & gimp plug-in)
Jerome Ferrari (testing)
GREYC Image / CNRS UMR 6072 / FRANCE
Team web page : http://www.greyc.ensicaen.fr/EquipeImage/
%package -n libgmic1
Summary: Shared library that belongs to gmic
Group: Productivity/Graphics/Bitmap Editors
%package -n libgmic-devel
Summary: Header and library from gmic for use in other C++ projects
Group: Development/Libraries/C and C++
Requires: libgmic1 = %{version}
%description -n libgmic1
Shared library allows you to use gmic functionality from other
programs.
%description -n libgmic-devel
Header and library from gmic to needed to develop C++ code that
uses the gmic functionality provided by the gmic library.
%package gimp
Summary: GMIC plugin for gimp
Group: Productivity/Graphics/Bitmap Editors
%description gimp
This is a plugin for gimp that exposes many of the nice gmic features
for interactive use in gimp.
%if 0%{?no_opencv} == 0
%package zart
Summary: Real-time web cam video stream manipulation
Group: Productivity/Graphics/Bitmap editors
%description zart
This program allows you to capture video from a web cam and apply
(real time) gmic image manipulations on the video stream.
%endif
%package doc
Summary: GMIC reference documentation
Group: Productivity/Graphics/Bitmap editors
License: GFDL-v1.3
%description doc
This is the reference documentation for G'MIC in .pdf format.
%prep
%setup
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch10 -p1
%patch11 -p1
%if 0%{?suse_version} <= 1120
%patch15 -p1
%endif
# More gmic features ... opencv
%if 0%{?no_opencv} == 0
#%patch15 -p1
%endif
#%patch17 -p1
%patch20 -p1
%patch21 -p1
%patch31 -p1
# Remove build time references so build-compare can do its work
FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M')
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
sed -i "s/__TIME__/\"$FAKE_BUILDTIME\"/g" src/CImg.h
sed -i "s/__DATE__/\"$FAKE_BUILDDATE\"/g" src/CImg.h
sed -i "s/__TIME__/\"$FAKE_BUILDTIME\"/g" src/gmic.cpp
sed -i "s/__DATE__/\"$FAKE_BUILDDATE\"/g" src/gmic.cpp
# Replacement for documentation that was formerly included
echo -e "<HTML>\n<Head><Title>G'MIC documentation</Title></Head>" > index.html
echo -e "<Body><H1>G'MIC documentation links</H1>\n<ul>" >> index.html
echo -e "<li><A HRef=\"http://gmic.sourceforge.net/reference.shtml\">Reference documentation</A></li>" >> index.html
echo -e "<li><A HRef=\"../gmic-doc/gmic_reference.pdf\">Reference doc (PDF)</A> (local copy, if gmic-doc is installed)</li>" >> index.html
echo -e "<li><A HRef=\"http://gmic.sourceforge.net/tutorial.shtml\">Tutorial</A></li>" >> index.html
echo -e "<li><A HRef=\"https://www.flickr.com/groups/gmic/discuss/72157625021897552/\">What can I do with G'MIC?</A> (Tutorial list on flickr)</li>" >> index.html
echo -e "<li><A HRef=\"README\">README file</A> (local)</li>" >> index.html
echo -e "</ul>\n</Body>\n</HTML>" >> index.html
mv zart/README zart/README.zart
cp -p %{SOURCE1} .
%build
RPM_OPT_FLAGS="`echo $RPM_OPT_FLAGS | sed 's/-fstack-protector//'`"
#RPM_OPT_FLAGS="$RPM_OPT_FLAGS -O3 -ffast-math -ftree-vectorize"
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -ffast-math"
GCCVER=`gcc -v 2>&1 | tail -n1 | sed -e 's/^gcc version \([^ ]*\) .*$/\1/' -e 's/\.//g'`
if test $GCCVER -ge 480; then RPM_OPT_FLAGS="$RPM_OPT_FLAGS -fno-ipa-sra"; fi
if test $GCCVER -ge 480 -a $GCCVER -le 482; then MAKEFLAGS="NO_OPENMP=1"; fi
if test $GCCVER -le 445; then sed -i 's/\-std=c++11//' src/Makefile; fi
if test $GCCVER -le 440; then MAKEFLAGS="NO_OPENMP=1"; fi
# Compile times are exorbitant as are, -funroll-loops makes it worse
#RPM_OPT_FLAGS="$RPM_OPT_FLAGS -funroll-loops"
%ifarch %{ix86} x86_64
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -momit-leaf-frame-pointer"
%endif
%if 0%{?openSUSE_submit} == 0
%ifarch %{ix86}
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -mmmx -msse -mfpmath=sse,387"
%endif
%endif
%if 0%{?fedora_version} > 19
RPM_OPT_FLAGS="`echo $RPM_OPT_FLAGS | sed 's/-strong//'`"
%endif
# gcc-4.3 needs -fno-tree-pre, see gcc bug 36439
GCCVER="`gcc --version | head -n1 | sed 's/^gcc[^0-9]*\([^ ]*\).*$/\1/'`"
#echo $GCCVER
case $GCCVER in 4.3*)
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -fno-tree-pre"
;;
4.5*)
RPM_OPT_FLAGS="`echo $RPM_OPT_FLAGS | sed 's/\-funroll\-loops //'`"
;;
esac
# Limit parallel build to avoid overloading machines
free -m
MEM=`free -m | grep '^Mem:' | sed 's/^Mem: *\([0-9]*\).*$/\1/'`
# x86(-64) needs 0.6GB per gmic_XXX except gmic_float (main) with 1 GB
MAXJOBS=$((($MEM-300)/540))
echo "Limiting Jobs %jobs -> $MAXJOBS"
if test -n "%jobs" -a $MAXJOBS -gt 1; then
if test %jobs -gt $MAXJOBS; then
JOBS="-j$MAXJOBS"
else
JOBS="-j%jobs"
fi
else
JOBS=""
fi
#make CFLAGS="$RPM_OPT_FLAGS"
cd src
%if 0%{?fedora_version} > 16
make $JOBS $MAKEFLAGS CFLAGS="$RPM_OPT_FLAGS" LIB=%{_lib} QMAKE=qmake-qt4 cli
make $JOBS $MAKEFLAGS CFLAGS="$RPM_OPT_FLAGS" LIB=%{_lib} QMAKE=qmake-qt4 gimp lib
make $JOBS $MAKEFLAGS CFLAGS="$RPM_OPT_FLAGS" LIB=%{_lib} QMAKE=qmake-qt4 zart
%else
make $JOBS $MAKEFLAGS CFLAGS="$RPM_OPT_FLAGS" LIB=%{_lib} cli
make $JOBS $MAKEFLAGS CFLAGS="$RPM_OPT_FLAGS" LIB=%{_lib} gimp lib
%if 0%{?no_opencv} == 0
make $JOBS $MAKEFLAGS CFLAGS="$RPM_OPT_FLAGS" LIB=%{_lib} zart
%endif
%endif
#make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS" gimp
free -m
%install
mkdir -p $RPM_BUILD_ROOT/usr/%{_lib}/gimp/2.0/plug-ins/
cd src
make install DESTDIR=$RPM_BUILD_ROOT DOCDIR=%{_docdir} MANDIR=%{_mandir} LIB=%{_lib}
#ln -s libgmic.so.1 $RPM_BUILD_ROOT/usr/%{_lib}/libgmic.so
%if 0%{?fedora_version} > 16
make install-zart DESTDIR=$RPM_BUILD_ROOT DOCDIR=%{_docdir} MANDIR=%{_mandir} LIB=%{_lib} QMAKE=qmake-qt4
%else
%if 0%{?no_opencv} == 0
make install-zart DESTDIR=$RPM_BUILD_ROOT DOCDIR=%{_docdir} MANDIR=%{_mandir} LIB=%{_lib}
%endif
%endif
#mkdir -p $RPM_BUILD_ROOT%{_docdir}/gmic/html
#for name in images res js slides thumbs; do
# cp -ax html/$name $RPM_BUILD_ROOT%{_docdir}/gmic/html/
#done
#for name in README AUTHORS ChangeLog COPYING; do
# cp -p $name $RPM_BUILD_ROOT%{_docdir}/gmic/
#done
strip -S $RPM_BUILD_ROOT/usr/bin/gmic
strip -S $RPM_BUILD_ROOT/usr/%{_lib}/gimp/2.0/plug-ins/gmic_gimp
# ZART
%if 0%{?no_opencv} == 0
strip -S $RPM_BUILD_ROOT/usr/bin/zart
%endif
# Duplicate man page ...
rm $RPM_BUILD_ROOT/%{_mandir}/fr/man1/gmic.1.gz
# Reference manual
#install -d $RPM_BUILD_ROOT/%{_docdir}/gmic
#install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT/%{_docdir}/gmic/
%post -n libgmic1
%{run_ldconfig}
%postun -n libgmic1
%{run_ldconfig}
%files
%defattr(-,root,root)
/usr/bin/gmic
%if 0%{?mandriva_version} == 0
#%{_mandir}/fr/man1/gmic.1.gz
%{_mandir}/man1/gmic.1.gz
%else
#%{_mandir}/fr/man1/gmic.1.lzma
%{_mandir}/man1/gmic.1.lzma
%endif
#%dir %{_docdir}/gmic
#%doc README COPYING AUTHORS index.html
%doc README COPYING index.html
%config %attr(0644,root,root) /etc/bash_completion.d/gmic
%if 0%{?no_opencv} == 0
%files zart
%defattr(-,root,root)
/usr/bin/zart
%doc zart/Licence_CeCILL_V2-en.html zart/README.zart
%endif
%files gimp
%defattr(-,root,root)
/usr/%{_lib}/gimp/2.0/plug-ins/gmic_gimp
%files -n libgmic1
%defattr(-,root,root)
%{_libdir}/libgmic.so.1*
%files -n libgmic-devel
%defattr(-,root,root)
/usr/include/gmic.h
%{_libdir}/libgmic.so
%files doc
%defattr(-,root,root)
#%dir %{_docdir}/gmic
%doc gmic_reference.pdf
%changelog