File xfig.spec of Package xfig

# spec file for package xfig
# Copyright (c) 2015 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

Name:           xfig
BuildRequires:  dos2unix
BuildRequires:  flex
BuildRequires:  freetype2-devel
BuildRequires:  imake
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xpm)
BuildRequires:  pkgconfig(xt)
%if 0%{suse_version} > 1310
BuildRequires:  libXaw3d-devel
BuildRequires:  xaw3d-devel
BuildRequires:  libjpeg-devel
BuildRequires:  netpbm
BuildRequires:  update-desktop-files
%if 0%{?suse_version} > 1120
BuildRequires:  libpng12-compat-devel
BuildRequires:  libpng12-devel
BuildRequires:  libpng-devel
Provides:       xfig.3.2.3d
Requires:       efont-unicode
Requires:       ghostscript-fonts-std
Requires:       ifnteuro
Requires:       netpbm
Requires:       transfig
Requires:       xorg-x11-fonts
Requires:       xorg-x11-fonts-core
Version:        3.2.5c
Release:        0
Summary:        Facility for Interactive Generation of Figures under the X Window System
License:        MIT
Group:          Productivity/Graphics/Vector Editors
# Remove forbidden files: aircraft.fig
# gunzip xfig.3.2.5c.tar
# tar -f xfig.3.2.5c.tar --delete xfig.3.2.5c/Libraries/Examples/aircraft.fig
# gzip xfig.3.2.5c.tar
Source:         xfig.%{version}.tar.gz
Source1:        font-test.fig
Source2:        browser
Source4:        xfig.desktop
Source5:        xfig.3.2.5c-patches.tar.bz2
Patch0:         xfig.3.2.5b.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
# PATCH-FIX-UPSTREAM xfig.3.2.5b-mediaboxrealnb.dif [debian#530898]
Patch4:         xfig.3.2.5b-mediaboxrealnb.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
Patch10:        xfig.3.2.5b-preview.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
%define _x11data    %{_datadir}/X11
%define _data       $(SHAREDIR)
%define _appdefdir  %{_x11data}/app-defaults

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

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

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

    Anthony Dekker <>
    Brian V. Smith <>
    Jim Daley      <>
    Ross Martin    <>
    Uwe Bonnes     <>

%setup -q -n xfig.%{version}
set +x
find -type f | xargs -r chmod a-x,go-w
find -type f | while read file; do
    if grep -qr $'\r' $file ; then
	dos2unix --keepdate --quiet $file
set -x
tar Oxfj %{S:5} | patch -p1 -s
%patch0  -p0
%patch1  -p0 -b .urw-fonts
%patch2  -p0 -b .xim
%patch3  -p0 -b .international-std-fonts
%patch4  -p0 -b .mbox
%patch5  -p0 -b .null
%patch6  -p0 -b .locale
%patch7  -p0 -b .fixes
%patch8  -p0 -b .pspdftex
%patch10 -p0 -b .preview
cp %{S:1} .
test ! -e Libraries/Examples/aircraft.fig || { echo forbidden file found 1>&2; exit 1; }

%if 0%{suse_version} <= 1310
cat > xaw3d.pc <<-'EOF'
	Name: Xaw3d
	Description: X 3D Athena Widgets Library
	Version: 1.5E
	Requires: xproto xmu xt
	Requires.private: x11 xext
	Libs: -L${libdir} -lXaw3d
xmkmf -a -D_DATA='%{_data}' -DStandardDefines=''
CCOPTIONS="$RPM_OPT_FLAGS -fno-strict-aliasing -w -D_GNU_SOURCE -std=gnu99"

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				\
ln -sf   %{_defaultdocdir}/%{name}/Libraries		\
ln -sf   %{_defaultdocdir}/%{name}/html			\
ln -sf   %{_defaultdocdir}/%{name}/xfig-howto.pdf	\
install -m 0755 %{SOURCE2} %{buildroot}%{_x11data}/xfig/
make DESTDIR=%{buildroot} install
make DESTDIR=%{buildroot}
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 %{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

%doc %{_docdir}/%{name}
%dir %{_appdefdir}
%config %{_appdefdir}/Fig
%doc %{_mandir}/man1/xfig.1x.gz

openSUSE Build Service is sponsored by