Apply patch readline62-002.

From http://ftp.gnu.org/gnu/readline/readline-6.2-patches/readline62-002:

                           READLINE PATCH REPORT
                           =====================

Readline-Release: 6.2
Patch-ID: readline62-002

Bug-Reported-by:        Vincent Sheffer <vince.sheffer@apisphere.com>
Bug-Reference-ID:       <F13C1C4F-C44C-4071-BFED-4BB6D13CF92F@apisphere.com>
Bug-Reference-URL:      https://lists.gnu.org/archive/html/bug-readline/2011-08/msg00000.html

Bug-Description:

The readline shared library helper script needs to be updated for Mac OS X
10.7 (Lion, darwin11).

Patch (apply with `patch -p0'):

*** ../readline-6.2-patched/support/shobj-conf  2009-10-28 09:20:21.000000000 -0400
--- support/shobj-conf  2011-08-27 13:25:23.000000000 -0400
***************
*** 158,162 ****

  # Darwin/MacOS X
! darwin[89]*|darwin10*)
        SHOBJ_STATUS=supported
        SHLIB_STATUS=supported
--- 172,176 ----

  # Darwin/MacOS X
! darwin[89]*|darwin1[012]*)
        SHOBJ_STATUS=supported
        SHLIB_STATUS=supported
***************
*** 187,191 ****

        case "${host_os}" in
!       darwin[789]*|darwin10*) SHOBJ_LDFLAGS=''
                        SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
                        ;;
--- 201,205 ----

        case "${host_os}" in
!       darwin[789]*|darwin1[012]*)     SHOBJ_LDFLAGS=''
                        SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
                        ;;

*** ../readline-6.2-patched/patchlevel  2010-01-14 10:15:52.000000000 -0500
--- patchlevel  2011-11-17 11:09:35.000000000 -0500
***************
*** 1,3 ****
  # Do not edit -- exists only for use by patch

! 1
--- 1,3 ----
  # Do not edit -- exists only for use by patch

! 2
Apply patch readline62-003.

From http://ftp.gnu.org/gnu/readline/readline-6.2-patches/readline62-003:

                           READLINE PATCH REPORT
                           =====================

Readline-Release: 6.2
Patch-ID: readline62-003

Bug-Reported-by:        Max Horn <max@quendi.de>
Bug-Reference-ID:       <20CC5C60-07C3-4E41-9817-741E48D407C5@quendi.de>
Bug-Reference-URL:      http://lists.gnu.org/archive/html/bug-readline/2012-06/msg00005.html

Bug-Description:

A change between readline-6.1 and readline-6.2 to prevent the readline input
hook from being called too frequently had the side effect of causing delays
when reading pasted input on systems such as Mac OS X.  This patch fixes
those delays while retaining the readline-6.2 behavior.

Patch (apply with `patch -p0'):

*** ../readline-6.2-patched/input.c     2010-05-30 18:33:01.000000000 -0400
--- input.c     2012-06-25 21:08:42.000000000 -0400
***************
*** 410,414 ****
  rl_read_key ()
  {
!   int c;

    rl_key_sequence_length++;
--- 412,416 ----
  rl_read_key ()
  {
!   int c, r;

    rl_key_sequence_length++;
***************
*** 430,441 ****
          while (rl_event_hook)
            {
!             if (rl_gather_tyi () < 0) /* XXX - EIO */
                {
                  rl_done = 1;
                  return ('\n');
                }
              RL_CHECK_SIGNALS ();
-             if (rl_get_char (&c) != 0)
-               break;
              if (rl_done)              /* XXX - experimental */
                return ('\n');
--- 432,447 ----
          while (rl_event_hook)
            {
!             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_done)              /* XXX - experimental */
                return ('\n');
*** ../readline-6.2-patched/patchlevel  2010-01-14 10:15:52.000000000 -0500
--- patchlevel  2011-11-17 11:09:35.000000000 -0500
***************
*** 1,3 ****
  # Do not edit -- exists only for use by patch

! 2
--- 1,3 ----
  # Do not edit -- exists only for use by patch

! 3
Applying patch readline62-004.

From http://ftp.gnu.org/gnu/readline/readline-6.2-patches/readline62-004:

                           READLINE PATCH REPORT
                           =====================

Readline-Release: 6.2
Patch-ID: readline62-004

Bug-Reported-by:        Jakub Filak
Bug-Reference-ID:
Bug-Reference-URL:      https://bugzilla.redhat.com/show_bug.cgi?id=813289

Bug-Description:

Attempting to redo (using `.') the vi editing mode `cc', `dd', or `yy'
commands leads to an infinite loop.

Patch (apply with `patch -p0'):

*** ../readline-6.2-patched/vi_mode.c   2011-02-25 11:17:02.000000000 -0500
--- vi_mode.c   2012-06-02 12:24:47.000000000 -0400
***************
*** 1235,1243 ****
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
!   else if (vi_redoing)
      {
        _rl_vimvcxt->motion = _rl_vi_last_motion;
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
  #if defined (READLINE_CALLBACKS)
    else if (RL_ISSTATE (RL_STATE_CALLBACK))
--- 1297,1313 ----
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
!   else if (vi_redoing && _rl_vi_last_motion != 'd')   /* `dd' is special */
      {
        _rl_vimvcxt->motion = _rl_vi_last_motion;
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
+   else if (vi_redoing)                /* handle redoing `dd' here */
+     {
+       _rl_vimvcxt->motion = _rl_vi_last_motion;
+       rl_mark = rl_end;
+       rl_beg_of_line (1, key);
+       RL_UNSETSTATE (RL_STATE_VIMOTION);
+       r = vidomove_dispatch (_rl_vimvcxt);
+     }
  #if defined (READLINE_CALLBACKS)
    else if (RL_ISSTATE (RL_STATE_CALLBACK))
***************
*** 1317,1325 ****
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
!   else if (vi_redoing)
      {
        _rl_vimvcxt->motion = _rl_vi_last_motion;
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
  #if defined (READLINE_CALLBACKS)
    else if (RL_ISSTATE (RL_STATE_CALLBACK))
--- 1387,1403 ----
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
!   else if (vi_redoing && _rl_vi_last_motion != 'c')   /* `cc' is special */
      {
        _rl_vimvcxt->motion = _rl_vi_last_motion;
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
+   else if (vi_redoing)                /* handle redoing `cc' here */
+     {
+       _rl_vimvcxt->motion = _rl_vi_last_motion;
+       rl_mark = rl_end;
+       rl_beg_of_line (1, key);
+       RL_UNSETSTATE (RL_STATE_VIMOTION);
+       r = vidomove_dispatch (_rl_vimvcxt);
+     }
  #if defined (READLINE_CALLBACKS)
    else if (RL_ISSTATE (RL_STATE_CALLBACK))
***************
*** 1378,1381 ****
--- 1456,1472 ----
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
+   else if (vi_redoing && _rl_vi_last_motion != 'y')   /* `yy' is special */
+     {
+       _rl_vimvcxt->motion = _rl_vi_last_motion;
+       r = rl_domove_motion_callback (_rl_vimvcxt);
+     }
+   else if (vi_redoing)                        /* handle redoing `yy' here */
+     {
+       _rl_vimvcxt->motion = _rl_vi_last_motion;
+       rl_mark = rl_end;
+       rl_beg_of_line (1, key);
+       RL_UNSETSTATE (RL_STATE_VIMOTION);
+       r = vidomove_dispatch (_rl_vimvcxt);
+     }
  #if defined (READLINE_CALLBACKS)
    else if (RL_ISSTATE (RL_STATE_CALLBACK))
*** ../readline-6.2-patched/patchlevel  2010-01-14 10:15:52.000000000 -0500
--- patchlevel  2011-11-17 11:09:35.000000000 -0500
***************
*** 1,3 ****
  # Do not edit -- exists only for use by patch

! 3
--- 1,3 ----
  # Do not edit -- exists only for use by patch

! 4
Apply patch readline62-005.

(Note: patch below did not apply cleanly.)

From http://ftp.gnu.org/gnu/readline/readline-6.2-patches/readline62-005:

                           READLINE PATCH REPORT
                           =====================

Readline-Release: 6.2
Patch-ID: readline62-005

Bug-Reported-by:        ludwig.schwardt@gmail.com
Bug-Reference-ID:       <CAJ3RG108NLnrWxj81vb4BcqbvOHGuwOVKtHekwprBWE9xyefww@mail.gmail.com>
Bug-Reference-URL:      https://lists.gnu.org/archive/html/bug-readline/2013-11/msg00000.html

Bug-Description:

The readline shared library helper script needs to be updated for Mac OS X
10.9 (Mavericks, darwin13).

Patch (apply with `patch -p0'):

*** ../readline-6.2-patched/support/shobj-conf  2011-11-23 19:26:47.000000000 -0500
--- support/shobj-conf  2013-11-15 08:09:51.000000000 -0500
***************
*** 158,162 ****

  # Darwin/MacOS X
! darwin[89]*|darwin1[012]*)
        SHOBJ_STATUS=supported
        SHLIB_STATUS=supported
--- 172,176 ----

  # Darwin/MacOS X
! darwin[89]*|darwin1[0123]*)
        SHOBJ_STATUS=supported
        SHLIB_STATUS=supported
***************
*** 164,168 ****
        SHOBJ_CFLAGS='-fno-common'

!       SHOBJ_LD='MACOSX_DEPLOYMENT_TARGET=10.3 ${CC}'

        SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
--- 178,184 ----
        SHOBJ_CFLAGS='-fno-common'

! #     SHOBJ_LD='MACOSX_DEPLOYMENT_TARGET=10.3 ${CC}'
!       # we can finally kill Mac OS X 10.3
!       SHOBJ_LD='${CC}'

        SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
***************
*** 187,191 ****

        case "${host_os}" in
!       darwin[789]*|darwin1[012]*)     SHOBJ_LDFLAGS=''
                        SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
                        ;;
--- 203,207 ----

        case "${host_os}" in
!       darwin[789]*|darwin1[0123]*)    SHOBJ_LDFLAGS=''
                        SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
                        ;;

*** ../readline-6.2-patched/patchlevel  2010-01-14 10:15:52.000000000 -0500
--- patchlevel  2011-11-17 11:09:35.000000000 -0500
***************
*** 1,3 ****
  # Do not edit -- exists only for use by patch

! 4
--- 1,3 ----
  # Do not edit -- exists only for use by patch

! 5