Initial import

This commit is contained in:
Robert Scheck 2014-08-05 14:31:00 +02:00
parent 8f0425142a
commit f70d5ae3ca
10 changed files with 452 additions and 0 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
/tclreadline-2.?.?.tar.gz

60
sample.tclshrc Normal file
View File

@ -0,0 +1,60 @@
#!/bin/sh
# FILE: "/home/joze/src/tclreadline/sample.tclshrc"
# LAST MODIFICATION: "Thu, 23 Mar 2000 21:13:08 +0100 (joze)"
# (C) 1998 - 2000 by Johannes Zellner, <johannes@zellner.org>
# $Id: sample.tclshrc,v 2.2 2000/03/23 22:51:28 joze Exp $
# vim:set ft=tcl: \
exec tclsh "$0" "$@"
if {$tcl_interactive} {
package require tclreadline
# uncomment the following if block, if you
# want `ls' executed after every `cd'. (This was
# the default up to 0.8 == tclreadline_version.)
#
# if {"" == [info procs cd]} {
# catch {rename ::tclreadline::Cd ""}
# rename cd ::tclreadline::Cd
# proc cd {args} {
# if {[catch {eval ::tclreadline::Cd $args} message]} {
# puts stderr "$message"
# }
# tclreadline::ls
# }
# }
# uncomment the following line to use
# tclreadline's fancy ls proc.
#
# namespace import tclreadline::ls
# tclreadline::Print is on (`yes') by default.
# This mimics the command echoing like in the
# non-readline interactive tclsh.
# If you don't like this, uncomment the following
# line.
#
# tclreadline::Print no
# uncomment the folling line, if you want
# to change tclreadline's print behaviour
# frequently with less typing.
#
# namespace import tclreadline::Print
# store maximal this much lines in the history file
#
set tclreadline::historyLength 200
# disable tclreadline's script completer
#
# ::tclreadline::readline customcompleter ""
# go to tclrealdine's main loop.
#
tclreadline::Loop
}

View File

@ -0,0 +1 @@
219d0247a1373578080940ebde53bdd0 tclreadline-2.1.0.tar.gz

View File

@ -0,0 +1,40 @@
Patch by Robert Scheck <robert@fedoraproject.org> for tclreadline >= 2.1.0 which ensures
that tclreadline-2.1.0.so gets installed into /usr/lib64 on 64 bit architectures rather on
/usr/lib as upstream would do. It also avoids undefined non-weak symbols by linking tcl.
--- tclreadline-2.1.0/Makefile.am 2000-12-08 01:50:51.000000000 +0100
+++ tclreadline-2.1.0/Makefile.am.libdir 2010-04-05 20:34:06.000000000 +0200
@@ -22,7 +22,7 @@
## libtclreadline_la_LIBADD = $(LIBS)
libtclreadline_la_LDFLAGS = -release $(MAJOR).$(MINOR).$(PATCHLEVEL)
-tclrldir = @TCLRL_DIR@
+tclrldir = @libdir@
tclrl_SCRIPTS = pkgIndex.tcl tclreadlineCompleter.tcl tclreadlineInit.tcl tclreadlineSetup.tcl
INSTALL_SCRIPT = ${INSTALL_DATA}
--- tclreadline-2.1.0/configure.in 2000-12-08 01:45:45.000000000 +0100
+++ tclreadline-2.1.0/configure.in.libdir 2010-04-07 00:54:26.000000000 +0200
@@ -89,9 +89,9 @@
if test "${prefix}" = "NONE"; then
prefix=$TCL_PREFIX
fi
-TCLRL_LIBDIR="${prefix}/lib"
+TCLRL_LIBDIR="${libdir}"
AC_SUBST(TCLRL_LIBDIR)
-TCLRL_DIR="${TCLRL_LIBDIR}/tclreadline$VERSION"
+TCLRL_DIR="${libdir}"
AC_SUBST(TCLRL_DIR)
# HEADERS
--- tclreadline-2.1.0/Makefile.am 2011-01-01 02:01:57.987194966 +0100
+++ tclreadline-2.1.0/Makefile.am.libdir 2011-01-01 02:35:14.438178363 +0100
@@ -19,7 +19,7 @@
INCLUDES = -I$(TCL_INCLUDE_DIR) -I$(READLINE_INCLUDE_DIR)
-## libtclreadline_la_LIBADD = $(LIBS)
+libtclreadline_la_LIBADD = $(TCL_LIB_SPEC)
libtclreadline_la_LDFLAGS = -release $(MAJOR).$(MINOR).$(PATCHLEVEL)
tclrldir = @libdir@

View File

@ -0,0 +1,58 @@
Patch by Chris Waters <xtifr@debian.org> and Sergei Golovan <sgolovan@debian.org> for
tclreadline >= 2.1.0 which fixes typos in the manual page. It also fixes an nroff error
in man page (needed to double escape char '/'). For further information, please have a
look to Debian bug ID #242369.
--- tclreadline-2.1.0/tclreadline.n.in 2000-08-27 15:25:24.000000000 +0200
+++ tclreadline-2.1.0/tclreadline.n.in.man-page 2010-04-06 01:32:08.000000000 +0200
@@ -73,7 +73,7 @@
.PP
The following list will give all commands, which are currently
-implemented in the shared lib (e.g. libtclreadline@TCLREADLINE_VERSION@.so).
+implemented in the shared lib (e.g. libtclreadline-@VERSION@.so).
Additional commands were introduced in a startup script
\fBtclreadlineSetup.tcl\fP, which lives in the tclreadline
installation directory.
@@ -145,7 +145,7 @@
.TP 5
\fB::tclreadline::readline initialize\fP \fIhistoryfile\fP
initialize the tclreadline interface and read the history from
-the \fIhistoryfile\fP. On succes an empty string is returned.
+the \fIhistoryfile\fP. On success an empty string is returned.
This command has to be called before any other tclreadline commands.
.TP 5
@@ -211,7 +211,7 @@
\fB::tclreadline::prompt1\fP
a proc which is called by ::tclreadline::Loop and returns a string
which will be displayed as the primary prompt. This prompt will be
-something like "[info nameofexecutable] \[[pwd]\]" possibly fancy colored.
+something like "[info nameofexecutable] \\[[pwd]\\]" possibly fancy colored.
The default proc is defined on entering the ::tclreadline::Loop,
if it is not already defined. So: If you define your own proc
::tclreadline::prompt1 before entering ::tclreadline::Loop, this
@@ -242,12 +242,12 @@
\fItclreadline\fP defines the following variables in the
namespace \fI::tclreadline\fP:
-(for backwards compatiblity the global variables tclreadline_version,
+(for backwards compatibility the global variables tclreadline_version,
tclreadline_patchLevel and tclreadline_library are still present).
.TP 5
\fBtclreadline::version\fP (read-only)
-holds the version string "@TCLREADLINE_VERSION@".
+holds the version string "@VERSION@".
.TP 5
\fBtclreadline::patchLevel\fP (read-only)
@@ -255,7 +255,7 @@
.TP 5
\fBtclreadline::library\fP (read-only)
-holds the library string "@TCLREADLINE_LIBRARY@".
+holds the library string "@TCLRL_DIR@".
.TP 5
\fBtclreadline::license\fP (read-only)

View File

@ -0,0 +1,18 @@
Patch by David Welton for tclreadline >= 2.1.0 to get tclreadline working with threaded
Tcl versions. According to Chris Waters <xtifr@debian.org> this patch is maybe not perfect
but at least it no longer crashes immediately. For further information, please have a look
to Debian bug ID #175192.
--- tclreadline-2.1.0/tclreadline.c 2010-04-06 01:55:35.000000000 +0200
+++ tclreadline-2.1.0/tclreadline.c.memuse 2010-04-06 02:00:30.000000000 +0200
@@ -49,8 +49,8 @@
static const char* tclrl_version_str = TCLRL_VERSION_STR;
static const char* tclrl_patchlevel_str = TCLRL_PATCHLEVEL_STR;
-#define MALLOC(size) Tcl_Alloc((int) size)
-#define FREE(ptr) if (ptr) { Tcl_Free((char*) ptr); ptr = 0; }
+#define MALLOC(size) malloc((int) size)
+#define FREE(ptr) if (ptr) { free((char*) ptr); ptr = 0; }
enum {
_CMD_SET = (1 << 0),

View File

@ -0,0 +1,97 @@
Patch by Sergei Golovan <sgolovan@debian.org> and Chris Waters <xtifr@debian.org> for
tclreadline >= 2.1.0 which adds ::tclreadline::prompt2 command which allows to customize
secondary prompt. It removes garbage global variable prompt2, too. Removes tcl_prompt2
variable usage as well (the tclx uses this variable in commandloop command). And patches
startup code to no longer overwrite the global variables 'a', 'LINE' and 'result'. Other
variables seemed to be ok. For further information, please have a look to Debian bug IDs
#87050, #89650, #90060 and #92812.
--- tclreadline-2.1.0/tclreadlineSetup.tcl.in 2000-07-02 00:18:08.000000000 +0200
+++ tclreadline-2.1.0/tclreadlineSetup.tcl.in.prompt2 2010-04-06 01:50:59.000000000 +0200
@@ -136,7 +136,7 @@
::tclreadline::Init
}
- if {[catch {set a [::tclreadline::prompt1]}] && [info nameofexecutable] != ""} {
+ if {"" == [info procs ::tclreadline::prompt1] && [info nameofexecutable] != ""} {
namespace eval ::tclreadline {
variable prompt_string
@@ -171,6 +171,16 @@
# puts body=[info body ::tclreadline::prompt1]
}
+ if {"" == [info procs ::tclreadline::prompt2] && [info nameofexecutable] != ""} {
+
+ if {"" == [info procs ::tclreadline::prompt2]} {
+ proc ::tclreadline::prompt2 {} {
+ return ">"
+ }
+ }
+ # puts body=[info body ::tclreadline::prompt2]
+ }
+
if {"" == [info procs exit]} {
catch {rename ::tclreadline::Exit ""}
@@ -263,22 +273,21 @@
while {1} {
- if [info exists tcl_prompt2] {
- set prompt2 $tcl_prompt2
- } else {
- set prompt2 ">"
- }
-
if {[catch {
if {"" != [namespace eval ::tclreadline {info procs prompt1}]} {
- set LINE [::tclreadline::readline read \
+ set ::tclreadline::LINE [::tclreadline::readline read \
[::tclreadline::prompt1]]
} else {
- set LINE [::tclreadline::readline read %]
+ set ::tclreadline::LINE [::tclreadline::readline read %]
}
- while {![::tclreadline::readline complete $LINE]} {
- append LINE "\n"
- append LINE [tclreadline::readline read ${prompt2}]
+ while {![::tclreadline::readline complete $::tclreadline::LINE]} {
+ append ::tclreadline::LINE "\n"
+ if {"" != [namespace eval ::tclreadline {info procs prompt2}]} {
+ append ::tclreadline::LINE \
+ [tclreadline::readline read [::tclreadline::prompt2]]
+ } else {
+ append ::tclreadline::LINE [tclreadline::readline read >]
+ }
}
} ::tclreadline::errorMsg]} {
puts stderr [list tclreadline::Loop: error. \
@@ -294,19 +303,20 @@
# from tcsh's behaviour, but I found it quite convenient
# while using mshell on os9.
#
- if {[string length $LINE] && [history event 0] != $LINE} {
- history add $LINE
+ if {[string length $::tclreadline::LINE] && \
+ [history event 0] != $::tclreadline::LINE} {
+ history add $::tclreadline::LINE
}
if [catch {
- set result [eval $LINE]
- if {$result != "" && [tclreadline::Print]} {
- puts $result
+ set ::tclreadline::result [eval $::tclreadline::LINE]
+ if {$::tclreadline::result != "" && [tclreadline::Print]} {
+ puts $::tclreadline::result
}
- set result ""
+ set ::tclreadline::result ""
} ::tclreadline::errorMsg] {
puts stderr $::tclreadline::errorMsg
- puts stderr [list while evaluating $LINE]
+ puts stderr [list while evaluating $::tclreadline::LINE]
}
}

View File

@ -0,0 +1,15 @@
Patch by Dann Frazier <dannf@debian.org> for tclreadline >= 2.1.0 which makes tclreadline
using rl_completion_matches() instead of the deprecated completion_matches(). For further
information, please have a look to Debian bug ID #226565.
--- tclreadline-2.1.0/tclreadline.c 2000-09-20 19:44:34.000000000 +0200
+++ tclreadline-2.1.0/tclreadline.c.rl_completion 2010-04-06 01:41:08.000000000 +0200
@@ -745,7 +745,7 @@
}
if (!matches && tclrl_use_builtin_completer) {
- matches = completion_matches(text, TclReadline0generator);
+ matches = rl_completion_matches(text, (rl_compentry_func_t *)TclReadline0generator);
}
return matches;

View File

@ -0,0 +1,43 @@
Patch by Sergei Golovan <sgolovan@debian.org> and Philip Quaife for tclreadline >= 2.1.0
which fixes a syntax error in completer (the bug arises if a command with options started
with a hyphen is completed) and fixes a bug with filenames completion for non-Tcl commands:
http://sourceforge.net/tracker/index.php?func=detail&aid=754797&group_id=7657&atid=107657
--- tclreadline-2.1.0/tclreadlineCompleter.tcl 2000-07-01 16:23:17.000000000 +0200
+++ tclreadline-2.1.0/tclreadlineCompleter.tcl.hyphen 2010-04-06 01:25:28.000000000 +0200
@@ -625,7 +625,7 @@
}
}
}
- if {![catch [list set type [image type ${cmd}]]]} {
+ if {![catch {list set type [image type ${cmd}]}]} {
switch -- ${type} {
photo {
set result [PhotoObj ${text} ${start} ${end} ${line} ${pos}]
@@ -1460,7 +1460,7 @@
# this can raise an error, if alias is
# no valid command.
#
- if {[catch [list set alias [namespace origin $alias]]]} {
+ if {[catch {set alias [namespace origin $alias]}]} {
return ""
}
@@ -3042,7 +3042,7 @@
proc complete(regsub) {text start end line pos mod} {
set prev [PreviousWord ${start} ${line}]
if {[llength ${prev}] && "--" != $prev && \
- ("-" == [string index ${prev} 0] || 1 == ${pos)}} {
+ ("-" == [string index ${prev} 0] || 1 == ${pos})} {
set cmds [RemoveUsedOptions ${line} {
-all -nocase --} {--}]
if {[llength ${cmds}]} {
@@ -3449,7 +3449,7 @@
proc complete(switch) {text start end line pos mod} {
set prev [PreviousWord ${start} ${line}]
if {[llength ${prev}] && "--" != ${prev} && \
- ("-" == [string index ${prev} 0] || 1 == ${pos)}} {
+ ("-" == [string index ${prev} 0] || 1 == ${pos})} {
set cmds [RemoveUsedOptions ${line} {
-exact -glob -regexp --} {--}]
if {[llength ${cmds}]} {

119
tcl-tclreadline.spec Normal file
View File

@ -0,0 +1,119 @@
%{!?tcl_version: %global tcl_version %((echo '8.5'; echo 'puts $tcl_version' | tclsh) | tail -1)}
%{!?tcl_sitearch: %global tcl_sitearch %{_libdir}/tcl%{tcl_version}}
%global pkgname tclreadline
Summary: GNU Readline extension for Tcl/Tk
Name: tcl-%{pkgname}
Version: 2.1.0
Release: 3%{?dist}
License: BSD
Group: Development/Libraries
URL: http://tclreadline.sourceforge.net/
Source0: http://downloads.sourceforge.net/sourceforge/%{pkgname}/%{pkgname}-%{version}.tar.gz
Source1: http://tclreadline.cvs.sourceforge.net/viewvc/*checkout*/%{pkgname}/%{pkgname}/sample.tclshrc
Patch0: tcl-tclreadline-2.1.0-libdir.patch
Patch1: tcl-tclreadline-2.1.0-syntax.patch
Patch2: tcl-tclreadline-2.1.0-man-page.patch
Patch3: tcl-tclreadline-2.1.0-rl_completion.patch
Patch4: tcl-tclreadline-2.1.0-prompt2.patch
Patch5: tcl-tclreadline-2.1.0-memuse.patch
BuildRequires: tcl-devel, readline-devel, autoconf, automake, libtool
%if 0%{?rhel}%{?fedora} >= 6
Requires: tcl(abi) = %{tcl_version}
%else
Requires: tcl
%endif
Provides: %{pkgname} = %{version}-%{release}, %{pkgname}%{?_isa} = %{version}-%{release}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
The tclreadline package makes the GNU Readline library available
for interactive tcl shells. This includes history expansion and
file/command completion. Command completion for all tcl/tk commands
is provided and command completion for user defined commands can
be easily added. Tclreadline can also be used for tcl scripts which
want to use a shell like input interface.
%package devel
Summary: Development files for the tclreadline library
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The tclreadline-devel package includes the header file and library
necessary for developing programs which use the tclreadline library.
%prep
%setup -q -n %{pkgname}-%{version}
%patch0 -p1 -b .libdir
%patch1 -p1 -b .syntax
%patch2 -p1 -b .man-page
%patch3 -p1 -b .rl_completion
%patch4 -p1 -b .prompt2
%patch5 -p1 -b .memuse
autoreconf -f -i
# Copy sample tclshrc for later pickup at %%doc
cp -pf %{SOURCE1} .
%build
%configure --libdir=%{tcl_sitearch}/%{pkgname}%{version} --with-tcl=%{_libdir}
# Avoid unused direct shared library dependency to libncurses
sed -e 's@ -shared @ -Wl,--as-needed\0@g' -i libtool
make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p' install
# Move the library for linking back to %%{_libdir}
mv -f $RPM_BUILD_ROOT{%{tcl_sitearch}/%{pkgname}%{version},%{_libdir}}/lib%{pkgname}-%{version}.so
rm -f $RPM_BUILD_ROOT%{tcl_sitearch}/%{pkgname}%{version}/lib%{pkgname}.so
ln -s ../../lib%{pkgname}-%{version}.so $RPM_BUILD_ROOT%{tcl_sitearch}/%{pkgname}%{version}/lib%{pkgname}.so
ln -s lib%{pkgname}-%{version}.so $RPM_BUILD_ROOT%{_libdir}/lib%{pkgname}.so
# Remove wrong and unnecessary shebang from files
for file in tclreadlineSetup.tcl tclreadlineInit.tcl pkgIndex.tcl; do
sed -e '1d' $RPM_BUILD_ROOT%{tcl_sitearch}/%{pkgname}%{version}/$file > \
$RPM_BUILD_ROOT%{tcl_sitearch}/%{pkgname}%{version}/$file.new
touch -c -r $RPM_BUILD_ROOT%{tcl_sitearch}/%{pkgname}%{version}/$file{,.new}
mv -f $RPM_BUILD_ROOT%{tcl_sitearch}/%{pkgname}%{version}/$file{.new,}
done
# Don't install any static .a and libtool .la files
rm -f $RPM_BUILD_ROOT%{tcl_sitearch}/%{pkgname}%{version}/*.{a,la}
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING README sample.tclshrc
%{_libdir}/lib%{pkgname}-%{version}.so
%{tcl_sitearch}/%{pkgname}%{version}
%{_mandir}/mann/%{pkgname}.n*
%files devel
%defattr(-,root,root,-)
%{_libdir}/lib%{pkgname}.so
%{_includedir}/%{pkgname}.h
%changelog
* Mon Aug 04 2014 Robert Scheck <robert@fedoraproject.org> 2.1.0-3
- Added %%{?_isa} macro to run-time requires/provides
- Escape macros in spec file (#579925, thanks to R P Herrold)
* Sat Jan 01 2011 Robert Scheck <robert@fedoraproject.org> 2.1.0-2
- Renamed package to tcl-tclreadline (#579925 #c1)
- Fixed undefined non-weak symbols by linking tcl (#579925 #c1)
* Tue Apr 06 2010 Robert Scheck <robert@fedoraproject.org> 2.1.0-1
- Upgrade to 2.1.0
- Initial spec file for Fedora and Red Hat Enterprise Linux