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

%if "%{_exec_prefix}" == "%{_prefix}/X11R6"
%global _mandir     %{_prefix}/man
%define _x11data    %{_prefix}/lib/X11
%define _libx11     %{_x11data}
%define _x11data    %{_datadir}/X11
%define _libx11     %{_prefix}/lib/X11
Name:           xv
Version:        3.10a
Release:        0
Summary:        GIF/TIFF/JPEG/PostScript Image Viewer
License:        SUSE-NonFree
Group:          Productivity/Graphics/Viewers
Source:         xv-3.10a.tar.bz2
Source1:        xv-3.10a-jumbo-patches-20070520.tar.bz2
Source2:        xsetbgimg
Source3:        xv.desktop
Source4:        xv.png
Source5:        xv-tests.tar.bz2
Patch0:         xv-3.10a.dif
Patch1:         xv-3.10a-ticks.dif
Patch2:         xv-3.10a-signal.dif
Patch3:         xv-3.10a-overflow.dif
Patch4:         xv-3.10a-jpeg8.dif
Patch5:         xv-3.10a-png.dif
Patch6:         xv-3.10a-xwd.dif
Patch7:         xv-3.10a-dirw.dif
Patch8:         xv-3.10a-enhancements.20070520-20081216.diff
Patch9:         xv-3.10a-libpng15.patch
Patch10:        xv-3.10a-png-gimp.patch
BuildRequires:  dos2unix
BuildRequires:  groff
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libtiff-devel
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11-devel
BuildRequires:  zlib-devel
Provides:       xv300
%{expand: %%global _exec_prefix %(type -p pkg-config &>/dev/null && pkg-config --variable prefix x11 || echo %{_prefix}/X11R6)}

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

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

%setup -q -b1
 patch  -p1 -s --suffix=.jumbo-20070520 < ../xv-3.10a-jumbo-fix-enh-patch-20070520.txt
%patch8  -b .jumbo-20081216
%patch1  -b .ticks
%patch2  -b .sig
%patch3  -b .ovf
%patch4  -b .jpg8
%patch5  -b .png
%patch6  -b .xwd
%patch7  -b .dirw
%patch9  -b .libpng5
%patch10 -p1 -b .png-gimp

# Do not overwrite CFLAGS here
RPM_OPT_FLAGS="%{optflags} -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector"
xmkmf -a
make %{?_smp_mflags}

mv docs/README docs/
make DESTDIR=%{buildroot}
rm docs/*._man
mkdir man
for m in docs/*.man; do
 test -e $m || continue
 troff -Tlatin1 -t -mandoc < $m | grotty -bou > ${m%.*}.txt
 mv $m man/
if test -e docs/xvdocs.pdf ; then
 rm -vf docs/
if test -e docs/ ; then
 cp -p docs/
 dos2unix docs/
 touch -r docs/
install -m 755 %{SOURCE2} %{buildroot}%{_bindir}/xsetbgimg
rm -f %{buildroot}%{_libx11}/xv_mgcsfx.sample
%suse_update_desktop_file -i xv Graphics Viewer

%doc COPYRIGHT docs/*

openSUSE Build Service is sponsored by