summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-11-07 06:42:14 -0800
committerAnas Nashif <anas.nashif@intel.com>2012-11-07 06:42:14 -0800
commit035f92c16c2e5a352a1dcde90c5c5b54d2be6152 (patch)
tree5f80536605b2267152f70d45cb99b76cfc2bc41e
parent995d4374c896f9ad70ed1bf1aeca8c203f547f5f (diff)
downloadreadline-035f92c16c2e5a352a1dcde90c5c5b54d2be6152.tar.gz
readline-035f92c16c2e5a352a1dcde90c5c5b54d2be6152.tar.bz2
readline-035f92c16c2e5a352a1dcde90c5c5b54d2be6152.zip
add packaging
-rw-r--r--packaging/baselibs.conf6
-rw-r--r--packaging/readline-4.3-input.dif50
-rw-r--r--packaging/readline-5.1-destdir.patch195
-rw-r--r--packaging/readline-5.2-conf.patch118
-rw-r--r--packaging/readline-5.2-wrap.patch14
-rw-r--r--packaging/readline-5.2.dif139
-rw-r--r--packaging/readline.spec150
7 files changed, 672 insertions, 0 deletions
diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf
new file mode 100644
index 0000000..074a6f7
--- /dev/null
+++ b/packaging/baselibs.conf
@@ -0,0 +1,6 @@
+libreadline5
+ obsoletes "readline-<targettype> <= <version>"
+ provides "readline-<targettype> = <version>"
+readline5-devel
+ requires -readline5-<targettype>
+ requires "libreadline5-<targettype> = <version>"
diff --git a/packaging/readline-4.3-input.dif b/packaging/readline-4.3-input.dif
new file mode 100644
index 0000000..b960cfb
--- /dev/null
+++ b/packaging/readline-4.3-input.dif
@@ -0,0 +1,50 @@
+Index: input.c
+===================================================================
+--- input.c.orig
++++ input.c
+@@ -448,6 +448,8 @@ rl_read_key ()
+ return (c);
+ }
+
++extern int _rl_read_zero_char_from_tty;
++
+ int
+ rl_getc (stream)
+ FILE *stream;
+@@ -469,7 +471,10 @@ rl_getc (stream)
+ /* If zero characters are returned, then the file that we are
+ reading from is empty! Return EOF in that case. */
+ if (result == 0)
+- return (EOF);
++ {
++ _rl_read_zero_char_from_tty = 1;
++ return (EOF);
++ }
+
+ #if defined (__BEOS__)
+ if (errno == EINTR)
+Index: readline.c
+===================================================================
+--- readline.c.orig
++++ readline.c
+@@ -440,6 +440,9 @@ _rl_internal_char_cleanup ()
+ _rl_erase_entire_line ();
+ }
+
++/* Catch EOF from tty, do not return command line */
++int _rl_read_zero_char_from_tty = 0;
++
+ STATIC_CALLBACK int
+ #if defined (READLINE_CALLBACKS)
+ readline_internal_char ()
+@@ -484,6 +487,10 @@ readline_internal_charloop ()
+ c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_READCMD);
+
++ /* Return here if terminal is closed */
++ if (c == EOF && _rl_read_zero_char_from_tty)
++ return (rl_done = 1);
++
+ /* look at input.c:rl_getc() for the circumstances under which this will
+ be returned; punt immediately on read error without converting it to
+ a newline. */
diff --git a/packaging/readline-5.1-destdir.patch b/packaging/readline-5.1-destdir.patch
new file mode 100644
index 0000000..f71c05c
--- /dev/null
+++ b/packaging/readline-5.1-destdir.patch
@@ -0,0 +1,195 @@
+Index: shlib/Makefile.in
+===================================================================
+--- shlib/Makefile.in.orig
++++ shlib/Makefile.in
+@@ -57,6 +57,7 @@ bindir = @bindir@
+ libdir = @libdir@
+ datadir = @datadir@
+ localedir = $(datadir)/locale
++linkagedir = $(libdir)
+
+ # Support an alternate destination root directory for package building
+ DESTDIR =
+@@ -181,13 +182,13 @@ installdirs: $(topdir)/support/mkdirs
+ -$(SHELL) $(topdir)/support/mkdirs $(DESTDIR)$(libdir)
+
+ install: installdirs $(SHLIB_STATUS)
+- $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -i "$(INSTALL_DATA)" $(SHARED_HISTORY)
+- $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -i "$(INSTALL_DATA)" $(SHARED_READLINE)
++ $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -dd $(DESTDIR) -d $(libdir) -l $(linkagedir) -b $(bindir) -i "$(INSTALL_DATA)" $(SHARED_HISTORY)
++ $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -dd $(DESTDIR) -d $(libdir) -l $(linkagedir) -b $(bindir) -i "$(INSTALL_DATA)" $(SHARED_READLINE)
+ @echo install: you may need to run ldconfig
+
+ uninstall:
+- $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -U $(SHARED_HISTORY)
+- $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -U $(SHARED_READLINE)
++ $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -dd $(DESTDIR) -d $(libdir) -l $(linkagedir) -b $(bindir) -U $(SHARED_HISTORY)
++ $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -dd $(DESTDIR) -d $(libdir) -l $(linkagedir) -b $(bindir) -U $(SHARED_READLINE)
+ @echo uninstall: you may need to run ldconfig
+
+ clean mostlyclean: force
+Index: support/shlib-install
+===================================================================
+--- support/shlib-install.orig
++++ support/shlib-install
+@@ -3,7 +3,7 @@
+ # shlib-install - install a shared library and do any necessary host-specific
+ # post-installation configuration (like ldconfig)
+ #
+-# usage: shlib-install [-D] -O host_os -d installation-dir [-b bin-dir] -i install-prog [-U] library
++# usage: shlib-install [-D] -O host_os -d installation-dir [-l linkage-dir] [-b bin-dir] -i install-prog [-U] library
+ #
+ # Chet Ramey
+ # chet@po.cwru.edu
+@@ -12,10 +12,12 @@
+ # defaults
+ #
+ INSTALLDIR=/usr/local/lib
++LINKAGEDIR=
+ LDCONFIG=ldconfig
++DESTDIR=
+
+ PROGNAME=`basename $0`
+-USAGE="$PROGNAME [-D] -O host_os -d installation-dir [-b bin-dir] -i install-prog [-U] library"
++USAGE="$PROGNAME [-D] -O host_os -d installation-dir [-l linkage-dir] [-b bin-dir] -i install-prog [-U] library"
+
+ # process options
+
+@@ -23,14 +25,19 @@ while [ $# -gt 0 ]; do
+ case "$1" in
+ -O) shift; host_os="$1"; shift ;;
+ -d) shift; INSTALLDIR="$1"; shift ;;
++ -dd) shift; DESTDIR=$1; shift ;;
+ -b) shift; BINDIR="$1" ; shift ;;
+ -i) shift; INSTALLPROG="$1" ; shift ;;
++ -l) shift; LINKAGEDIR="$1" ; shift ;;
+ -D) echo=echo ; shift ;;
+ -U) uninstall=true ; shift ;;
+ -*) echo "$USAGE" >&2 ; exit 2;;
+ *) break ;;
+ esac
+ done
++if [ -z "$LINKAGEDIR" ]; then
++ LINKAGEDIR="$INSTALLDIR"
++fi
+
+ # set install target name
+ LIBNAME="$1"
+@@ -48,18 +55,18 @@ LN="ln -s"
+ # pre-install
+
+ if [ -z "$uninstall" ]; then
+- ${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
+- if [ -f "$INSTALLDIR/$LIBNAME" ]; then
+- ${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
++ ${echo} $RM ${DESTDIR}${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
++ if [ -f "${DESTDIR}$INSTALLDIR/$LIBNAME" ]; then
++ ${echo} $MV ${DESTDIR}$INSTALLDIR/$LIBNAME ${DESTDIR}${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
+ fi
+ fi
+
+ # install/uninstall
+
+ if [ -z "$uninstall" ] ; then
+- ${echo} eval ${INSTALLPROG} $LIBNAME ${INSTALLDIR}/${LIBNAME}
++ ${echo} eval ${INSTALLPROG} $LIBNAME ${DESTDIR}${INSTALLDIR}/${LIBNAME}
+ else
+- ${echo} ${RM} ${INSTALLDIR}/${LIBNAME}
++ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/${LIBNAME}
+ fi
+
+ # post-install/uninstall
+@@ -71,7 +78,7 @@ fi
+ case "$host_os" in
+ hpux*|darwin*|macosx*|linux*)
+ if [ -z "$uninstall" ]; then
+- chmod 555 ${INSTALLDIR}/${LIBNAME}
++ chmod 555 ${DESTDIR}${INSTALLDIR}/${LIBNAME}
+ fi ;;
+ cygwin*)
+ IMPLIBNAME=`echo ${LIBNAME} \
+@@ -109,8 +116,8 @@ case "$LIBNAME" in
+ LINK1=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]\.[0-9]:\1:'` # libname.dylib
+ esac
+
+-INSTALL_LINK1='${echo} cd $INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK1'
+-INSTALL_LINK2='${echo} cd $INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK2'
++INSTALL_LINK1='${echo} cd ${DESTDIR}$INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK1'
++INSTALL_LINK2='${echo} cd ${DESTDIR}$INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK2'
+
+ #
+ # Create symlinks to the installed library. This section is incomplete.
+@@ -118,27 +125,27 @@ INSTALL_LINK2='${echo} cd $INSTALLDIR &&
+ case "$host_os" in
+ *linux*)
+ # libname.so.M -> libname.so.M.N
+- ${echo} ${RM} ${INSTALLDIR}/$LINK2
++ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/$LINK2
+ if [ -z "$uninstall" ]; then
+ eval $INSTALL_LINK2
+ fi
+
+ # libname.so -> libname.so.M
+- ${echo} ${RM} ${INSTALLDIR}/$LINK1
++ ${echo} ${RM} ${DESTDIR}${LINKAGEDIR}/$LINK1
+ if [ -z "$uninstall" ]; then
+- ${echo} cd $INSTALLDIR && ${echo} ${LN} $LINK2 $LINK1
++ ${echo} ln -s ${INSTALLDIR}/$LIBNAME ${DESTDIR}${LINKAGEDIR}/$LINK1
+ fi
+ ;;
+
+ bsdi4*|*gnu*|darwin*|macosx*|k*bsd*-gnu)
+ # libname.so.M -> libname.so.M.N
+- ${echo} ${RM} ${INSTALLDIR}/$LINK2
++ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/$LINK2
+ if [ -z "$uninstall" ]; then
+ eval $INSTALL_LINK2
+ fi
+
+ # libname.so -> libname.so.M.N
+- ${echo} ${RM} ${INSTALLDIR}/$LINK1
++ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/$LINK1
+ if [ -z "$uninstall" ]; then
+ eval $INSTALL_LINK1
+ fi
+@@ -146,7 +153,7 @@ bsdi4*|*gnu*|darwin*|macosx*|k*bsd*-gnu)
+
+ solaris2*|aix4.[2-9]*|osf*|irix[56]*|sysv[45]*|dgux*)
+ # libname.so -> libname.so.M
+- ${echo} ${RM} ${INSTALLDIR}/$LINK1
++ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/$LINK1
+ if [ -z "$uninstall" ]; then
+ eval $INSTALL_LINK1
+ fi
+@@ -157,19 +164,19 @@ solaris2*|aix4.[2-9]*|osf*|irix[56]*|sys
+ freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*)
+ if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
+ # libname.so -> libname.so.M
+- ${echo} ${RM} ${INSTALLDIR}/$LINK1
++ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/$LINK1
+ if [ -z "$uninstall" ]; then
+ eval $INSTALL_LINK1
+ fi
+ else
+ # libname.so.M -> libname.so.M.N
+- ${echo} ${RM} ${INSTALLDIR}/$LINK2
++ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/$LINK2
+ if [ -z "$uninstall" ]; then
+ eval $INSTALL_LINK2
+ fi
+
+ # libname.so -> libname.so.M.N
+- ${echo} ${RM} ${INSTALLDIR}/$LINK1
++ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/$LINK1
+ if [ -z "$uninstall" ]; then
+ eval $INSTALL_LINK1
+ fi
+@@ -178,7 +185,7 @@ freebsd[3-9]*|freebsdelf[3-9]*|freebsdao
+
+ hpux1*)
+ # libname.sl -> libname.M
+- ${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
++ ${echo} ${RM} ${DESTDIR}${INSTALLDIR}/$LINK1.sl
+ if [ -z "$uninstall" ]; then
+ eval $INSTALL_LINK1
+ fi
diff --git a/packaging/readline-5.2-conf.patch b/packaging/readline-5.2-conf.patch
new file mode 100644
index 0000000..cf5b989
--- /dev/null
+++ b/packaging/readline-5.2-conf.patch
@@ -0,0 +1,118 @@
+--- bind.c
++++ bind.c 2006-11-13 17:20:23.000000000 +0100
+@@ -752,6 +752,9 @@ rl_function_of_keyseq (keyseq, map, type
+ /* The last key bindings file read. */
+ static char *last_readline_init_file = (char *)NULL;
+
++/* Flag to read system init file */
++static int read_system_init_file = 0;
++
+ /* The file we're currently reading key bindings from. */
+ static const char *current_readline_init_file;
+ static int current_readline_init_include_level;
+@@ -815,11 +818,14 @@ rl_re_read_init_file (count, ignore)
+ return r;
+ }
+
++/* Forward declarations */
++static int sv_bell_style PARAMS((const char *));
++
+ /* Do key bindings from a file. If FILENAME is NULL it defaults
+ to the first non-null filename from this list:
+ 1. the filename used for the previous call
+ 2. the value of the shell variable `INPUTRC'
+- 3. ~/.inputrc
++ 3. /etc/inputrc and ~/.inputrc
+ 4. /etc/inputrc
+ If the file existed and could be opened and read, 0 is returned,
+ otherwise errno is returned. */
+@@ -831,16 +837,37 @@ rl_read_init_file (filename)
+ if (filename == 0)
+ filename = last_readline_init_file;
+ if (filename == 0)
+- filename = sh_get_env_value ("INPUTRC");
++ {
++ filename = sh_get_env_value ("INPUTRC");
++ if (filename && !strncmp(SYS_INPUTRC, filename, strlen(SYS_INPUTRC)))
++ {
++ struct stat st;
++ char *default_inputrc = tilde_expand(DEFAULT_INPUTRC);
++
++ if ((stat(default_inputrc, &st) == 0))
++ {
++ filename = DEFAULT_INPUTRC;
++ read_system_init_file = 1;
++ }
++ else
++ read_system_init_file = 0;
++
++ free(default_inputrc);
++ }
++ else
++ read_system_init_file = 1;
++ }
+ if (filename == 0 || *filename == 0)
+ {
+ filename = DEFAULT_INPUTRC;
+- /* Try to read DEFAULT_INPUTRC; fall back to SYS_INPUTRC on failure */
+- if (_rl_read_init_file (filename, 0) == 0)
+- return 0;
+- filename = SYS_INPUTRC;
++ read_system_init_file = 1;
+ }
+
++ sv_bell_style(sh_get_env_value("DEFAULT_BELL_STYLE"));
++
++ if (read_system_init_file)
++ _rl_read_init_file (SYS_INPUTRC, 1);
++
+ #if defined (__MSDOS__)
+ if (_rl_read_init_file (filename, 0) == 0)
+ return 0;
+@@ -1350,7 +1377,14 @@ rl_parse_and_bind (string)
+ rl_macro_bind (seq, &funname[1], _rl_keymap);
+ }
+ else
+- rl_bind_keyseq (seq, rl_named_function (funname));
++ {
++#if defined (PREFIX_META_HACK)
++ if (_rl_stricmp (funname, "prefix-meta") == 0)
++ rl_generic_bind (ISKMAP, seq, (char *)emacs_meta_keymap, _rl_keymap);
++ else
++#endif
++ rl_bind_keyseq (seq, rl_named_function (funname));
++ }
+
+ free (seq);
+ return 0;
+@@ -1487,7 +1521,6 @@ typedef int _rl_sv_func_t PARAMS((const
+ #define V_INT 2
+
+ /* Forward declarations */
+-static int sv_bell_style PARAMS((const char *));
+ static int sv_combegin PARAMS((const char *));
+ static int sv_compquery PARAMS((const char *));
+ static int sv_editmode PARAMS((const char *));
+--- rlconf.h
++++ rlconf.h 2006-11-13 17:21:26.000000000 +0100
+@@ -35,7 +35,7 @@
+ #define HANDLE_SIGNALS
+
+ /* Ugly but working hack for binding prefix meta. */
+-#define PREFIX_META_HACK
++#undef PREFIX_META_HACK
+
+ /* The next-to-last-ditch effort file name for a user-specific init file. */
+ #define DEFAULT_INPUTRC "~/.inputrc"
+--- doc/rluser.texi
++++ doc/rluser.texi 2006-11-13 17:23:56.000000000 +0100
+@@ -338,7 +338,8 @@ file is taken from the value of the envi
+ @end ifclear
+ that variable is unset, the default is @file{~/.inputrc}. If that
+ file does not exist or cannot be read, the ultimate default is
+-@file{/etc/inputrc}.
++@file{/etc/inputrc}. If both @file{~/.inputrc} and @file{/etc/inputrc}
++exist Readline will read first @file{/etc/inputrc} and then @file{~/.inputrc}.
+
+ When a program which uses the Readline library starts up, the
+ init file is read, and the key bindings are set.
diff --git a/packaging/readline-5.2-wrap.patch b/packaging/readline-5.2-wrap.patch
new file mode 100644
index 0000000..4c04168
--- /dev/null
+++ b/packaging/readline-5.2-wrap.patch
@@ -0,0 +1,14 @@
+--- display.c
++++ display.c 2006-11-13 16:55:24.000000000 +0100
+@@ -665,7 +665,10 @@
+ inv_lbreaks[++newlines] = temp;
+ #if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+- lpos -= _rl_col_width (local_prompt, n0, num);
++ {
++ if (local_prompt_len > 0)
++ lpos -= _rl_col_width (local_prompt, n0, num);
++ }
+ else
+ #endif
+ lpos -= _rl_screenwidth;
diff --git a/packaging/readline-5.2.dif b/packaging/readline-5.2.dif
new file mode 100644
index 0000000..e8e8b88
--- /dev/null
+++ b/packaging/readline-5.2.dif
@@ -0,0 +1,139 @@
+--- .pkgextract
++++ .pkgextract 2005-12-09 17:09:26.000000000 +0100
+@@ -0,0 +1,5 @@
++tar Oxfj ../readline-5.2-patches.tar.bz2 | patch -p0 -s
++patch -p2 -s --suffix=".zerotty" < ../readline-4.3-input.dif
++patch -p2 -s --suffix=".wrap" < ../readline-5.2-wrap.patch
++patch -p2 -s --suffix=".conf" < ../readline-5.2-conf.patch
++patch -p0 -s --suffix=".destdir" < ../readline-5.1-destdir.patch
+--- Makefile.in
++++ Makefile.in 2005-12-09 17:09:26.000000000 +0100
+@@ -220,10 +220,8 @@ maybe-uninstall-headers: uninstall-heade
+ install: $(INSTALL_TARGETS)
+
+ install-static: installdirs $(STATIC_LIBS) install-headers install-doc
+- -$(MV) $(DESTDIR)$(libdir)/libreadline.a $(DESTDIR)$(libdir)/libreadline.old
+ $(INSTALL_DATA) libreadline.a $(DESTDIR)$(libdir)/libreadline.a
+ -test -n "$(RANLIB)" && $(RANLIB) $(DESTDIR)$(libdir)/libreadline.a
+- -$(MV) $(DESTDIR)$(libdir)/libhistory.a $(DESTDIR)$(libdir)/libhistory.old
+ $(INSTALL_DATA) libhistory.a $(DESTDIR)$(libdir)/libhistory.a
+ -test -n "$(RANLIB)" && $(RANLIB) $(DESTDIR)$(libdir)/libhistory.a
+
+@@ -246,7 +244,7 @@ uninstall-shared: maybe-uninstall-header
+ install-doc: installdirs
+ -( if test -d doc ; then \
+ cd doc && \
+- ${MAKE} ${MFLAGS} infodir=$(infodir) DESTDIR=${DESTDIR} install; \
++ ${MAKE} infodir=$(infodir) DESTDIR=${DESTDIR} install; \
+ fi )
+
+ uninstall-doc:
+--- complete.c
++++ complete.c 2005-12-09 17:11:19.000000000 +0100
+@@ -883,7 +883,7 @@ _rl_find_completion_word (fp, dp)
+ /* We didn't find an unclosed quoted substring upon which to do
+ completion, so use the word break characters to find the
+ substring on which to complete. */
+- while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
++ while ((rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY)))
+ {
+ scan = rl_line_buffer[rl_point];
+
+@@ -1802,7 +1802,7 @@ rl_completion_matches (text, entry_funct
+ match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *));
+ match_list[1] = (char *)NULL;
+
+- while (string = (*entry_function) (text, matches))
++ while ((string = (*entry_function) (text, matches)))
+ {
+ if (matches + 1 == match_list_size)
+ match_list = (char **)xrealloc
+@@ -1853,7 +1853,7 @@ rl_username_completion_function (text, s
+ }
+
+ #if defined (HAVE_GETPWENT)
+- while (entry = getpwent ())
++ while ((entry = getpwent ()))
+ {
+ /* Null usernames should result in all users as possible completions. */
+ if (namelen == 0 || (STREQN (username, entry->pw_name, namelen)))
+--- readline.c
++++ readline.c 2005-12-09 17:09:26.000000000 +0100
+@@ -735,7 +735,11 @@ _rl_dispatch_subseq (key, map, got_subse
+ {
+ /* Special case rl_do_lowercase_version (). */
+ if (func == rl_do_lowercase_version)
+- return (_rl_dispatch (_rl_to_lower (key), map));
++ {
++ if (key == ANYOTHERKEY)
++ return -1;
++ return (_rl_dispatch (_rl_to_lower (key), map));
++ }
+
+ rl_executing_keymap = map;
+
+--- readline.h
++++ readline.h 2005-12-09 17:09:26.000000000 +0100
+@@ -445,7 +445,7 @@ extern char *rl_filename_completion_func
+
+ extern int rl_completion_mode PARAMS((rl_command_func_t *));
+
+-#if 0
++#ifdef OLD_READLINE
+ /* Backwards compatibility (compat.c). These will go away sometime. */
+ extern void free_undo_list PARAMS((void));
+ extern int maybe_save_line PARAMS((void));
+--- doc/Makefile.in
++++ doc/Makefile.in 2005-12-09 17:09:26.000000000 +0100
+@@ -96,7 +96,7 @@ DIST_DOCS = $(DVIOBJ) $(PSOBJ) $(HTMLOBJ
+ $(RM) $@
+ -${DVIPDF} $<
+
+-all: info dvi html ps text
++all: info html
+ nodvi: info html text
+
+ info: $(INFOOBJ)
+--- doc/readline.3
++++ doc/readline.3 2006-11-13 17:33:27.000000000 +0100
+@@ -118,6 +118,14 @@ environment variable. If that variable
+ .IR ~/.inputrc .
+ If that file does not exist or cannot be read, the ultimate default is
+ .IR /etc/inputrc .
++If both files
++.I ~/.inputrc
++and
++.I /etc/inputrc
++exist readline will read first
++.I /etc/inputrc
++and then
++.IR ~/.inputrc .
+ When a program which uses the readline library starts up, the
+ init file is read, and the key bindings and variables are set.
+ There are only a few basic constructs allowed in the
+@@ -1270,6 +1278,9 @@ VI Command Mode functions
+ .TP
+ .FN ~/.inputrc
+ Individual \fBreadline\fP initialization file
++.TP
++.FN /etc/inputrc
++System \fBreadline\fP initialization file
+ .PD
+ .SH AUTHORS
+ Brian Fox, Free Software Foundation
+--- support/shobj-conf
++++ support/shobj-conf 2006-09-22 16:17:48.000000000 +0200
+@@ -108,10 +108,11 @@ sunos5*|solaris2*)
+ linux*-*|gnu*-*|k*bsd*-gnu-*)
+ SHOBJ_CFLAGS=-fPIC
+ SHOBJ_LD='${CC}'
+- SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
++ SHOBJ_LDFLAGS='-shared'
+
+- SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
++ SHLIB_XLDFLAGS='-Wl,-rpath-link,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
++ SHLIB_LIBS=-lncurses
+ ;;
+
+ freebsd2* | netbsd*)
diff --git a/packaging/readline.spec b/packaging/readline.spec
new file mode 100644
index 0000000..b85672c
--- /dev/null
+++ b/packaging/readline.spec
@@ -0,0 +1,150 @@
+Name: readline
+Version: 5.2
+Release: 0
+License: GPL-2.0+
+Summary: The Readline Library
+Url: http://www.gnu.org/software/bash/bash.html
+Group: System/Libraries
+Source0: readline-%{rl_vers}.tar.bz2
+Source1: readline-%{rl_vers}-patches.tar.bz2
+Source2: baselibs.conf
+Patch20: readline-%{rl_vers}.dif
+Patch21: readline-4.3-input.dif
+Patch22: readline-5.2-wrap.patch
+Patch23: readline-5.2-conf.patch
+Patch30: readline-5.1-destdir.patch
+BuildRequires: autoconf
+BuildRequires: bison
+BuildRequires: fdupes
+BuildRequires: ncurses-devel
+%define rl_vers 5.2
+Provides: bash:/%{_lib}/libreadline.so.5
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+%global _sysconfdir /etc
+%global _incdir %{_includedir}
+
+%description
+The readline library is used by the Bourne Again Shell (bash, the
+standard command interpreter) for easy editing of command lines. This
+includes history and search functionality.
+
+%package devel
+Version: 5.2
+Release: 0
+Summary: Include Files and Libraries mandatory for Development
+Group: Development/Libraries/C and C++
+Requires: libreadline = %{version}
+Requires: ncurses-devel
+Provides: bash:%{_libdir}/libreadline.a
+
+%description devel
+This package contains all necessary include files and libraries needed
+to develop applications that require these.
+
+%package -n libreadline
+Summary: The Readline Library
+
+%description -n libreadline
+The readline library is used by the Bourne Again Shell (bash, the
+standard command interpreter) for easy editing of command lines. This
+includes history and search functionality.
+
+%prep
+%setup -q -n readline-%{rl_vers}
+for p in ../readline-%{rl_vers}-patches/*; do
+ test -e $p || break
+ echo Patch $p
+ patch -s -p0 < $p
+done
+%patch21 -p0 -b .zerotty
+%patch22 -p0 -b .wrap
+%patch23 -p0 -b .conf
+%patch30 -p0 -b .destdir
+%patch20 -p0
+
+%build
+ autoconf
+ cflags ()
+ {
+ local flag=$1; shift
+ case "%{optflags}" in
+ *${flag}*) return
+ esac
+ if test -n "$1" && gcc -Werror $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then
+ local var=$1; shift
+ eval $var=\${$var:+\$$var\ }$flag
+ fi
+ }
+ echo 'int main () { return !(sizeof(void*) >= 8); }' | gcc -x c -o test64 -
+ if ./test64 ; then
+ LARGEFILE=""
+ else
+ LARGEFILE="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
+ fi
+ rm -f ./test64
+ CFLAGS="%{optflags} $LARGEFILE -D_GNU_SOURCE -DRECYCLES_PIDS -Wall -g"
+ LDFLAGS=""
+ cflags -std=gnu89 CFLAGS
+ cflags -Wuninitialized CFLAGS
+ cflags -Wextra CFLAGS
+ cflags -Wno-unprototyped-calls CFLAGS
+ cflags -Wno-switch-enum CFLAGS
+ cflags -ftree-loop-linear CFLAGS
+ cflags -pipe CFLAGS
+ cflags -Wl,--as-needed LDFLAGS
+ cflags -Wl,-O,2 LDFLAGS
+ CC=gcc
+ CC_FOR_BUILD="$CC"
+ CFLAGS_FOR_BUILD="$CFLAGS"
+ LDFLAGS_FOR_BUILD="$LDFLAGS"
+ export CC_FOR_BUILD CFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD CFLAGS LDFLAGS CC
+ ./configure --build=%{_target_cpu}-suse-linux \
+ --prefix=%{_prefix} \
+ --with-curses \
+ --mandir=%{_mandir} \
+ --infodir=%{_infodir} \
+ --libdir=%{_libdir}
+ make
+ make documentation
+ ln -sf shlib/libreadline.so.%{rl_vers} libreadline.so
+ ln -sf shlib/libreadline.so.%{rl_vers} libreadline.so.5
+ ln -sf shlib/libhistory.so.%{rl_vers} libhistory.so
+ ln -sf shlib/libhistory.so.%{rl_vers} libhistory.so.5
+
+%install
+ make install htmldir=%{_defaultdocdir}/readline DESTDIR=%{buildroot}
+ make install-shared libdir=/%{_lib} linkagedir=%{_libdir} DESTDIR=%{buildroot}
+ rm -rf %{buildroot}%{_defaultdocdir}/bash
+ rm -rf %{buildroot}%{_defaultdocdir}/readline
+ chmod 0755 %{buildroot}/%{_lib}/libhistory.so.%{rl_vers}
+ chmod 0755 %{buildroot}/%{_lib}/libreadline.so.%{rl_vers}
+ rm -f %{buildroot}/%{_lib}/libhistory.so.%{rl_vers}*old
+ rm -f %{buildroot}/%{_lib}/libreadline.so.%{rl_vers}*old
+ # remove unpackaged files
+ rm -fv %{buildroot}%{_libdir}/libhistory.so.*
+ rm -fv %{buildroot}%{_libdir}/libreadline.so.*
+ rm -fv %{buildroot}%{_mandir}/man3/history.3*
+ rm -fv %{buildroot}%{_infodir}/*.info*
+
+%post -n libreadline -p /sbin/ldconfig
+
+%postun -n libreadline -p /sbin/ldconfig
+
+
+%files -n libreadline
+%defattr(-,root,root)
+/%{_lib}/libhistory.so.5
+/%{_lib}/libhistory.so.%{rl_vers}
+/%{_lib}/libreadline.so.5
+/%{_lib}/libreadline.so.%{rl_vers}
+
+%files devel
+%defattr(-,root,root)
+%{_incdir}/readline/
+%{_libdir}/libhistory.a
+%{_libdir}/libhistory.so
+%{_libdir}/libreadline.a
+%{_libdir}/libreadline.so
+%doc %{_mandir}/man3/readline.3.gz
+
+%changelog