%define tcl_major	8.4
%define tk_major	8.4
%define thread_major	2.6
%define tclx_major	8.4
%define tclxvers        %{tclx_major}
Summary: A Tcl/Tk development environment: tclX
Summary(ja): Tcl/Tk 開発環境: tclX
Name: tclx
Version: %{tclxvers}
Release: 3%{?_dist_release}
Group: Development/Languages
License: BSD
Source0:   ftp://ftp.tcl.tk/pub/tcl/nightly-cvs/tclx-20070227.tar.gz
BuildRequires: tcl >= %{tcl_major}
BuildRequires: tk >= %{tk_major}
BuildRequires: thread >= %{thread_major}
Requires: tcl >= %{tcl_major}
Requires: tk >= %{tk_major}
Requires: thread >= %{thread_major}
Buildroot: %{_tmppath}/%{name}-root

Distribution: Vine Linux
Vendor: Project Vine

%description -n tclx
TclX is a set of extensions which make it easier to use the Tcl
scripting language for common UNIX/Linux programming tasks.  TclX
enhances Tcl support for files, network access, debugging, math, lists,
and message catalogs.  TclX can be used with both Tcl and Tcl/Tk
applications.

Install TclX if you are developing applications with Tcl/Tk.  You'll
also need to install the tcl and tk packages.

%description -n tclx -l ja
TclX は一般的な UNIX/Linux プログラミング作業のおいて、Tcl スクリプト言語
をより簡単に使用するための拡張キットです。TclX は、ファイルや、ネットワーク
アクセス、デバッグ、数値計算、リスト、メッセージカタログの Tcl サポートを拡
張します。TclX は Tcl と Tcl/Tk アプリケーションの両方で使うことができます。

Tcl/Tk のアプリケーションを開発するときには、TclXもインストールしてください。
tcl と tk のパッケージも必要です。


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


%build
# make the libraries reentrant
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D_REENTRANT"

# tclX
%configure \
--with-tcl=%{_libdir} --with-tk=%{_libdir} \
--enable-shared --enable-tk --enable-threads --enable-64bit
make


%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}
rm -f *.files

# TclX
%makeinstall

#if [ "%_mandir" = "%{_prefix}/share/man" ]; then
#   ( cd ${RPM_BUILD_ROOT}%{_prefix}/man; tar cf - ./man[13n] ) | 
#   ( cd ${RPM_BUILD_ROOT}%{_mandir}; tar xf - )
#   ( cd ${RPM_BUILD_ROOT}%{_prefix}/man; rm -rf ./man[13n] )
#fi

echo "%%defattr(-,root,root)" > tclx.files
(find ${RPM_BUILD_ROOT}%{_bindir} ${RPM_BUILD_ROOT}%{_includedir} \
        ${RPM_BUILD_ROOT}%{_mandir} -type f -o -type l;
 find ${RPM_BUILD_ROOT}%{_libdir}/*) | cat - *.files \
        | sort | uniq -u >> tclx.files

set +x +H
for n in `cat tclx.files`; do
        test -f $n || continue
        head -1 $n | grep -q ^#! || continue
        chmod u+w $n
        perl -pi -e "s|${RPM_BUILD_ROOT}||" $n
done
set -x -H

# post process the *.files list, removing build sys references and mark
# which are directories
set +x
for n in *.files; do
        mv $n $n.in
        sed "s|.*%{_prefix}\\>|%{_prefix}|" < $n.in | while read file; do
            if [ -d ${RPM_BUILD_ROOT}/$file ]; then
                echo -n '%dir '
            fi
            echo $file
        done > $n
        rm -f $n.in
done
set -x

# Man pages can be compressed
perl -pi -e 's|(^%{_mandir}/man.*$)|\1\*|' *.files

%post -p /sbin/ldconfig -n tclx
%postun -p /sbin/ldconfig -n tclx
%clean
rm -rf $RPM_BUILD_ROOT

%files -f tclx.files -n tclx

%changelog
* Sun Apr 17 2011 Shu KONNO <owa@bg.wakwak.com> 8.4.2-3
- rebuilt with rpm-4.8.1-3

* Tue Jun 29 2010 Shu KONNO <owa@bg.wakwak.com> 8.4.2-2
- rebuilt with tcl/tk-8.4.19-2

* Sat Jul 26 2008 Shu KONNO <owa@bg.wakwak.com> 8.4.2-1vl5
- applied new versioning policy

* Sun Feb 17 2008 Shu KONNO <owa@bg.wakwak.com> 8.4.2-0vl3
- updated tclx to tclx-20070227.tar.gz
- rebuild with tcl/tk-8.4.18

* Tue Oct 09 2007 Shu KONNO <owa@bg.wakwak.com> 8.4.2-0vl2
- rebuild with tcl/tk-8.4.16

* 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 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