%define ver 3.2.5e

Summary: A utility for converting FIG files (made by xfig) to other formats.
Summary(ja): Xfig で作った FIG ファイル変換ユーティリティ
Name: transfig
Version: %{ver}
Release: 1%{?_dist_release}
License: MIT
Group: Applications/Graphics
URL: http://www.xfig.org/

Source: http://downloads.sourceforge.net/mcj/%{name}.%{ver}.tar.gz
Patch0: transfig-3.2.5-optflags.patch
Patch5: transfig-3.2.5-modularX.patch
Patch6: transfig-3.2.5-bitmap.patch
Patch10: transfig-3.2.5-buildfix.patch
Patch11: transfig-3.2.5d-bz1037365.patch

Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: libXpm-devel
BuildRequires: libpng-devel >= 1.2.5
BuildRequires: imake
%{?nosrc:NoSource:     0}

Vendor: Project Vine
Distribution: Vine Linux
Packager: daisuke

%description
TransFig is a set of tools for creating TeX documents with graphics
which are portable, in the sense that they can be printed in a wide
variety of environments.

%prep
%setup -q -n %{name}.%{version}
%patch0 -p1 -b .optflags
%patch5 -p1 -b .modularX
%patch6 -p1 -b .bitmap
%patch10 -p1 -b .buildfix
%patch11 -p1

# fix source permissions
find -type f -exec chmod -x {} \;

# remove garbage
rm -f doc/manual/Makefile.orig doc/fig2dev.1.orig

%build
xmkmf
(cd fig2dev; xmkmf ; cd dev ;xmkmf)
(cd transfig ; xmkmf)
make


%install
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

make DESTDIR=%{buildroot} \
     MANPATH=%{_mandir} FIG2DEV_LIBDIR=%{_datadir}/fig2dev \
     install install.man

# fig2ps2tex{,.sh} are equivalent, use the sh one
mv %{buildroot}%{_bindir}/fig2ps2tex.sh %{buildroot}%{_bindir}/fig2ps2tex
ln -s fig2ps2tex %{buildroot}%{_bindir}/fig2ps2tex.sh

%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc CHANGES NOTES README LATEX.AND.XFIG
%{_bindir}/transfig
%{_bindir}/fig2dev
%{_bindir}/fig2ps2tex
%{_bindir}/fig2ps2tex.sh
%{_bindir}/pic2tpic
%{_mandir}/man1/*
%{_datadir}/xfig
%{_datadir}/fig2dev

%changelog
* Tue Oct  7 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 3.2.5e-1
- updated to 3.2.5e
- added Patch11 from Fedora
  - make it compile with -Werror=format-security (#1037365)
- built with libpng-1.6.12

* Sat Aug 29 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 3.2.5-1
- spec in utf-8, new versioning policy
- build for modular X
- new upstream release
- add BR: libXpm-devel, remove BR: XOrg-devel
- drop obsolete patches
- add Patch0 to use optflags
- add Patch5 to build with modular X
- add Patch6 to fix permission on sources
- add Patch10 to fix build failure

* Tue Oct 17 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 3.2.4-7vl2
- add BuildPrereq: XOrg-devel

* Fri Sep 10 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.2.4-7vl1
- updated source to 3.2.4
- updated Patch0 and Patch1, newly added Patch2 and Patch3 from Fedora
  * Tue Jun 17 2003 Than Ngo <than@redhat.com> 3.2.4-4
  - patch build problem
  * Fri May 23 2003 Jeremy Katz <katzj@redhat.com> 1:3.2.4-2
  - fix build with gcc 3.3
- rebuild with new toolchains and libpng >= 1.2
- build with -march=i386 
- s/Copyright/License/
- changed Group

* Sat Jun 22 2002 Masaki Shinomiya <shino@pos.to>
- 3.2.3d-5vl1
- source update
- strerror.patch from rawhide, 3.2.3d-vine.patch, buildprereq

* Sun Aug 20 2000 Jun Nishii <jun@vinelinux.org>
- 3.2.3c-1vl1

* Mon Jan 24 2000 Atsushi Saito <saito4@slb.com>
- update to 3.2.3
- i18n

* Mon Dec  6 1999 Atsushi Saito <saito4@slb.com>
- i18n.

* Tue Jul  7 1998 Jeff Johnson <jbj@redhat.com>
- update to 3.2.1.

* Sat Jun 27 1998 Jeff Johnson <jbj@redhat.com>
- add %clean.

* Mon Apr 27 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Thu Nov 13 1997 Otto Hammersmith <otto@redhat.com>
- fixed problem with Imakefile for fig2dev not including $(XLIB)
- build rooted.

* Fri Oct 24 1997 Otto Hammersmith <otto@redhat.com>
- recreated the glibc patch that is needed for an alpha build, missed it
  building on the intel.

* Tue Oct 21 1997 Otto Hammersmith <otto@redhat.com>
- updated version
- fixed source url

* Fri Jul 18 1997 Erik Troan <ewt@redhat.com>
- built against glibc