File xfig.spec of Package xfig

#
# spec file for package xfig (Version 3.2.5b)
#
# Copyright (c) 2010 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/
#

# norootforbuild


Name:           xfig
BuildRequires:  flex freetype2-devel libjpeg-devel netpbm update-desktop-files xaw3d-devel xorg-x11 xorg-x11-devel
%if 0%{?suse_version} > 1120
BuildRequires:  libpng12-compat-devel libpng12-devel
%else
BuildRequires:  libpng-devel
%endif
License:        PERMISSIVE-OSI-COMPLIANT
Group:          Productivity/Graphics/Vector Editors
Provides:       xfig.3.2.3d
Requires:       transfig netpbm ghostscript-fonts-std
AutoReqProv:    on
Version:        3.2.5b
Release:        10
Summary:        Facility for Interactive Generation of Figures under the X Window System
Url:            http://www.xfig.org/
Source:         xfig.%{version}.tar.bz2
Source1:        font-test.fig
Source2:        browser
Source3:        xfig.sh
Source4:        xfig.desktop
Patch0:         xfig.%{version}.dif
Patch1:         xfig.3.2.5-urw-fonts.dif
Patch2:         xfig.3.2.5-xim.dif
Patch3:         xfig.3.2.3d-international-std-fonts.dif
Patch5:         xfig.3.2.5b-null.dif
Patch6:         xfig.3.2.5b-locale.dif
Patch7:         xfig.3.2.5b-fixes.dif
Patch8:         xfig.3.2.5b-pspdftex.dif
Patch9:         xfig.3.2.5b-libpng14.dif
Patch10:        xfig.3.2.5b-preview.dif
Patch11:        xfig.3.2.5b-bnc657393.dif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{expand: %%global _exec_prefix %(type -p pkg-config &>/dev/null && pkg-config --variable prefix x11 || echo /usr/X11R6)}
%if "%_exec_prefix" == "/usr/X11R6"
%global _mandir     %{_exec_prefix}/man
%define _x11data    %{_exec_prefix}/lib/X11
%define _data       $(LIBDIR)
%define _appdefdir  %{_x11data}/app-defaults
%else
%define _x11data    %{_datadir}/X11
%define _data       $(SHAREDIR)
%define _appdefdir  %{_x11data}/app-defaults
%endif

%description
Xfig is a menu-driven tool that allows the user to draw and manipulate
objects interactively in an X Window System window.  The resulting
pictures can be saved, printed on PostScript printers, or converted to
a variety of other formats (to allow inclusion in LaTeX documents, for
example).

Documentation: /usr/share/doc/packages/xfig & man xfig

Examples: /usr/share/doc/packages/xfig/TheExamples



Authors:
--------
    Anthony Dekker <dekker@ACM.org>
    Brian V. Smith <bvsmith@lbl.gov>
    Jim Daley      <jdaley@cix.compulink.co.uk>
    Ross Martin    <martin@trcsun3.eas.asu.edu>
    Uwe Bonnes     <bon@lte.e-technik.uni-erlangen.de>

%prep
%setup -q -n xfig.%{version}
find -type f | xargs -r chmod a-x,go-w
%patch0  -p0
%patch1  -p0 -b .urw-fonts
%patch2  -p0 -b .xim
%patch3  -p1 -b .international-std-fonts
%patch5  -p0 -b .null
%patch6  -p0 -b .locale
%patch7  -p0 -b .fixes
%patch8  -p0 -b .pspdftex
%patch9  -p0 -b .libpng14
%patch10 -p0 -b .preview
%patch11 -p0 -b .vsprintf
cp %{S:1} .

%build
xmkmf -a -D_DATA='%{_data}' -DStandardDefines=''
CCOPTIONS="$RPM_OPT_FLAGS -fno-strict-aliasing -w -D_GNU_SOURCE -std=gnu99"
CCOPTIONS="$CCOPTIONS -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
make CCOPTIONS="$CCOPTIONS"

%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_x11data}/xfig
mkdir -p %{buildroot}%{_appdefdir}
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}/Libraries/Examples
rm -rf   %{buildroot}%{_defaultdocdir}/%{name}/Examples
ln -sf   Libraries/Examples				\
         %{buildroot}%{_defaultdocdir}/%{name}/TheExamples
ln -sf   %{_defaultdocdir}/%{name}/Libraries		\
         %{buildroot}%{_x11data}/xfig/Libraries
ln -sf   %{_defaultdocdir}/%{name}/html			\
         %{buildroot}%{_x11data}/xfig/
ln -sf   %{_defaultdocdir}/%{name}/xfig_man.html	\
         %{buildroot}%{_x11data}/xfig/
ln -sf   %{_defaultdocdir}/%{name}/xfig-howto.pdf	\
         %{buildroot}%{_x11data}/xfig/
install -m 0755 %{SOURCE2} %{buildroot}%{_x11data}/xfig/
make DESTDIR=%{buildroot} install
make DESTDIR=%{buildroot} install.man
mkdir -p %{buildroot}/%{_docdir}/%{name}
cp -pr README FIGAPPS Libraries font-test.fig %{buildroot}/%{_docdir}/%{name}
cp -pr Doc/FORMAT* Doc/TODO Doc/html Doc/*.pdf Doc/*.html %{buildroot}/%{_docdir}/%{name}
find %{buildroot}%{_defaultdocdir}/%{name}/ -name '*.bak' | xargs -r rm
find %{buildroot}%{_defaultdocdir}/%{name}/ -type f -print0 | xargs -0 chmod 644
mkdir -p %{buildroot}%{_datadir}/pixmaps
cp -p %{name}.png %{buildroot}%{_datadir}/pixmaps/
mv %{buildroot}%{_bindir}/xfig %{buildroot}%{_bindir}/xfig.bin
sed 's|@@BINDIR@@|%{_bindir}|' < %{SOURCE3} > %{buildroot}%{_bindir}/xfig
chmod 0755 %{SOURCE3} %{buildroot}%{_bindir}/xfig
install -d %{buildroot}/usr/share/applications
sed 's|@@BINDIR@@|%{_bindir}|' < %{SOURCE4} > %{buildroot}/usr/share/applications/xfig.desktop
chmod 0644 %{buildroot}/usr/share/applications/xfig.desktop
find %{buildroot}/%{_docdir}/%{name} -name '*.orig' | xargs -r rm -f
%suse_update_desktop_file xfig VectorGraphics &> /dev/null

%files
%defattr(-,root,root,755)
%doc %{_docdir}/%{name}
%{_datadir}/applications/xfig.desktop
%{_datadir}/pixmaps/xfig.png
%{_x11data}/xfig
%{_bindir}/xfig*
%config %{_appdefdir}/Fig
%doc %{_mandir}/man1/xfig.1x.gz

%changelog