%define majorver 8.4
%define minorver 19
%define version %{majorver}.%{minorver}
%define htmlver %{majorver}.18

Summary: A Tcl/Tk development environment: tcl
Summary(ja): Tcl/Tk 開発環境: tcl
Name: tcl
Version: %{version}
Release: 4%{?_dist_release}
Group: Development/Languages
License: BSD
URL:     http://tcl.sourceforge.net/

Source0: http://prdownloads.sourceforge.net/tcl/%{name}%{version}-src.tar.gz
Source1: http://prdownloads.sourceforge.net/tcl/%{name}%{htmlver}-html.tar.gz
Patch1: tcl-8.3.5-tclm4-soname.patch
Patch2: tcl-8.4.5-lib-perm.patch
#Patch3: tcl8.3.5-tclConfig-package-path-90160.patch
Patch3: tcl8.4.16-configure.patch
Patch4: tcl-8.4.12-no_rpath.patch
Patch10: tcl-8.4.15-init.lib64.patch

Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: libtool, util-linux, perl, gdbm, autoconf, imake

Vendor: Project Vine
Distribution: Vine Linux

%description
Tcl is a simple scripting language designed to be embedded into
other applications.  Tcl is designed to be used with Tk, a widget
set, which is provided in the tk package.  This package also includes
tclsh, a simple example of a Tcl application.

%description -l ja
Tcl は様々なアプリケーションの実行を行うための、簡単なスクリプ
ト言語です。Tclはウィジッド・セットであるTkとともに用いるように
デザインしています。このパッケージにはTclの簡単な例として、tclsh 
も含んでいます。


%prep
#%setup -n %{name}%{version} -q -b1
%setup -n %{name}%{version} -q -a 1
mv tcl%{htmlver}/html .

# define DT SONAME in shared lib
# %patch1 -p1 -b .soname
%patch2 -p1 -b .ro-lib
%patch3 -p1 -b .pkgpath
%patch4 -p1 -b .no_rpath
# patch1 touches tcl.m4, and patch3 touches configure.in
%ifarch x86_64
%patch10 -p1 -b .init.lib64
%endif

cd unix
#autoconf-2.13
autoconf

%build
cd unix
%configure \
	--enable-shared --disable-threads --enable-langinfo --enable-64bit
make %{?_smp_mflags} TCL_LIBRARY=%{_datadir}/tcl%{majorver}


%install
rm -rf $RPM_BUILD_ROOT
make install -C unix INSTALL_ROOT=%{buildroot} TCL_LIBRARY=%{_datadir}/tcl%{majorver}

ln -s tclsh%{majorver} %{buildroot}%{_bindir}/tclsh

# for linking with -ltcl
ln -s libtcl%{majorver}.so %{buildroot}%{_libdir}/libtcl.so

mkdirhier %buildroot/%{_includedir}/tcl-private/{generic,unix}
cp -p generic/tcl{Int,IntDecls,IntPlatDecls,Math,Port}.h %buildroot/%{_includedir}/tcl-private/generic
cp -p unix/tclUnixPort.h %buildroot/%{_includedir}/tcl-private/unix

# Fix up the include files.
install -m 644 generic/tclRegexp.h $RPM_BUILD_ROOT%{_includedir}
cp generic/*.h $RPM_BUILD_ROOT%{_includedir}/tcl-private/generic
cp unix/*.h $RPM_BUILD_ROOT%{_includedir}/tcl-private/unix


# remove buildroot traces
perl -pi -e "s|$PWD/unix|%{_libdir}|; s|$PWD|%{_includedir}/tcl-private|" %buildroot/%{_libdir}/tclConfig.sh


%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc html/*
%{_bindir}/tclsh*
%{_datadir}/tcl%{majorver}
%{_libdir}/libtcl%{majorver}.so
%{_libdir}/tclConfig.sh
%{_mandir}/man1/*
%{_includedir}/*
%{_libdir}/libtclstub%{majorver}.a
%{_libdir}/libtcl.so
%{_mandir}/man3/*
%{_mandir}/mann/*

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

* 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 new environment
- updated Patch3: tcl8.4.16-configure.patch

* Tue Jun 09 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 8.4.19-1
- new upstream release

* Tue Sep 30 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 8.4.18-2
- spec in UTF-8
- configure with disabled threads. See:
  https://bugzilla.redhat.com/show_bug.cgi?id=443246
  http://groups.google.com/group/comp.lang.tcl/msg/ce6a1324bada8db0

* Mon May 12 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 8.4.18-1
- rebuild with new environment

* Sun Feb 17 2008 Shu KONNO <owa@bg.wakwak.com> 8.4.18-0vl1
- updated tcl to 8.4.18
- updated tcl-html to 8.4.18

* Mon Oct 08 2007 Shu KONNO <owa@bg.wakwak.com> 8.4.16-0vl1
- updated tcl to 8.4.16
- updated tcl-html to 8.4.16
- dropt Patch3: tcl8.3.5-tclConfig-package-path-90160.patch
- added Patch3: tcl8.4.16-configure.patch

* Wed Jun 13 2007 Shu KONNO <owa@bg.wakwak.com> 8.4.15-0vl1
- updated tcl to 8.4.15
- updated tcl-html to 8.4.15
- dropt Patch1: tcl-8.3.5-tclm4-soname.patch
- added Patch10: tcl-8.4.15-init.lib64.patch
- rebuilt with new toolchain

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

* Sat Jan 28 2006 Shu KONNO <owa@bg.wakwak.com> 8.4.12-0vl1
- updated tcl to 8.4.12
- updated patch4

* Sat Aug 13 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 8.4.11-0vl1
- updated tcl to 8.4.11
- updated Patch4

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

* Mon Jan 12 2004 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 8.4.5-3vl2
- merged with fedora
  * Mon Dec  1 2003 Thomas Woerner <twoerner@redhat.com> 8.4.5-3
  - removed rpath (patch 4)

  * Fri Nov 28 2003 Jens Petersen <petersen@redhat.com> - 8.4.5-2
  - put private header files under generic and unix subdirs
  - include real generic/tclPort.h not just a symlink to tclUnixPort.h
  - add tclMath.h to %{_includedir}/tcl-private/generic for building tk

  * Thu Nov 27 2003 Jens Petersen <petersen@redhat.com> - 8.4.5-1
  - new package split out from tcltk
  - update to tcl 8.4.5 (#88429)
    - drop tcl-8.3.3-heiierarchy.patch, tcl-8.3.3-dlopen.patch
      and tcl8.3.5-koi8-u.enc-88806.patch
  - include private include headers under %{_includedir}/tcl-private
  - filtered changelog for tcl
  - buildrequire autoconf213 (#110583) [mvd@mylinux.com.ua]

* Sat Mar 29 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 Kazuhisa TAKEI <takei@linux.or.jp>
- split source package.

* 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