Skip to content

Instantly share code, notes, and snippets.

@mislav

mislav/readline.patch Secret

Created Mar 18, 2014
Embed
What would you like to do?
Readline patch ported from Ruby trunk to help 2.1.1 compile on Arch linux
Index: ext/readline/readline.c
===================================================================
--- ext/readline/readline.c (revision 45224)
+++ ext/readline/readline.c (revision 45225)
@@ -1974,7 +1974,7 @@
rl_attempted_completion_function = readline_attempted_completion_function;
#if defined(HAVE_RL_PRE_INPUT_HOOK)
- rl_pre_input_hook = (Function *)readline_pre_input_hook;
+ rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;
#endif
#ifdef HAVE_RL_CATCH_SIGNALS
rl_catch_signals = 0;
Index: ext/readline/extconf.rb
===================================================================
--- ext/readline/extconf.rb (revision 45239)
+++ ext/readline/extconf.rb (revision 45240)
@@ -19,6 +19,10 @@
return super(func, headers)
end
+def readline.have_type(type)
+ return super(type, headers)
+end
+
dir_config('curses')
dir_config('ncurses')
dir_config('termcap')
@@ -94,4 +98,8 @@
readline.have_func("rl_redisplay")
readline.have_func("rl_insert_text")
readline.have_func("rl_delete_text")
+unless readline.have_type("rl_hook_func_t")
+ $DEFS << "-Drl_hook_func_t=Function"
+end
+
create_makefile("readline")
Index: ext/readline/extconf.rb
===================================================================
--- ext/readline/extconf.rb (revision 45242)
+++ ext/readline/extconf.rb (revision 45243)
@@ -99,6 +99,9 @@
readline.have_func("rl_insert_text")
readline.have_func("rl_delete_text")
unless readline.have_type("rl_hook_func_t")
+ # rl_hook_func_t is available since readline-4.2 (2001).
+ # Function is removed at readline-6.3 (2014).
+ # However, editline (NetBSD 6.1.3, 2014) doesn't have rl_hook_func_t.
$DEFS << "-Drl_hook_func_t=Function"
end
@vjoel

This comment has been minimized.

Copy link

@vjoel vjoel commented Apr 20, 2014

The last hunk causes the patch to fail for me. Deleting that hunk, the patch succeeds, and the build succeeds, and the readline extension works (ruby 2.1.1, ubuntu 14.04). YMMV.

Anyway, the last hunk is just a comment added to the second hunk.

@riocampos

This comment has been minimized.

Copy link

@riocampos riocampos commented Apr 24, 2014

thanks!
and I make same patch for Ruby 2.0.0-p451.
https://gist.github.com/riocampos/b2669b26016207224f06

@b-long

This comment has been minimized.

Copy link

@b-long b-long commented Jan 7, 2016

@mislav Since this patch is known to help those of us on Ubuntu (see rbenv/ruby-build#526 ), perhaps the title should be changed to include more than Arch ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment