Skip to content

Commit

Permalink
Updated readline to 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ardagnir committed Jan 28, 2019
1 parent df82379 commit 8c55712
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 47 deletions.
4 changes: 2 additions & 2 deletions bash_readline_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ fi
#Build and install bash
if [ $build = 1 ]; then
if [ ! -f Makefile ]; then
ac_cv_rl_version=7.0 ./configure \
ac_cv_rl_version=8.0 ./configure \
"--prefix=$prefix" \
--docdir=${prefix}/usr/share/doc/bash-4.4 \
--without-bash-malloc \
Expand All @@ -111,7 +111,7 @@ if [ $build = 1 ]; then
fi
make LOCAL_LIBS=-lutil "$readline_make_flag"
if [ $? != 0 ]; then
printf "\n\e[1;31mMake failed:\e[0m Are you sure you have readline 7 installed? readline_athame_setup.sh installs readline 7 patched with athame. You may want to run it first.\nThis may also fail if you have a versionless libreadline.so symlinked to libreadline.so.6\n"
printf "\n\e[1;31mMake failed:\e[0m Are you sure you have readline 8 installed? readline_athame_setup.sh installs readline 8 patched with athame. You may want to run it first.\nThis may also fail if you have a versionless libreadline.so symlinked to libreadline.so.7\n"
exit 1
fi
if [ -n "$destdir" ]; then
Expand Down
56 changes: 28 additions & 28 deletions readline.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff -ru a/display.c b/display.c
--- a/display.c 2015-10-28 00:00:00.000000000 - 0400
--- b/display.c 2015-10-28 00:00:00.000000000 - 0400
@@ -241,6 +241,11 @@
@@ -255,6 +255,11 @@
static int prompt_last_screen_line;

static int prompt_physical_chars;
Expand All @@ -11,12 +11,12 @@ diff -ru a/display.c b/display.c
+ return prompt_physical_chars;
+}

/* set to a non-zero value by rl_redisplay if we are marking modified history
lines and the current line is so marked. */
/* An array of indexes into the prompt string where we will break physical
screen lines. It's easier to compute in expand_prompt and use later in
diff -ru a/Makefile.in b/Makefile.in
--- a/Makefile.in 2015-07-15 00:03:32.894897704 -0400
+++ b/Makefile.in 2015-07-14 23:36:13.208157503 -0400
@@ -74,7 +74,7 @@
@@ -75,7 +75,7 @@
CTAGS = ctags -tw

CFLAGS = @CFLAGS@
Expand All @@ -25,7 +25,7 @@ diff -ru a/Makefile.in b/Makefile.in
CPPFLAGS = @CPPFLAGS@

DEFS = @DEFS@ @CROSS_COMPILE@
@@ -114,7 +114,7 @@
@@ -120,7 +120,7 @@
$(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \
$(srcdir)/shell.c $(srcdir)/savestring.c $(srcdir)/tilde.c \
$(srcdir)/text.c $(srcdir)/misc.c $(srcdir)/compat.c \
Expand All @@ -34,7 +34,7 @@ diff -ru a/Makefile.in b/Makefile.in

# The header files for this library.
HSOURCES = $(srcdir)/readline.h $(srcdir)/rldefs.h $(srcdir)/chardefs.h \
@@ -124,7 +124,7 @@
@@ -130,7 +130,7 @@
$(srcdir)/ansi_stdlib.h $(srcdir)/tcap.h $(srcdir)/rlstdc.h \
$(srcdir)/xmalloc.h $(srcdir)/rlprivate.h $(srcdir)/rlshell.h \
$(srcdir)/rltypedefs.h $(srcdir)/rlmbutil.h \
Expand All @@ -43,7 +43,7 @@ diff -ru a/Makefile.in b/Makefile.in

HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o mbutil.o
TILDEOBJ = tilde.o
@@ -147,7 +147,7 @@
@@ -153,7 +153,7 @@
CREATED_TAGS = TAGS tags

INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h \
Expand All @@ -52,7 +52,7 @@ diff -ru a/Makefile.in b/Makefile.in

OTHER_DOCS = $(srcdir)/CHANGES $(srcdir)/INSTALL $(srcdir)/README
OTHER_INSTALLED_DOCS = CHANGES INSTALL README
@@ -221,6 +221,13 @@
@@ -230,6 +230,13 @@

install: $(INSTALL_TARGETS)

Expand All @@ -66,25 +66,25 @@ diff -ru a/Makefile.in b/Makefile.in
install-headers: installdirs ${INSTALLED_HEADERS}
for f in ${INSTALLED_HEADERS}; do \
$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(includedir)/readline ; \
@@ -232,7 +239,7 @@
@@ -250,7 +257,7 @@

maybe-uninstall-headers: uninstall-headers
maybe-uninstall-pc: uninstall-pc

-install-static: installdirs $(STATIC_LIBS) install-headers install-doc install-examples
+install-static: installdirs $(STATIC_LIBS) install-headers install-doc install-examples install-vimbed
-install-static: installdirs $(STATIC_LIBS) install-headers install-doc ${install_examples} install-pc
+install-static: installdirs $(STATIC_LIBS) install-headers install-doc ${install_examples} install-pc install-vimbed
-$(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
@@ -245,7 +252,7 @@
$(DESTDIR)$(includedir)/readline $(DESTDIR)$(libdir) \
$(DESTDIR)$(infodir) $(DESTDIR)$(man3dir) $(DESTDIR)$(docdir)
@@ -264,7 +281,7 @@
$(DESTDIR)$(infodir) $(DESTDIR)$(man3dir) $(DESTDIR)$(docdir) \
$(DESTDIR)$(pkgconfigdir)

-uninstall: uninstall-headers uninstall-doc uninstall-examples
+uninstall: uninstall-headers uninstall-doc uninstall-examples uninstall-vimbed
-uninstall: uninstall-headers uninstall-doc uninstall-examples uninstall-pc
+uninstall: uninstall-headers uninstall-doc uninstall-examples uninstall-pc uninstall-vimbed
-test -n "$(DESTDIR)$(libdir)" && cd $(DESTDIR)$(libdir) && \
${RM} libreadline.a libreadline.old libhistory.a libhistory.old $(SHARED_LIBS)
-( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
@@ -393,7 +400,7 @@
@@ -412,7 +419,7 @@
readline.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
readline.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
readline.o: history.h rlstdc.h
Expand All @@ -93,15 +93,15 @@ diff -ru a/Makefile.in b/Makefile.in
rltty.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
rltty.o: rltty.h
rltty.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
@@ -513,6 +520,7 @@
@@ -532,6 +539,7 @@
text.o: rlmbutil.h
vi_mode.o: rlmbutil.h

+athame.o: $(srcdir)/athame.c
bind.o: $(srcdir)/bind.c
callback.o: $(srcdir)/callback.c
compat.o: $(srcdir)/compat.c
@@ -551,6 +559,7 @@
@@ -570,6 +578,7 @@
history.o: $(srcdir)/history.c
histsearch.o: $(srcdir)/histsearch.c

Expand All @@ -120,7 +120,7 @@ diff -ru a/readline.c b/readline.c

#include "rlprivate.h"
#include "rlshell.h"
@@ -446,6 +447,8 @@
@@ -450,6 +451,8 @@
if (rl_pre_input_hook)
(*rl_pre_input_hook) ();

Expand All @@ -129,7 +129,7 @@ diff -ru a/readline.c b/readline.c
RL_CHECK_SIGNALS ();
}

@@ -458,6 +461,8 @@
@@ -461,6 +464,8 @@

RL_CHECK_SIGNALS ();

Expand All @@ -138,7 +138,7 @@ diff -ru a/readline.c b/readline.c
/* Restore the original of this history line, iff the line that we
are editing was originally in the history, AND the line has changed. */
entry = current_history ();
@@ -567,7 +572,16 @@
@@ -570,7 +575,16 @@
}

RL_SETSTATE(RL_STATE_READCMD);
Expand All @@ -156,15 +156,15 @@ diff -ru a/readline.c b/readline.c
RL_UNSETSTATE(RL_STATE_READCMD);

/* look at input.c:rl_getc() for the circumstances under which this will
@@ -627,6 +641,7 @@
@@ -630,6 +644,7 @@

lastc = c;
_rl_dispatch ((unsigned char)c, _rl_keymap);
r = _rl_dispatch ((unsigned char)c, _rl_keymap);
+ athame_char_handled();
RL_CHECK_SIGNALS ();

/* If there was no change in _rl_last_command_was_kill, then no kill
@@ -635,6 +650,7 @@
@@ -638,6 +653,7 @@
if (rl_pending_input == 0 && lk == _rl_last_command_was_kill)
_rl_last_command_was_kill = 0;

Expand Down Expand Up @@ -264,7 +264,7 @@ diff -ru a/shlib/Makefile.in b/shlib/Makefile.in
diff -ru a/readline.h b/readline.h
--- a/readline.h 2015-10-29 00:00:00.000000000 -0400
+++ b/readline.h 2015-10-29 00:00:00.000000000 -0400
@@ -292,6 +292,7 @@
@@ -295,6 +295,7 @@

extern int rl_set_prompt PARAMS((const char *));
extern int rl_expand_prompt PARAMS((char *));
Expand All @@ -283,7 +283,7 @@ diff -ru a/callback.c b/callback.c

#if defined (READLINE_CALLBACKS)

@@ -313,6 +314,8 @@
@@ -311,6 +312,8 @@
rl_clear_signals ();
#endif
}
Expand Down
34 changes: 17 additions & 17 deletions readline_athame_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

shopt -s extglob

patches=3
patches=0
redownload=0
build=1
runtest=1
Expand Down Expand Up @@ -103,43 +103,43 @@ fi

#Download Readline
if [ $redownload = 1 ]; then
rm -r readline-7.0.tar.gz
rm -r readline-8.0.tar.gz
fi
if [ ! -f readline-7.0.tar.gz ]; then
curl -O https://ftp.gnu.org/gnu/readline/readline-7.0.tar.gz
if [ ! -f readline-8.0.tar.gz ]; then
curl -O https://ftp.gnu.org/gnu/readline/readline-8.0.tar.gz
fi

mkdir -p readline_patches
cd readline_patches
for (( patch=1; patch <= patches; patch++ )); do
if [ $redownload = 1 ]; then
rm -r readline70-$(printf "%03d" $patch)
rm -r readline80-$(printf "%03d" $patch)
fi
if [ ! -f readline70-$(printf "%03d" $patch) ]; then
curl -O https://ftp.gnu.org/gnu/readline/readline-7.0-patches/readline70-$(printf "%03d" $patch)
if [ ! -f readline80-$(printf "%03d" $patch) ]; then
curl -O https://ftp.gnu.org/gnu/readline/readline-8.0-patches/readline80-$(printf "%03d" $patch)
fi
done
cd ..

if [ ! -d readline-7.0_tmp ]; then
if [ ! -d readline-8.0_tmp ]; then
dirty=0
fi

#Unpack readline dir
if [ $dirty = 0 ]; then
rm -rf readline-7.0_tmp
tar -xf readline-7.0.tar.gz
mv readline-7.0 readline-7.0_tmp
rm -rf readline-8.0_tmp
tar -xf readline-8.0.tar.gz
mv readline-8.0 readline-8.0_tmp
fi

#Move into readline directory
cd readline-7.0_tmp
cd readline-8.0_tmp

if [ $dirty = 0 ]; then
#Patch readline with readline patches
for (( patch=1; patch <= patches; patch++ )); do
echo Patching with standard readline patch $patch
patch -p0 < ../readline_patches/readline70-$(printf "%03d" $patch)
patch -p0 < ../readline_patches/readline80-$(printf "%03d" $patch)
done
fi

Expand Down Expand Up @@ -175,20 +175,20 @@ if [ $runtest = 1 ]; then
fi
if [ "$(uname)" == "Darwin" ]; then
export DYLD_LIBRARY_PATH="$LD_LIBRARY_PATH"
otool -L "$(which bash)" | grep libreadline.7.dylib >/dev/null
otool -L "$(which bash)" | grep libreadline.8.dylib >/dev/null
else
ldd "$(which bash)" | grep libreadline.so.7 >/dev/null
ldd "$(which bash)" | grep libreadline.so.8 >/dev/null
fi
if [ $? -eq 1 ]; then
echo "Bash isn't set to use system readline or is not using readline 7. Setting up local bash for testing."
echo "Bash isn't set to use system readline or is not using readline 8. Setting up local bash for testing."
cd ..
./bash_readline_setup.sh --destdir="$(pwd)/test/build" --use_readline="${LD_LIBRARY_PATH%+(/lib|/lib/*)}"
cd test
./runtests.sh "$(pwd)/build/bin/bash -i" bash $nvim || exit 1
else
./runtests.sh "bash -i" bash $nvim || exit 1
fi
cd ../readline-7.0_tmp
cd ../readline-8.0_tmp
fi
echo "Installing Readline with Athame..."
if [ -n "$destdir" ]; then
Expand Down

0 comments on commit 8c55712

Please sign in to comment.