#===============================================================================
# $Id$
#===============================================================================
# tclsh binary
%__tclsh %_bindir/tclsh

# tcl directory layout
%_tcllibdir %_libdir/tcl
%_tcldatadir %_datadir/tcl

#-------------------------------------------------------------------------------
# TEA tweaks
#-------------------------------------------------------------------------------
# 1. tcl.m4 we have contains old SC_* macros, new TEA_* resides in tea.m4		
# 2. directory layout differs from generic tea:
#    so goes to %_tcllibdir, other stuff - into %_tcldatadir/*/
#-------------------------------------------------------------------------------
%tea_patch \
if test -f aclocal.m4; then \
%__chmod ug+w aclocal.m4 \
%__subst 's|^builtin(include,.\\+/tcl.m4)||' aclocal.m4 \
fi \
if test -f Makefile.in; then \
%__chmod ug+w Makefile.in \
%__cat <<EOF |%__tclsh \
set fc [read [set f [open Makefile.in]] [file size Makefile.in]] \
regsub {(?x) \
    (\\\npkgdatadir\\\s*=\\\s*\\\\\\$\\\(datadir\\\)/)(\\\\\\$\\\(PKG_DIR\\\)) \
} \\\$fc {\\\1tcl/\\\2} fc \
regsub {(?x) \
    (\\\npkglibdir\\\s*=\\\s*\\\\\\$\\\(libdir\\\)/)\\\\\\$\\\(PKG_DIR\\\) \
} \\\$fc {\\\1tcl} fc \
regsub {(?x) \
    (?: \
     (\\\ninstall-lib-binaries:\\\s* \
			\\\n\\\s+@mkdir\\\s+-p\\\s+\\\\\\$\\\(DESTDIR\\\)\\\\\\$\\\(pkglibdir\\\)) \
     (.+\\\n\\\s+@list='\\\\\\$\\\(RUNTIME_SOURCES\\\)';.+){1,1}? \
     (\\\\\\$\\\(pkglibdir\\\)) \
     (.+){1,1}? \
     (\\\\\\$\\\(pkglibdir\\\)) \
     (.+done){1,1}? \
     ){1,1}? \
} \\\$fc {\\\1 \\\$(DESTDIR)\\\$(pkgdatadir)\\\2\\\$(pkgdatadir)\\\4\\\$(pkgdatadir)\\\6} fc \
close \\\$f \
puts -nonewline [set f [open Makefile.in w]] \\\$fc \
close \\\$f \
EOF\
fi \
%nil

%tea_makeinstall(n:) \
%{-n:_name="%{-n*}"}%{!-n:%{?teaname:_name="%teaname"}%{!?teaname:%{error:teaname is not set and -n wasn't given}}} \
%makeinstall libdir=%buildroot%_tcllibdir pkglibdir=%buildroot%_tcldatadir/$_name %* \
%nil

%tea_makeindex(vdlf:L:C:) \
%{-v:_verbose="-verbose"} \
%{-d:_direct="-direct"} \
%{-l:_lazy="-lazy"} \
%{-f:_files='../../../lib/tcl/%{-f*}'}%{!-f:_files='../../../lib/tcl/*.so'} \
%{-L:_load="-load %{-L*}"} \
%{-C:_dir="%{-C*}"}%{!-C:%{?teaname:_dir="%buildroot%_tcldatadir/%teaname"}%{!?teaname:%{error:teaname is not set and -C wasn't given}}} \
if ! test -d $_dir; then %__mkdir_p $_dir; fi \
echo pkg_mkIndex $_verbose $_direct $_lazy $_load -- $_dir '*.tcl' $_files %* |%__tclsh \
%{-v:unset _verbose} \
%{-d:unset _direct} \
%{-l:unset _lazy} \
%{-f:unset _files} \
%{-L:unset _load} \
unset _dir \
%nil

#===============================================================================
#local variables:
#mode: rpm-spec
#fill-column: 80
#tab-width: 2
#end:
