Control: retitle 734330 Please provide ruby scripting again
Control: severity 734330 wishlist
I'm attaching an incomplete patch, which may be used to resurrect
Ruby scripting in the future.
--
,''`. Christian Hofstaedtler <[email protected]>
: :' : Debian Developer
`. `' 7D1A CFFA D9E0 806C 9C4C D392 5C13 D6DB 9305 2E03
`-
Index: gnoemoe-2.2.0+dfsg/configure
===================================================================
--- gnoemoe-2.2.0+dfsg.orig/configure 2014-01-15 11:56:15.000000000 +0100
+++ gnoemoe-2.2.0+dfsg/configure 2014-01-15 11:56:15.000000000 +0100
@@ -24600,82 +24600,12 @@ fi
#----------------------------------------------------------------
if test "_$rubyen" = "_yes"; then
- RUBYBIN=
-# Check whether --with-ruby was given.
-if test "${with_ruby+set}" = set; then
- withval=$with_ruby; RUBYBIN="$withval"
-else
- RUBYBIN=
-fi
-
-
- # First figure out what the name of Ruby is
-
- if test -z "$RUBYBIN"; then
- for ac_prog in ruby
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_RUBY+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$RUBY"; then
- ac_cv_prog_RUBY="$RUBY" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_RUBY="$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-RUBY=$ac_cv_prog_RUBY
-if test -n "$RUBY"; then
- { echo "$as_me:$LINENO: result: $RUBY" >&5
-echo "${ECHO_T}$RUBY" >&6; }
-else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
- test -n "$RUBY" && break
-done
-
- else
- RUBY="$RUBYBIN"
- fi
-
{ echo "$as_me:$LINENO: checking for Ruby header files" >&5
echo $ECHO_N "checking for Ruby header files... $ECHO_C" >&6; }
- if test -n "$RUBY"; then
- RUBYDIR=`($RUBY -rmkmf -e 'print Config::CONFIG["archdir"] || $archdir') 2>/dev/null`
- if test "$RUBYDIR" != ""; then
- dirs="$RUBYDIR"
- RUBY_CFLAGS=none
- for i in $dirs; do
- if test -r $i/ruby.h; then
- { echo "$as_me:$LINENO: result: $i" >&5
-echo "${ECHO_T}$i" >&6; }
- RUBY_CFLAGS="-idirafter $i"
- break;
- fi
- done
- if test "$RUBY_CFLAGS" = none; then
+ RUBY_CFLAGS=`pkg-config --cflags ruby-2.0`
+ if test "$RUBY_CFLAGS" = ""; then
{ echo "$as_me:$LINENO: result: could not locate ruby.h" >&5
echo "${ECHO_T}could not locate ruby.h" >&6; }
rubymsg="(no headers found, install ruby-dev)"
@@ -24685,54 +24615,17 @@ echo "${ECHO_T}could not locate ruby.h"
# Find library and path for linking.
{ echo "$as_me:$LINENO: checking for Ruby library" >&5
echo $ECHO_N "checking for Ruby library... $ECHO_C" >&6; }
- RUBYLIB=""
- rb_libdir=`($RUBY -rrbconfig -e 'print Config::CONFIG["libdir"]') 2>/dev/null`
- rb_bindir=`($RUBY -rrbconfig -e 'print Config::CONFIG["bindir"]') 2>/dev/null`
- dirs="$dirs $rb_libdir $rb_bindir"
-
- rb_libruby=`($RUBY -rrbconfig -e 'print Config::CONFIG["LIBRUBY_A"]') 2>/dev/null`
- RUBY_LIBS=`($RUBY -rrbconfig -e '
- c = Config::CONFIG
- if c.has_key? "LIBRUBYARG_STATIC" # 1.8.x
- if c["LIBRUBY"] == c["LIBRUBY_A"]
- link = c["LIBRUBYARG_STATIC"]
- else
- link = c["LIBRUBYARG_SHARED"]
- end
- else # 1.6.x
- link = "-l" + c["RUBY_INSTALL_NAME"]
- end
- puts link') 2>/dev/null`
-
- if test "$rb_libruby" != ""; then
- for i in $dirs; do
- if (test -r $i/$rb_libruby;) then
- RUBYLIB="$i"
- break;
- fi
- done
- fi
- if test "$RUBYLIB" = ""; then
+ RUBY_LIBS=`pkg-config --libs ruby-2.0`
+ if test "$RUBY_LIBS" = ""; then
{ echo "$as_me:$LINENO: result: not found... disabling ruby support" >&5
echo "${ECHO_T}not found... disabling ruby support" >&6; }
rubymsg="(libs not found)"
rubyen="no"
else
- { echo "$as_me:$LINENO: result: $RUBY_LIBS in $RUBYLIB" >&5
-echo "${ECHO_T}$RUBY_LIBS in $RUBYLIB" >&6; }
+ { echo "$as_me:$LINENO: result: $RUBY_LIBS" >&5
+echo "${ECHO_T}$RUBY_LIBS" >&6; }
fi
- else
- { echo "$as_me:$LINENO: result: unable to determine ruby configuration" >&5
-echo "${ECHO_T}unable to determine ruby configuration" >&6; }
- rubymsg="(unable to determine configuration)"
- rubyen="no"
- fi
- else
- { echo "$as_me:$LINENO: result: not found.. disabling ruby support" >&5
-echo "${ECHO_T}not found.. disabling ruby support" >&6; }
- rubymsg="(no headers found, install ruby-dev)"
- rubyen="no"
- fi
+
fi
if test "_$rubyen" == "_no"; then
Index: gnoemoe-2.2.0+dfsg/gnoemoe/gm-scripts.c
===================================================================
--- gnoemoe-2.2.0+dfsg.orig/gnoemoe/gm-scripts.c 2014-01-15 11:56:15.000000000 +0100
+++ gnoemoe-2.2.0+dfsg/gnoemoe/gm-scripts.c 2014-01-15 12:05:10.593903907 +0100
@@ -322,9 +322,9 @@ gm_scripts_rb_error(GmScripts *scripts)
gchar *msg;
VALUE ary;
- if(!NIL_P(ruby_errinfo)) {
+ if(!NIL_P(rb_errinfo())) {
lasterr = rb_gv_get("$!");
- err = RSTRING(rb_obj_as_string(lasterr))->ptr;
+ err = RSTRING_PTR(rb_obj_as_string(lasterr));
gm_debug_msg(DEBUG_DEFAULT, "GmScripts.Error: Error while executing Ruby code: %s",
err);
@@ -333,17 +333,17 @@ gm_scripts_rb_error(GmScripts *scripts)
g_signal_emit(scripts, gm_scripts_signals[MESSAGE], 0, msg);
g_free(msg);
- ary = rb_funcall(ruby_errinfo, rb_intern("backtrace"), 0);
+ ary = rb_funcall(rb_errinfo(), rb_intern("backtrace"), 0);
gm_debug_msg(DEBUG_DEFAULT, "GmScripts.Error: Ruby backtrace:");
g_signal_emit(scripts, gm_scripts_signals[ERROR], 0,
_("Ruby backtrace:"));
- for (c = 0; c < RARRAY(ary)->len; c++) {
+ for (c = 0; c < RARRAY_LEN(ary); c++) {
gm_debug_msg(DEBUG_DEFAULT, "GmScripts.Error: \tfrom %s",
- RSTRING(RARRAY(ary)->ptr[c])->ptr);
+ RSTRING_PTR(rb_ary_entry(ary, c)));
msg = g_strdup_printf(_("\tfrom %s"),
- RSTRING(RARRAY(ary)->ptr[c])->ptr);
+ RSTRING_PTR(rb_ary_entry(ary, c)));
g_signal_emit(scripts, gm_scripts_signals[ERROR], 0, msg);
g_free(msg);
}