%define majorver	8.5
%define minorver	15
Summary: A Tcl/Tk development environment: tk
Summary(ja): Tcl/Tk 開発環境: tk
Name: tk
Version: %{majorver}.%{minorver}
Release: 2%{?_dist_release}
Group: Development/Languages
License: TCL
URL: http://tcl.sourceforge.net/
Source0: http://prdownloads.sourceforge.net/tcl/%{name}%{version}-src.tar.gz
# patches from Red Hat Enterprise Linux tk-8.5.7-6.el6
Patch101: tk8.5-make.patch
Patch102: tk8.5-conf.patch
# this patch isn't needed since tk8.6b1
Patch103: tk-seg_input.patch
# fixes sigsegv if there is no font seen by fontconfig (#606671)
Patch105: tk-8.5.7-nofont-sigsegv.patch

Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: autoconf
BuildRequires: libX11-devel
BuildRequires: libXft-devel
BuildRequires: tcl-devel = %{version}
Requires: tcl >= %{majorver}
Provides: libtk%{majorver}.so

Vendor: Project Vine
Distribution: Vine Linux


%description 
Tk is a X Windows widget set designed to work closely with the tcl
scripting language. It allows you to write simple programs with full
featured GUI's in only a little more time then it takes to write a
text based interface. Tcl/Tk applications can also be run on Windows
and Macintosh platforms.

%description -l ja
Tk は tcl スクリプト言語と密接に動作するようにデザインされた X Window 
System のウィジェットセットです。 テキストベースのインターフェースを
採用してるので、あらゆる特徴をもった GUI を少ない時間で、簡単なプログラ
ムで書くことができます。Tcl/Tk アプリケーションは Windows や Macintosh 
のプラットフォームで実行することもできます。

%package devel
Summary: Tk graphical toolkit development files
Summary(ja): Tk ツールキットの開発環境
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: tcl-devel = %{version}
Requires: libX11-devel
Requires: libXft-devel

%description devel
Tk is a X Windows widget set designed to work closely with the tcl
scripting language. It allows you to write simple programs with full
featured GUI's in only a little more time then it takes to write a
text based interface. Tcl/Tk applications can also be run on Windows
and Macintosh platforms.

The package contains the development files and man pages for tk.


%prep
%setup -n %{name}%{version} -q

%patch101 -p1 -b .make
%patch102 -p1 -b .conf
%patch103 -p1 -b .seg
%patch105 -p1 -b .nofont-sigsegv

%build
cd unix
autoconf
%configure
make %{?_smp_mflags} TK_LIBRARY=%{_datadir}/%{name}%{majorver}

%install
rm -rf $RPM_BUILD_ROOT

make install -C unix INSTALL_ROOT=$RPM_BUILD_ROOT TK_LIBRARY=%{_datadir}/%{name}%{majorver}

ln -s wish%{majorver} $RPM_BUILD_ROOT%{_bindir}/wish

# for linking with -l%{name}
ln -s lib%{name}%{majorver}.so $RPM_BUILD_ROOT%{_libdir}/lib%{name}.so

mkdir -p $RPM_BUILD_ROOT/%{_includedir}/%{name}-private/{generic/ttk,unix}
find generic unix -name "*.h" -exec cp -p '{}' $RPM_BUILD_ROOT/%{_includedir}/%{name}-private/'{}' ';'
( cd $RPM_BUILD_ROOT/%{_includedir}
  for i in *.h ; do
    [ -f $RPM_BUILD_ROOT/%{_includedir}/%{name}-private/generic/$i ] && ln -sf ../../$i $RPM_BUILD_ROOT/%{_includedir}/%{name}-private/generic ;
  done
)

# remove buildroot traces
sed -i -e "s|$PWD/unix|%{_libdir}|; s|$PWD|%{_includedir}/%{name}-private|" $RPM_BUILD_ROOT/%{_libdir}/%{name}Config.sh
rm -rf $RPM_BUILD_ROOT/%{_datadir}/%{name}%{majorver}/tkAppInit.c
rm -rf $RPM_BUILD_ROOT/%{_datadir}/%{name}%{majorver}/prolog.ps


%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc README changes license.terms
%{_bindir}/wish*
%{_datadir}/tk%{majorver}
%{_libdir}/libtk%{majorver}.so
%{_libdir}/tk%{majorver}
%{_libdir}/tkConfig.sh
%{_mandir}/man1/*
%{_mandir}/mann/*

%files devel
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/libtk.so
%{_libdir}/libtkstub%{majorver}.a
%{_libdir}/tkConfig.sh
%{_mandir}/man3/*

%changelog
* Mon Jan 26 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 8.5.15-2
- split development files into devel subpackage
- added BR: libXft-devel

* Wed Jan 15 2014 NAKAMURA Kenta <kenta@vinelinux.org> 8.5.15-1
- new upstream release
- drop obsolete patche (Patch104)

* Fri Jan  4 2013 IWAI, Masaharu <iwai@alib.jp> 8.5.7-1
- update to 5.8.7: sync Red Hat Enterprise Linux 6 tk-8.4.19-4vl6
- update License: TCL
- drop obsolete patches
 - lib-perm patch (Patch2)
 - lastevent patch (Patch3)
 - tkBind patch (Patch4)
- add some patches from RHEL tk-8.5.7-6.el6
 - make patch (Patch101)
 - conf patch (Patch102)
 - seg_input patch (Patch103)
 - color patch (Patch104)
 - nofont sigsegv patch (Patch105)
- add some documents
- update build and install section: sync RHEL tk-8.5.7-6.el6

* Thu Apr 21 2011 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 8.4.19-4
- added "BuildRequires: imake".

* Sat Apr 16 2011 Shu KONNO <owa@bg.wakwak.com> 8.4.19-3
- rebuilt with rpm-4.8.1-3

* Tue Jun 29 2010 Shu KONNO <owa@bg.wakwak.com> 8.4.19-2
- rebuilt with tcl-8.4.19-2
- dropt Patch4: tk-8.4.18-tkBind.patch

* Tue Jun 09 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 8.4.19-1
- new upstream release
- add Patch3,4 to fix bug (broken if built with xproto-7.x)

* Mon Jun 08 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 8.4.18-2
- spec in utf-8

* Mon May 12 2008 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 8.4.18-1
- rebuild with xorg-x11-7.3
  - remove Requires: XFree86-libs
  - add BuildRequires: libX11-devel
- use autoconf instead of autoconf217

* Sun Feb 17 2008 Shu KONNO <owa@bg.wakwak.com> 8.4.18-0vl1
- updated tk to 8.4.18
- included CVE-2008-0553

* Mon Oct 08 2007 Shu KONNO <owa@bg.wakwak.com> 8.4.16-0vl1
- updated tk to 8.4.16

* Wed Jun 13 2007 Shu KONNO <owa@bg.wakwak.com> 8.4.15-0vl1
- updated tk to 8.4.15
- rebuilt with new toolchain

* Wed May 10 2006 IWAI, Masaharu <iwai@alib.jp> 8.4.13-0vl1
- updated tk to 8.4.13

* Sat Jan 28 2006 Shu KONNO <owa@bg.wakwak.com> 8.4.12-0vl1
- updated tk to 8.4.12
- updated tk-%%{version}-lib-perm.patch

* Fri Sep 09 2005 Shu KONNO <owa@bg.wakwak.com> 8.4.11-0vl1
- dropped tk-8.3.5-tclm4-soname.patch (fixed tcl.m4)
- replaced tk-8.4.4-lib-perm.patch with tk-8.4.11-lib-perm.patch
- dropped tk-8.4.5-no_rpath.patch (fixed tcl.m4)
- dropped tk-8.4.6-tkUnixWm.patch (fixed invalid 118n title)

* Sat Jun 11 2005 Shu KONNO <owa@bg.wakwak.com> 8.4.6-0vl2
- added tk-8.4.6-tkUnixWm.patch

* Thu Jun 24 2004 Shu KONNO <owa@bg.wakwak.com> 8.4.6-0vl1
- updated tk to 8.4.6

* Mon Jan 12 2004 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 8.4.5-3vl2
- syncd with fedora
  * Fri Dec 12 2003 Jens Petersen <petersen@redhat.com> - 8.4.5-3
  - add private header files needed to build tix in /usr/include/tk-private

  * Mon Dec  1 2003 Thomas Woerner <twoerner@redhat.com> 8.4.5-2
  - removed rpath (patch 3)

  * Thu Nov 27 2003 Jens Petersen <petersen@redhat.com> - 8.4.5-1
  - new package split out from tcltk
  - update to tk 8.4.5 (#88429)
  - filtered changelog for tk
  - buildrequire autoconf213 (#110583) [mvd@mylinux.com.ua]
  - remove build remnants from tkConfig.sh

* Tue Apr 01 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 8.4.2-0vl2
- fix buildrequires and requires section

* Mon Mar 31 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 8.4.2-0vl1
- update based on BitWalk's tcltk-8.4.2-83bw

* Thu Nov 15 2001 Kazuhusa TAKEI <takei@linux.or.jp> 8.0.5_jp-10vl3
- splite source package
- add include files

* Sun Jul 15 2001 Daisuke SUZUKI <daisuke@linux.or.jp> 8.0.5_jp-10vl2
- expand some macros.. (FIXME)

* Sat Jul 14 2001 Daisuke SUZUKI <daisuke@linux.or.jp> 8.0.5_jp-10vl1
- use %configure macros
- add Patch 47,50

* Thu May 31 2001 <sagami@vinelinux.org>
- 8.0.5_jp-10
- unexpand old %%{configure}, new one causes build failure
- fixed missing libtkx.so libtclx.so symlink in /usr/lib
- install manpages into %%{_mandir} and mode 644

* Wed Jul 19 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 8.0.5_jp-9
- modified %install section to handle compressed man pages
- fixed /usr/lib/tk8.0jp/demos.jp/images symlink

* Sun Jul  2 2000 Daisuke SUZUKI <daisuke@linux.or.jp>
- changed default fonts

* Tue Jan 25 2000 Jun Nishii <jun@vinelinux.org>
- added defattr

* Mon Jan 24 2000 Jun Nishii <jun@vinelinux.org>
- added some symlinks, such as libtcl8.0.so.
- obsoletes version number using _jp, now 8.0.5-31vl1

* Wed Jan 5 2000 Norihito Ohmori <nono@vinelinux.org>
- Apply Tcl/Tk 8.0 Japanese Patch 1.7

* Tue Nov 30 1999 Jakub Jelinek <jakub@redhat.com>
- fix tclX symlinks.
- compile on systems where SIGPWR == SIGLOST.

* Sat May  1 1999 Jeff Johnson <jbj@redhat.com>
- update tcl/tk to 8.0.5.
- avoid "containing" in Tix (#2332).

* Thu Apr  8 1999 Jeff Johnson <jbj@redhat.com>
- use /usr/bin/write in kibitz (#1320).
- use cirrus.sprl.umich.edu in weather (#1926).

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 28)

* Mon Mar 08 1999 Preston Brown <pbrown@redhat.com>
- whoops, exec-prefix for itcl was set to '/foo', changed to '/usr'.

* Tue Feb 16 1999 Jeff Johnson <jbj@redhat.com>
- expect does unaligned access on alpha (#989)
- upgrade tcl/tk/tclX to 8.0.4
- upgrade expect to 5.28.
- add itcl 3.0.1

* Tue Jan 12 1999 Cristian Gafton <gafton@redhat.com>
- call libtoolize to allow building on the arm
- build for glibc 2.1
- strip binaries

* Thu Sep 10 1998 Jeff Johnson <jbj@redhat.com>
- update tcl/tk/tclX to 8.0.3, expect is updated also.

* Mon Jun 29 1998 Jeff Johnson <jbj@redhat.com>
- expect: mkpasswd needs delay before sending password (problem #576)

* Thu May 07 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Sat May 02 1998 Cristian Gafton <gafton@redhat.com>
- fixed expect binaries exec permissions

* Thu Apr 09 1998 Erik Troan <ewt@redhat.com>
- updated to Tix 4.1.0.006
- updated version numbers of tcl/tk to relflect includsion of p2

* Wed Mar 25 1998 Cristian Gafton <gafton@redhat.com>
- updated tcl/tk to patch level 2
- updated tclX to 8.0.2

* Thu Oct 30 1997 Otto Hammersmith <otto@redhat.com>
- fixed filelist for tix... replacing path to the expect binary in scripts
  was leaving junk files around.

* Wed Oct 22 1997 Otto Hammersmith <otto@redhat.com>
- added patch to remove libieee test in configure.in for tcl and tk.
  Shoudln't be needed anymore for glibc systems, but this isn't the "proper" 
  solution for all systems
- fixed src urls

* Mon Oct 06 1997 Erik Troan <ewt@redhat.com>
- removed version numbers from descriptions

* Mon Sep 22 1997 Erik Troan <ewt@redhat.com>
- updated to tcl/tk 8.0 and related versions of packages

* Tue Jun 17 1997 Erik Troan <ewt@redhat.com>
- built against glibc
- fixed dangling tclx/tkx symlinks