# HG changeset patch # User Markus Mützel # Date 1552135668 -3600 # Node ID c1c5dd2cc2f2df0ffb131365fadea3044ef967fb # Parent 457d4af767522b17e0bac1d701a653f5dbdb9a35 Update readline to 8.0. * src/readline.mk: Update version and checksum. * src/readline-1-binding.patch, src/readline-1-display.patch, src/readline-1-input.patch, src/readline-1-paste.patch, src/readline-1-sigwinch.patch, src/readline-2-event.patch: Remove patches that are no longer necessary. * src/readline-1-fixes.patch: Add patch from mxe.cc. * dist-files.mk: Update files. diff -r 457d4af76752 -r c1c5dd2cc2f2 dist-files.mk --- a/dist-files.mk Fri Mar 08 11:18:00 2019 -0500 +++ b/dist-files.mk Sat Mar 09 13:47:48 2019 +0100 @@ -632,12 +632,7 @@ qwt.mk \ qwtplot3d-1-fixes.patch \ qwtplot3d.mk \ - readline-1-binding.patch \ - readline-1-display.patch \ - readline-1-input.patch \ - readline-1-paste.patch \ - readline-1-sigwinch.patch \ - readline-2-event-hook.patch \ + readline-1-fixes.patch \ readline.mk \ release-octave-1-gnulib.patch \ release-octave.mk \ diff -r 457d4af76752 -r c1c5dd2cc2f2 src/readline-1-binding.patch --- a/src/readline-1-binding.patch Fri Mar 08 11:18:00 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -diff -uNr a/readline.c b/readline.c ---- a/readline.c 2010-07-25 17:07:40.000000000 -0400 -+++ b/readline.c 2013-04-17 20:38:42.637674309 -0400 -@@ -1158,7 +1163,10 @@ - rl_bind_keyseq_if_unbound ("\340H", rl_get_previous_history); - rl_bind_keyseq_if_unbound ("\340P", rl_get_next_history); - rl_bind_keyseq_if_unbound ("\340M", rl_forward_char); - rl_bind_keyseq_if_unbound ("\340K", rl_backward_char); -+ rl_bind_keyseq_if_unbound ("\340G", rl_beg_of_line); -+ rl_bind_keyseq_if_unbound ("\340O", rl_end_of_line); -+ rl_bind_keyseq_if_unbound ("\340S", rl_delete); - #endif - - _rl_keymap = xkeymap; diff -r 457d4af76752 -r c1c5dd2cc2f2 src/readline-1-display.patch --- a/src/readline-1-display.patch Fri Mar 08 11:18:00 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -diff -uNr a/display.c b/display.c ---- a/display.c 2009-09-26 14:37:33.000000000 -0400 -+++ b/display.c 2013-04-17 17:51:18.323642508 -0400 -@@ -55,6 +55,11 @@ - #include "rlprivate.h" - #include "xmalloc.h" - -+#if defined (_WIN32) -+#include -+#define hStdout GetStdHandle(STD_OUTPUT_HANDLE) -+#endif -+ - #if !defined (strchr) && !defined (__STDC__) - extern char *strchr (), *strrchr (); - #endif /* !strchr && !__STDC__ */ -@@ -1904,6 +1909,20 @@ - int cpos, dpos; /* current and desired cursor positions */ - int adjust; - -+#if defined (_WIN32) -+ CONSOLE_SCREEN_BUFFER_INFO csbi; -+ if (_rl_last_c_pos != new -+ && GetConsoleScreenBufferInfo (hStdout, &csbi)) -+ { -+ csbi.dwCursorPosition.X += new - _rl_last_c_pos; -+ if (SetConsoleCursorPosition(hStdout, csbi.dwCursorPosition)) -+ { -+ _rl_last_c_pos = new; -+ return; -+ } -+ } -+#endif /* !_WIN32 */ -+ - woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset); - cpos = _rl_last_c_pos; - -@@ -2040,6 +2059,20 @@ - { - register int delta, i; - -+#if defined (_WIN32) -+ CONSOLE_SCREEN_BUFFER_INFO csbi; -+ if (_rl_last_v_pos != to && to <= _rl_screenheight -+ && GetConsoleScreenBufferInfo(hStdout, &csbi)) -+ { -+ csbi.dwCursorPosition.Y += to - _rl_last_v_pos; -+ if (SetConsoleCursorPosition(hStdout, csbi.dwCursorPosition)) -+ { -+ _rl_last_v_pos = to; -+ return; -+ } -+ } -+#endif /* !_WIN32 */ -+ - if (_rl_last_v_pos == to || to > _rl_screenheight) - return; - -@@ -2318,6 +2351,17 @@ - _rl_clear_to_eol (count) - int count; - { -+#if defined (_WIN32) -+ CONSOLE_SCREEN_BUFFER_INFO csbi; -+ if (GetConsoleScreenBufferInfo (hStdout, &csbi)) -+ { -+ DWORD written; -+ FillConsoleOutputCharacter(hStdout, ' ', count, csbi.dwCursorPosition, -+ &written); -+ return; -+ } -+#endif /* !_WIN32 */ -+ - if (_rl_term_clreol) - tputs (_rl_term_clreol, 1, _rl_output_character_function); - else if (count) -@@ -2341,6 +2385,33 @@ - void - _rl_clear_screen () - { -+#if defined (_WIN32) -+ COORD coordScreen = { 0, 0 }; -+ DWORD cCharsWritten; -+ CONSOLE_SCREEN_BUFFER_INFO csbi; -+ DWORD dwConSize; -+ -+ if (GetConsoleScreenBufferInfo (hStdout, &csbi)) -+ { -+ dwConSize = csbi.dwSize.X * csbi.dwSize.Y; -+ -+ if (FillConsoleOutputCharacter (hStdout, (TCHAR) ' ', dwConSize, -+ coordScreen, &cCharsWritten)) -+ { -+ if (GetConsoleScreenBufferInfo (hStdout, &csbi)) -+ { -+ if (FillConsoleOutputAttribute (hStdout, csbi.wAttributes, -+ dwConSize, coordScreen, -+ &cCharsWritten)) -+ { -+ SetConsoleCursorPosition (hStdout, coordScreen); -+ return; -+ } -+ } -+ } -+ } -+#endif -+ - if (_rl_term_clrpag) - tputs (_rl_term_clrpag, 1, _rl_output_character_function); - else diff -r 457d4af76752 -r c1c5dd2cc2f2 src/readline-1-fixes.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/readline-1-fixes.patch Sat Mar 09 13:47:48 2019 +0100 @@ -0,0 +1,106 @@ +This file is part of MXE. See LICENSE.md for licensing information. + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Timothy Gu +Date: Tue, 30 Sep 2014 17:16:32 -0700 +Subject: [PATCH 1/1] Handle missing S_IS* macros more gracefully + + +diff --git a/colors.c b/colors.c +index 1111111..2222222 100644 +--- a/colors.c ++++ b/colors.c +@@ -200,8 +200,10 @@ _rl_print_color_indicator (const char *f) + #endif + if (is_colored (C_CAP) && 0) //f->has_capability) + colored_filetype = C_CAP; ++#if defined(S_IXUGO) + else if ((mode & S_IXUGO) != 0 && is_colored (C_EXEC)) + colored_filetype = C_EXEC; ++#endif + else if ((1 < astat.st_nlink) && is_colored (C_MULTIHARDLINK)) + colored_filetype = C_MULTIHARDLINK; + } +@@ -215,8 +217,10 @@ _rl_print_color_indicator (const char *f) + colored_filetype = C_STICKY_OTHER_WRITABLE; + else + #endif ++#if defined (S_IWOTH) + if ((mode & S_IWOTH) != 0 && is_colored (C_OTHER_WRITABLE)) + colored_filetype = C_OTHER_WRITABLE; ++#endif + #if defined (S_ISVTX) + else if ((mode & S_ISVTX) != 0 && is_colored (C_STICKY)) + colored_filetype = C_STICKY; +diff --git a/colors.h b/colors.h +index 1111111..2222222 100644 +--- a/colors.h ++++ b/colors.h +@@ -96,7 +96,7 @@ enum indicator_no + }; + + +-#if !S_IXUGO ++#if !S_IXUGO && defined(S_IXUSR) && defined(S_IXGRP) && defined(S_IXOTH) + # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) + #endif + +diff --git a/posixstat.h b/posixstat.h +index 1111111..2222222 100644 +--- a/posixstat.h ++++ b/posixstat.h +@@ -78,30 +78,44 @@ + + #if defined (S_IFBLK) && !defined (S_ISBLK) + #define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK) /* block device */ ++#elif !defined (S_IFBLK) ++#define S_ISBLK(m) 0 + #endif + + #if defined (S_IFCHR) && !defined (S_ISCHR) + #define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR) /* character device */ ++#elif !defined (S_IFCHR) ++#define S_ISCHR(m) 0 + #endif + + #if defined (S_IFDIR) && !defined (S_ISDIR) + #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) /* directory */ ++#elif !defined (S_IFDIR) ++#define S_ISDIR(m) 0 + #endif + + #if defined (S_IFREG) && !defined (S_ISREG) + #define S_ISREG(m) (((m)&S_IFMT) == S_IFREG) /* file */ ++#elif !defined (S_IFREG) ++#define S_ISREG(m) 0 + #endif + + #if defined (S_IFIFO) && !defined (S_ISFIFO) + #define S_ISFIFO(m) (((m)&S_IFMT) == S_IFIFO) /* fifo - named pipe */ ++#elif !defined (S_IFIFO) ++#define S_ISFIFO(m) 0 + #endif + + #if defined (S_IFLNK) && !defined (S_ISLNK) + #define S_ISLNK(m) (((m)&S_IFMT) == S_IFLNK) /* symbolic link */ ++#elif !defined (S_IFLNK) ++#define S_ISLNK(m) 0 + #endif + + #if defined (S_IFSOCK) && !defined (S_ISSOCK) + #define S_ISSOCK(m) (((m)&S_IFMT) == S_IFSOCK) /* socket */ ++#elif !defined (S_IFSOCK) ++#define S_ISSOCK(m) 0 + #endif + + /* +@@ -137,6 +151,8 @@ + /* These are non-standard, but are used in builtins.c$symbolic_umask() */ + #define S_IRUGO (S_IRUSR | S_IRGRP | S_IROTH) + #define S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH) ++#if defined(S_IXUSR) && defined(S_IXGRP) && defined(S_IXOTH) + #define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) ++#endif + + #endif /* _POSIXSTAT_H_ */ + diff -r 457d4af76752 -r c1c5dd2cc2f2 src/readline-1-input.patch --- a/src/readline-1-input.patch Fri Mar 08 11:18:00 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -diff -uNr a/input.c b/input.c ---- a/input.c 2010-05-30 18:33:01.000000000 -0400 -+++ b/input.c 2013-04-17 23:50:34.759675631 -0400 -@@ -466,7 +466,12 @@ - - #if defined (__MINGW32__) - if (isatty (fileno (stream))) -- return (getch ()); -+ { -+ int c = _getch (); -+ if (c == 0xe0) -+ rl_execute_next (_getch ()); -+ return (c); -+ } - #endif - result = read (fileno (stream), &c, sizeof (unsigned char)); - diff -r 457d4af76752 -r c1c5dd2cc2f2 src/readline-1-paste.patch --- a/src/readline-1-paste.patch Fri Mar 08 11:18:00 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -diff -u a/input.c b/readline-6.2/input.c ---- a/input.c 2010-05-30 18:33:01.000000000 -0400 -+++ b/input.c 2012-06-25 21:08:42.000000000 -0400 -@@ -410,5 +412,5 @@ - rl_read_key () - { -- int c; -+ int c, r; - - rl_key_sequence_length++; -@@ -430,12 +432,16 @@ - while (rl_event_hook) - { -- if (rl_gather_tyi () < 0) /* XXX - EIO */ -+ if (rl_get_char (&c) != 0) -+ break; -+ -+ if ((r = rl_gather_tyi ()) < 0) /* XXX - EIO */ - { - rl_done = 1; - return ('\n'); - } -+ else if (r == 1) /* read something */ -+ continue; -+ - RL_CHECK_SIGNALS (); -- if (rl_get_char (&c) != 0) -- break; - if (rl_done) /* XXX - experimental */ - return ('\n'); diff -r 457d4af76752 -r c1c5dd2cc2f2 src/readline-1-sigwinch.patch --- a/src/readline-1-sigwinch.patch Fri Mar 08 11:18:00 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -diff -uNr a/readline.c b/readline.c ---- a/readline.c 2010-07-25 17:07:40.000000000 -0400 -+++ b/readline.c 2013-04-17 16:11:52.932653458 -0400 -@@ -970,6 +970,11 @@ - rl_initialized++; - RL_SETSTATE(RL_STATE_INITIALIZED); - } -+#if defined (__MINGW32__) -+ else -+ /* In case the console window has been resized outside of readline */ -+ rl_reset_screen_size (); -+#endif - - /* Initalize the current line information. */ - _rl_init_line_state (); -diff -uNr a/signals.c b/signals.c ---- a/signals.c 2011-02-11 10:53:33.000000000 -0500 -+++ b/signals.c 2013-04-17 16:07:57.476121748 -0400 -@@ -46,6 +46,11 @@ - - #include "rlprivate.h" - -+#if defined (__MINGW32__) -+# define WIN32_LEAN_AND_MEAN -+# include -+#endif -+ - #if defined (HANDLE_SIGNALS) - - #if !defined (RETSIGTYPE) -@@ -91,7 +96,7 @@ - int rl_catch_signals = 1; - - /* If non-zero, readline will install a signal handler for SIGWINCH. */ --#ifdef SIGWINCH -+#if defined (SIGWINCH) || defined (__MINGW32__) - int rl_catch_sigwinch = 1; - #else - int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */ -@@ -422,6 +427,21 @@ - } - #endif /* SIGWINCH */ - -+#if defined (__MINGW32__) -+ if (rl_catch_sigwinch && sigwinch_set_flag == 0) -+ { -+ DWORD mode; -+ HANDLE hStdIn = GetStdHandle (STD_INPUT_HANDLE); -+ -+ if (GetConsoleMode (hStdIn, &mode)) -+ { -+ mode |= ENABLE_WINDOW_INPUT; -+ if (SetConsoleMode (hStdIn, mode)) -+ sigwinch_set_flag = 1; -+ } -+ } -+#endif -+ - return 0; - } - -@@ -467,6 +487,21 @@ - } - #endif - -+#if defined (__MINGW32__) -+ if (rl_catch_sigwinch && sigwinch_set_flag == 1) -+ { -+ DWORD mode; -+ HANDLE hStdIn = GetStdHandle (STD_INPUT_HANDLE); -+ -+ if (GetConsoleMode (hStdIn, &mode)) -+ { -+ mode &= ~ENABLE_WINDOW_INPUT; -+ if (SetConsoleMode (hStdIn, mode)) -+ sigwinch_set_flag = 0; -+ } -+ } -+#endif -+ - return 0; - } - diff -r 457d4af76752 -r c1c5dd2cc2f2 src/readline-2-event-hook.patch --- a/src/readline-2-event-hook.patch Fri Mar 08 11:18:00 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +0,0 @@ -diff -ur readline-6.2-orig/input.c readline-6.2/input.c ---- readline-6.2-orig/input.c 2013-11-24 19:19:30 -0500 -+++ readline-6.2/input.c 2013-11-29 11:19:59 -0500 -@@ -54,6 +54,11 @@ - #include - #include - -+#if defined (__MINGW32__) -+# define WIN32_LEAN_AND_MEAN -+# include -+#endif -+ - #if !defined (errno) - extern int errno; - #endif /* !errno */ -@@ -96,6 +101,11 @@ - static unsigned char ibuffer[512]; - static int ibuffer_len = sizeof (ibuffer) - 1; - -+#if defined (__MINGW32__) -+static int _win32_getch (void); -+static int _win32_kbhit (void); -+#endif -+ - #define any_typein (push_index != pop_index) - - int -@@ -219,8 +229,8 @@ - #if defined (__MINGW32__) - /* Use getch/_kbhit to check for available console input, in the same way - that we read it normally. */ -- chars_avail = isatty (tty) ? _kbhit () : 0; -- result = 0; -+ chars_avail = isatty (tty) ? _win32_kbhit () : 0; -+ result = 0; - #endif - - /* If there's nothing available, don't waste time trying to read -@@ -457,6 +467,123 @@ - return (c); - } - -+#if defined (__MINGW32__) -+ -+#define _WIN32_READ_NOCHAR (-2) -+ -+static char _win32_buf[16] = {'0'}; -+static int _win32_bufidx = 0; -+ -+static int -+_win32_getch_internal (int block) -+{ -+ INPUT_RECORD rec; -+ DWORD evRead, waitResult; -+ HANDLE hInput = (HANDLE) _get_osfhandle (fileno (rl_instream)); -+ -+ if (_win32_bufidx > 0) -+ return _win32_buf[--_win32_bufidx]; -+ -+ hInput = (HANDLE) _get_osfhandle (fileno (rl_instream)); -+ -+ do -+ { -+ if (! block) -+ { -+ if (WaitForSingleObject(hInput, _keyboard_input_timeout/1000) != WAIT_OBJECT_0) -+ return _WIN32_READ_NOCHAR; -+ } -+ -+ if (!ReadConsoleInput(hInput, &rec, 1, &evRead) || evRead != 1) -+ return EOF; -+ -+ switch (rec.EventType) -+ { -+ case KEY_EVENT: -+ if ((rec.Event.KeyEvent.bKeyDown && -+ (rec.Event.KeyEvent.wVirtualKeyCode < VK_SHIFT || -+ rec.Event.KeyEvent.wVirtualKeyCode > VK_MENU)) || -+ (!rec.Event.KeyEvent.bKeyDown && -+ rec.Event.KeyEvent.wVirtualKeyCode == VK_MENU && -+ rec.Event.KeyEvent.uChar.AsciiChar)) -+ { -+ if (rec.Event.KeyEvent.uChar.AsciiChar) -+ { -+ if (rec.Event.KeyEvent.uChar.AsciiChar < 0 || -+ (rec.Event.KeyEvent.uChar.AsciiChar < 32 && -+ !(rec.Event.KeyEvent.dwControlKeyState & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)))) -+ { -+ char c = rec.Event.KeyEvent.uChar.AsciiChar; -+ if (GetOEMCP () == GetConsoleCP ()) -+ OemToCharBuff (&c, &c, 1); -+ return (int)(unsigned char)c; -+ } -+ else -+ return (int)rec.Event.KeyEvent.uChar.UnicodeChar; -+ } -+ else -+ switch (rec.Event.KeyEvent.wVirtualKeyCode) -+ { -+ case VK_UP: -+ _win32_buf[_win32_bufidx++] = 'H'; -+ return 0340; -+ case VK_DOWN: -+ _win32_buf[_win32_bufidx++] = 'P'; -+ return 0340; -+ case VK_RIGHT: -+ _win32_buf[_win32_bufidx++] = 'M'; -+ return 0340; -+ case VK_LEFT: -+ _win32_buf[_win32_bufidx++] = 'K'; -+ return 0340; -+ case VK_HOME: -+ _win32_buf[_win32_bufidx++] = 'G'; -+ return 0340; -+ case VK_END: -+ _win32_buf[_win32_bufidx++] = 'O'; -+ return 0340; -+ case VK_DELETE: -+ _win32_buf[_win32_bufidx++] = 'S'; -+ return 0340; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case WINDOW_BUFFER_SIZE_EVENT: -+ rl_resize_terminal (); -+ break; -+ -+ default: -+ break; -+ } -+ } -+ while (1); -+} -+ -+static int -+_win32_kbhit (void) -+{ -+ int result; -+ -+ result = _win32_getch_internal (0); -+ if (result == _WIN32_READ_NOCHAR -+ || result == EOF) -+ return 0; -+ _win32_buf[_win32_bufidx++] = result; -+ -+ return _win32_bufidx; -+} -+ -+static int -+_win32_getch (void) -+{ -+ return _win32_getch_internal (1); -+} -+ -+#endif -+ - int - rl_getc (stream) - FILE *stream; -@@ -471,9 +598,9 @@ - #if defined (__MINGW32__) - if (isatty (fileno (stream))) - { -- int c = _getch (); -+ int c = _win32_getch (); - if (c == 0xe0) -- rl_execute_next (_getch ()); -+ rl_execute_next (_win32_getch ()); - return (c); - } - #endif diff -r 457d4af76752 -r c1c5dd2cc2f2 src/readline.mk --- a/src/readline.mk Fri Mar 08 11:18:00 2019 -0500 +++ b/src/readline.mk Sat Mar 09 13:47:48 2019 +0100 @@ -3,14 +3,15 @@ PKG := readline $(PKG)_IGNORE := -$(PKG)_VERSION := 6.2 -$(PKG)_CHECKSUM := a9761cd9c3da485eb354175fcc2fe35856bc43ac +$(PKG)_VERSION := 8.0 +$(PKG)_CHECKSUM := d58041c2143595dc001d2777ae9a200be30198b0 $(PKG)_SUBDIR := readline-$($(PKG)_VERSION) $(PKG)_FILE := readline-$($(PKG)_VERSION).tar.gz $(PKG)_URL := http://ftp.gnu.org/gnu/readline/$($(PKG)_FILE) ifeq ($(MXE_SYSTEM),mingw) $(PKG)_TERMCAP_LIB := termcap + $(PKG)_CONFIGURE_OPTIONS := --without-curses else $(PKG)_TERMCAP_LIB := ncurses ifeq ($(MXE_NATIVE_BUILD),yes) @@ -35,7 +36,8 @@ -e 's/@@LIBRARY_SUFFIX@@/$(LIBRARY_SUFFIX)/g' $$f; \ done; \ fi - cd '$(1)' && ./configure \ + cd '$(1)' && bash_cv_wcwidth_broken=no \ + ./configure \ $(CONFIGURE_CPPFLAGS) $(CONFIGURE_LDFLAGS) \ $(HOST_AND_BUILD_CONFIGURE_OPTIONS) \ $(ENABLE_SHARED_OR_STATIC) \