File xv.spec of Package xv

#
# spec file for package xv
#
# Copyright (c) 2017 SUSE LINUX 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/
#

%if ! %{defined _distconfdir}
%define _distconfdir %{_prefix}%{_sysconfdir}
%define dousretc 1
%endif

Name:           xv
Version:        5.2.0
Release:        0
Summary:        GIF/TIFF/JPEG/PostScript Image Viewer
License:        SUSE-NonFree
Group:          Productivity/Graphics/Viewers
Url:            https://github.com/jasper-software/xv
#Url:           https://www.trilon.com/xv/
#Url:           https://www.gregroelofs.com/greg_xv.html
Source0:        https://github.com/jasper-software/xv/releases/download/v%{version}/xv-3.10a-js-%{version}.tar.gz
Source2:        xsetbgimg
Source3:        xv.desktop
Source4:        xv.png
Source5:        xv-tests.tar.bz2
Patch0:         xv-3.10a.dif
Patch2:         xv-more-bmp-formats.patch
Patch3:         xv-3.10a-overflow.dif
BuildRequires:  cmake
BuildRequires:  dos2unix
BuildRequires:  groff
BuildRequires:  imake
BuildRequires:  pkgconfig(ice)
BuildRequires:  pkgconfig(jasper)
BuildRequires:  pkgconfig(libjpeg)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(libtiff-4)
BuildRequires:  pkgconfig(libwebp)
BuildRequires:  pkgconfig(sm)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xt)
BuildRequires:  pkgconfig(zlib)
BuildRequires:  update-desktop-files
Provides:       xv300
%{expand: %%global _exec_prefix %(type -p pkg-config &>/dev/null && pkg-config --variable prefix x11 || echo %{_prefix}/X11R6)}

%description
XV is an interactive image viewer for the X Window System. XV displays
images in GIF, JPEG, TIFF, PNG, PBM, PGM, PPM, X Window System bitmap,
Utah Raster Toolkit RLE, PDS/VICAR, Sun Rasterfile, BMP, PCX, IRIS RGB,
XPM, Targa, XWD, possibly PostScript, and PM formats on workstations
and terminals running the X Window System Version 11.

XV can also manipulate pictures. It can zoom in and out, rotate, and
flip them. It also provides a wide variety of operations to modify
colors.

It is one of the most famous programs for Linux.

The documentation can be found in %{_docdir}/xv/.

Please remember that this program has shareware status for commercial
use.

%package doc
Summary:        Documentation about XV
Group:          Documentation/Other
Requires:       %{name} = %{version}
Provides:       %{name}:%{_docdir}/%{name}/README
BuildArch:      noarch

%description doc
The documentation about XV.

%prep
%setup -n xv-3.10a-js-%{version}
%patch -P2 -b .mbmp
%patch -P3 -b .ovf
%patch -P0 -b .p0

%build
CFLAGS="%{optflags} -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -DDOCDIR=\\\"%{_docdir}/%{name}\\\""
export CFLAGS
%cmake -DCMAKE_C_COMPILER=gcc \
    -DBUILD_STATIC_LIBS=OFF \
    -DCMAKE_INSTALL_DO_STRIP=OFF \
    -DCMAKE_INSTALL_DOCDIR=%{_docdir}/%{name}
%make_build -O %{?_smp_mflags} V=1 CC=gcc

%install
%make_install -C build V=1 CC=gcc MANSUF=1x
install -m 755 %{SOURCE2} %{buildroot}%{_bindir}/xsetbgimg
ln -sf README src/COPYRIGHT
if test -e src/docs/manuals/xvdocs.pdf ; then
 rm -vf src/docs/manuals/xvdocs.ps
fi
if test -e src/docs/manuals/xvtitle.ps ; then
 cp -p src/docs/manuals/xvtitle.ps tmp.ps
 dos2unix src/docs/manuals/xvtitle.ps
 touch -r tmp.ps src/docs/manuals/xvtitle.ps
fi
%suse_update_desktop_file -i xv Graphics Viewer

%files
%defattr(-,root,root)
%license src/COPYRIGHT
%exclude %doc %{_docdir}/%{name}/BUGS
%exclude %doc %{_docdir}/%{name}/CHANGELOG
%exclude %doc %{_docdir}/%{name}/CPMASK
%exclude %doc %{_docdir}/%{name}/IDEAS
%exclude %doc %{_docdir}/%{name}/README.FLmask
%exclude %doc %{_docdir}/%{name}/copyright.h
%doc src/docs/help
%if %{defined dousretc}
%dir %{_distconfdir}/
%endif
%{_distconfdir}/xv_mgcsfx
%{_datadir}/applications/xv.desktop
%{_datadir}/pixmaps/xv.png
%{_bindir}/bggen
%{_bindir}/vdcomp
%{_bindir}/xcmap
%{_bindir}/xsetbgimg
%{_bindir}/xv
%{_bindir}/xvpictoppm
%{_mandir}/man1/*.1x%{ext_man}
%dir %{_mandir}/fi/
%dir %{_mandir}/fi/man1/
%{_mandir}/fi/man1/*.1x%{ext_man}
%{_mandir}/pl/man1/*.1x%{ext_man}

%files doc
%defattr(-,root,root)
%dir %doc %{_docdir}/%{name}/
%exclude %{_docdir}/%{name}/help
%doc %{_docdir}/%{name}/*

%changelog
openSUSE Build Service is sponsored by