Summary: 2-D drawling tool
Summary(ja): 2次元ドローイングソフト
Name: tgif
%define eversion 4.2.2
Version: %{eversion}
Release: 1%{?_dist_release}

Source0: ftp://bourbon.cs.umd.edu/pub/tgif/tgif-QPL-%{eversion}.tar.gz
Source1: Tgif.ad.ja
Source2: tgif-4.1.45.ja.po
Source3: tgif.desktop
Source4: tgif.png

# http://tyche.pu-toyama.ac.jp/~a-urasim/tgif/
Patch10: tgif-textcursor-a-urasim.patch
Patch101: tgif-QPL-4.1.45-size-debug.patch

URL: http://bourbon.usc.edu/tgif/
License: QPL
Group: Applications/Multimedia
Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: imake
BuildRequires: gettext, desktop-file-utils
BuildRequires: libXmu-devel
Requires(post): desktop-file-utils
Requires(postun): desktop-file-utils
Requires: ghostscript
Requires: netpbm-progs
Requires: xorg-x11-fonts-75dpi
Requires: xorg-x11-fonts-ISO8859-1-75dpi
Requires: xorg-x11-jpfonts

Vendor: Project Vine
Distribution: Vine Linux

%description
tgif  -  Xlib based interactive 2-D drawing facility under
X11.  Supports hierarchical construction of  drawings  and
easy  navigation  between  sets  of drawings.  It's also a
hyper-graphics (or hyper-structured-graphics)  browser  on
the World-Wide-Web.

%description -l ja
X 上で動くドローイングソフト tgif です. EPS, PostScript, X11 bitmap 
形式等で出力できます. kinput2 や xwnmo を使えば日本語を入力することが
できます. 

%prep
rm -rf ${RPM_BUILD_ROOT}
%setup -q -n %{name}-QPL-%{eversion}
%patch10 -p0 -b textcursor
#%patch101 -p1 -b .size

rm -f po/ja/ja.po
cp %{SOURCE2} po/ja/ja.po

cp -f %{SOURCE1} po/ja/Tgif.ad

%build
rm -rf Tgif.tmpl
cp Tgif.tmpl-linux Tgif.tmpl
xmkmf
make MOREDEFINES="-DOVERTHESPOT -DUSE_XT_INITIALIZE -D_ENABLE_NLS \
	-DPRINT_CMD=\\\"lpr\\\" -DA4PAPER" TGIFDIR=%{_datadir}/tgif \
	LOCAL_LIBRARIES="-lXmu -lXt -lX11" tgif

(cd po
xmkmf 
make Makefile LIBDIR="%{_datadir}/X11"
make Makefiles LIBDIR="%{_datadir}/X11"
make depend
make all
)

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT \
     BINDIR=%{_libexecdir}/ \
     TGIFDIR=%{_datadir}/tgif/ \
     DATADIR=%{_datadir} \
     MANPATH=%{_mandir} \
     install \
     install.man

%{__mkdir_p} $RPM_BUILD_ROOT%{_bindir}/
%{__install} -cpm 0755 po/ja/tgif-wrapper.sh \
	$RPM_BUILD_ROOT%{_bindir}/%{name}

rm -f $RPM_BUILD_ROOT%{_datadir}/tgif/*.obj
install -m 644 *.obj $RPM_BUILD_ROOT%{_datadir}/tgif

mkdir -p $RPM_BUILD_ROOT%{_datadir}/X11/ja/app-defaults/
install -m 644 po/ja/Tgif.ad $RPM_BUILD_ROOT%{_datadir}/X11/ja/app-defaults/Tgif

(cd po
#install -d $RPM_BUILD_ROOT%{_datadir}/locale/ja/LC_MESSAGES
#install -m644 ja/ja.mo $RPM_BUILD_ROOT%{_datadir}/locale/ja/LC_MESSAGES/tgif.mo
make DESTDIR=$RPM_BUILD_ROOT install
)

# desktop file & icon
%__mkdir_p %{buildroot}%{_datadir}/applications
%__install -p -m644 %{SOURCE3} %{buildroot}%{_datadir}/applications/
%__mkdir_p %{buildroot}%{_datadir}/pixmaps
%__install -p -m644 %{SOURCE4} %{buildroot}%{_datadir}/pixmaps/tgif.png

%clean
rm -rf $RPM_BUILD_ROOT

%post
%{_bindir}/update-desktop-database %{_datadir}/applications > /dev/null 2>&1 ||:
for i in vlgothic ipafont
do
  if [ ! -d /etc/X11/fontpath.d/TreuType-$i ]; then
    sudo ln -sf ../../../usr/share/fonts/TrueType-$i /etc/X11/fontpath.d/
  fi
done

%postun
[ "$1" = "1" ] && exit
%{_bindir}/update-desktop-database %{_datadir}/applications > /dev/null 2>&1 ||:

%files
%defattr(-,root,root)
%doc Copyright HISTORY README* VMS_MAKE_TGIF.COM example.tex 
%doc po/ja/README.jp License
%{_bindir}/tgif
%{_libexecdir}/tgif
%{_mandir}/man1/tgif.1x*
%{_datadir}/tgif
%{_datadir}/locale/*/LC_MESSAGES/tgif.mo
%{_datadir}/X11/ja/app-defaults/Tgif
%{_datadir}/pixmaps/*.png
%{_datadir}/applications/*.desktop

%changelog
* Sat Mar 06 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 4.2.2-1
- new upstream release
  - all patches except textcursor-patch are merged in upstream
- update ja/Tgif.ad

* Mon Aug 24 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 4.1.45-1
- new upstream release
- install ja resources
- fix BR:
- add R: xorg-x11-fonts-ISO8859-1-75dpi, xorg-x11-fonts-75dpi
- add R: xorg-x11-jpfonts
- add tgif.sh to force ja_JP.eucJP on ja locale
- update ja/Tgif.ad
- add fontpath tweaks to %%post script 

* Sat Sep 06 2008 Shu KONNO <owa@bg.wakwak.com> 4.1.44-1vl5
- applied new versioning policy, spec in utf-8
- built with xorg-x11-devel
- updated obsolete directories /usr/X11R6/...
- updated scripts to build tgif.mo

* Sat Apr 07 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 4.1.44-0vl6
- add Patch20 to fix problems with {scim,uim}-anthy (<BTS:512>)

* Wed Dec 27 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 4.1.44-0vl5
- add tgificon.png (source4)
- update tgif.desktop (source3)

* Wed Oct 11 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 4.1.44-0vl4
- add Patch10 to fix text cursor problem (<BTS:250>)
  http://tyche.pu-toyama.ac.jp/~a-urasim/tgif/

* Fri Sep 08 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 4.1.44-0vl3
- add and update desktop file (source3)
- move desktop file to %{_datadir}/applications
- exec update-desktop-database at %%post,%%postun
- add Requires(post,postun): desktop-file-utils

* Sat Sep 02 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 4.1.44-0vl2
- add BuildRequires: XOrg-devel

* Mon Jan 17 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 4.1.44-0vl1
- switch to QPL version

* Thu Jun 10 2004 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 4.1.43-0vl1
- source update

* Thu Jun 12 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.1.42-0vl2
- rebuild with new toolchains

* Fri Mar 29 2002 Jun Nishii <jun@vinelinux.org> 4.1.41-0vl3
- add Tate-gaki entry for Ricoh fonts

* Sun Mar 17 2002 Shoji Matsumoto <shom@vinelinux.org> 4.1.41-0vl2
- refine Tgif.ad for Vine 2.5

* Fri Oct 19 2001 Jun Nishii <jun@vinelinux.org> 4.1.41-0vl1
- ver.up 

* Thu Jul 28 2001 Shoji Matsumoto <shom@vinelinux.org>
- 4.1.40-0vl2
- tgif-4.1ja6 (-aliastt-{mincho,gothic}- -> -alias-{mincho,gothic}-)

* Thu Dec  7 2000 Jun Nishii <jun@vinelinux.org>
- 4.1.40-0vl1

* Tue Oct  3 2000 Jun Nishii <jun@vinelinux.org>
- 4.1.39-0vl2
- added documents

* Sun Sep 10 2000 Jun Nishii <jun@vinelinux.org>
- 4.1.39-0vl1

* Thu Aug 17 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- added overthespot_fix patch for XIM with OverTheSpot style.

* Fri Aug 11 2000 Jun Nishii <jun@vinelinux.org>
- 4.1.36-0vl1

* Mon Aug  7 2000 Jun Nishii <jun@vinelinux.org>
- 4.1.35-0vl1

* Sat Jul 15 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 4.1.34-0vl2
- modified %files section to handle compressed man page

* Mon May  8 2000 Jun Nishii <jun@vinelinux.org>
- updated 4.0.33

* Thu Apr 20 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- updated 4.0.29
- modified fontcheck patch to check signgle byte font, too.

* Thu Mar  9 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- updated 4.0.28

* Mon Feb 28 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- updated 4.0.27

* Thu Feb 24 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- added tgif wmconfig, desktop file

* Fri Feb 18 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- added xim unofficial patch from fj.sources to fix a bug about XIM.

* Wed Feb 16 2000 Jun Nishii <jun@vinelinux.org>
- 4.1.26-0vl3
- bug fix in tgif-4.1.26-fontcheck.patch 

* Mon Feb 14 2000 Jun Nishii <jun@vinelinux.org>
- 4.1.26-0vl2
- merge tgif-4.1.26-fontcheck.patch by Mr. Yasuyuki Furukawa 
  which obsoletes trigger for Dynafonts and TrueTypeFonts !

* Thu Jan 20 2000 Jun Nishii <jun@vinelinux.org>
- 4.1.26-0vl2
- added trigger for Dynafonts and TrueTypeFonts

* Thu Jan 20 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- updated to 4.1.26
- change ja resource from ja_JP.ujis/app-defaults to ja/app-defaults
- modified font setting

* Wed Nov 17 1999 Jun Nishii <jun@flatout.org>
- updated to 4.1.25

* Thu Nov 4 1999 Jun Nishii <jun@flatout.org>
- updated to 4.1.23

* Thu Oct 28 1999 Jun Nishii <jun@flatout.org>
- rel.4
- update ja.po
- more gettextize in choice.c and menu.c

* Wed Oct 27 1999 Jun Nishii <jun@flatout.org>
- rel.3 
- merge messages in strtbl.c and added japanese catalog

* Tue Oct 26 1999 Jun Nishii <jun@flatout.org>
- rel.2
- enable nls in status buffer and added japanese catalog

* Tue Oct 26 1999 Jun Nishii <jun@flatout.org>
- updated to 4.1.22

* Sun Aug 8 1999 Norihito Ohmori <ohmori@flatout.org>
- archive format change to bzip2
- rebuild for glibc-2.1.x

* Wed Jun 30 1999 Jun Nishii <jun@flatout.org>
- updated to 4.1.16

* Tue Apr 15 1999 Jun Nishii <jun@flatout.org>
- updated to 4.1.7

* Tue Apr 8 1999 Jun Nishii <jun@flatout.org>
- updated to 4.1.6
- Our menufontset-nls patch and xim patch were merged in original source!

* Tue Mar  9 1999 MATSUMOTO Shoji <vine@flatout.org>
- vertical font indicator bug fix
- modify resource and tgif.sh

* Mon Mar 8 1999 Jun Nishii <jun@flatout.org>
- updated to 4.1

* Mon Mar 8 1999 Jun Nishii <jun@flatout.org>
- bug fix in showing shortcut key in menu
- modify document

* Wed Mar  4 1999 MATSUMOTO Shoji <vine@flatout.org>
- set Tgif.InitialFont Ryumin

* Wed Mar  3 1999 MATSUMOTO Shoji <vine@flatout.org>
- add XIM OverTheSpot patch
- modify Tgif-ja.ad

* Mon Mar 2 1999 Jun Nishii <jun@flatout.org>
- updated to 4.0.18

* Mon Mar 1 1999 Jun Nishii <jun@flatout.org>
- make patch to support fontset and nls
- change version name as 4.0.17_jp 

* Sat Feb 27 1999 Jun Nishii <jun@flatout.org>
- modify Tgif-ja.ad (use A4,cm,color-icon,etc...)
- correct document

* Wed Feb 24 1999 Jun Nishii <jun@flatout.org>
- updated to ver. 4.0.17 
- make wrapper to read Tgif-ja

* Sat Feb 20 1999 Jun Nishii <jun@flatout.org>
- updated to ver. 4.0.16

* Tue Feb 16 1999 Jun Nishii <jun@flatout.org>
- build ver. 4.0.14 for Vine Linux
