aboutsummaryrefslogtreecommitdiffstats
path: root/textproc
diff options
context:
space:
mode:
authordinoex <dinoex@FreeBSD.org>2009-07-12 22:36:01 +0800
committerdinoex <dinoex@FreeBSD.org>2009-07-12 22:36:01 +0800
commit5da1a3e23d025e5d5a20c15a8e1bdcb865d2397e (patch)
tree32986a7d806cb1d39697813691a5419f4c49c5e4 /textproc
parentd9ac6a4f69526a4d7ae3954d445c2587a558caee (diff)
downloadfreebsd-ports-gnome-5da1a3e23d025e5d5a20c15a8e1bdcb865d2397e.tar.gz
freebsd-ports-gnome-5da1a3e23d025e5d5a20c15a8e1bdcb865d2397e.tar.zst
freebsd-ports-gnome-5da1a3e23d025e5d5a20c15a8e1bdcb865d2397e.zip
- make configure work with ruby19
- set PKGNAMEPREFIX - ugly fix for threads with ruby-1.8.7.160 - replace obsolteted funtions, experimental build with ruby19
Diffstat (limited to 'textproc')
-rw-r--r--textproc/eruby/Makefile17
-rw-r--r--textproc/eruby/files/patch-Makefile.in17
-rw-r--r--textproc/eruby/files/patch-configure.rb93
-rw-r--r--textproc/eruby/files/patch-eruby.h11
-rw-r--r--textproc/eruby/files/patch-eruby_lib.c95
-rw-r--r--textproc/eruby/files/patch-eruby_main.c253
6 files changed, 480 insertions, 6 deletions
diff --git a/textproc/eruby/Makefile b/textproc/eruby/Makefile
index 49d55fbdb02d..3ca15a5084d7 100644
--- a/textproc/eruby/Makefile
+++ b/textproc/eruby/Makefile
@@ -7,8 +7,10 @@
PORTNAME= eruby
PORTVERSION= 1.0.5
+PORTREVISION= 1
CATEGORIES= textproc www ruby
MASTER_SITES= http://www.modruby.net/archive/
+PKGNAMEPREFIX= ${RUBY_PKGNAMEPREFIX}
DIST_SUBDIR= ruby
MAINTAINER= dinoex@FreeBSD.org
@@ -16,8 +18,6 @@ COMMENT= Interprets Ruby code embedded in a text file like PHP/ePerl/ASP/JSP
USE_RUBY= yes
-BROKEN= does not compile
-
CONFIGURE_ARGS= --enable-shared --with-charset="${DEFAULT_CHARSET}"
INSTALL_TARGET= site-install
USE_LDCONFIG= yes
@@ -51,4 +51,15 @@ post-install:
.endfor
.endif
-.include <bsd.port.mk>
+.include <bsd.port.pre.mk>
+
+.if !defined(WITHOUT_PTHREADS)
+.if ${RUBY_VERSION} == 1.8.7.160
+# ruby18 -r rbconfig -e "p Config::CONFIG['LIBS']" should output:
+# "-lcrypt -lm -rpath=/usr/lib:/usr/local/lib -pthread"
+# but 1.8.7.160 missing pthread
+CONFIGURE_ENV+= EXTRA_LDFLAGS="${EXTRA_LDFLAGS} -pthread"
+.endif
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/textproc/eruby/files/patch-Makefile.in b/textproc/eruby/files/patch-Makefile.in
new file mode 100644
index 000000000000..d60952d16e06
--- /dev/null
+++ b/textproc/eruby/files/patch-Makefile.in
@@ -0,0 +1,17 @@
+--- Makefile.in.orig 2003-07-26 12:21:33.000000000 +0200
++++ Makefile.in 2009-06-21 17:14:51.000000000 +0200
+@@ -37,10 +37,10 @@
+ DLDFLAGS = @DLDFLAGS@
+ LDSHARED = @LDSHARED@
+ EXT_DLDFLAGS = @EXT_DLDFLAGS@
+-INSTALL_PROGRAM = $(RUBY) -r ftools -e 'File.install ARGV[0], ARGV[1], 0755, true'
+-INSTALL_DLLIB = $(RUBY) -r ftools -e 'File.install ARGV[0], ARGV[1], 0555, true'
+-INSTALL_DATA = $(RUBY) -r ftools -e 'File.install ARGV[0], ARGV[1], 0644, true'
+-INSTALL_DIR = $(RUBY) -r ftools -e 'File.makedirs(*ARGV)'
++INSTALL_PROGRAM = $(RUBY) -r fileutils -e 'FileUtils.install ARGV[0], ARGV[1], :mode => 0755, :verbose => true'
++INSTALL_DLLIB = $(RUBY) -r fileutils -e 'FileUtils.install ARGV[0], ARGV[1], :mode => 0555, :verbose => true'
++INSTALL_DATA = $(RUBY) -r fileutils -e 'FileUtils.install ARGV[0], ARGV[1], :mode => 0644, :verbose => true'
++INSTALL_DIR = $(RUBY) -r fileutils -e 'FileUtils.mkdir_p(*ARGV)'
+
+ RUBY_INSTALL_NAME = @RUBY_INSTALL_NAME@
+ LIBRUBYARG = @LIBRUBYARG@
diff --git a/textproc/eruby/files/patch-configure.rb b/textproc/eruby/files/patch-configure.rb
index 19eb9d262bd4..be945604fab5 100644
--- a/textproc/eruby/files/patch-configure.rb
+++ b/textproc/eruby/files/patch-configure.rb
@@ -1,6 +1,39 @@
---- configure.rb.orig 2009-02-14 00:50:10.000000000 +0300
-+++ configure.rb 2009-02-14 00:50:18.000000000 +0300
-@@ -307,6 +307,7 @@
+--- configure.rb.orig 2003-02-10 04:18:10.000000000 +0100
++++ configure.rb 2009-07-12 16:05:45.000000000 +0200
+@@ -59,7 +59,7 @@
+ end
+ end
+
+-require 'ftools'
++require 'fileutils'
+
+ def AC_OUTPUT(*files)
+ if $AC_LIST_HEADER
+@@ -71,7 +71,7 @@
+ for file in files
+ print "creating ", file, "\n"
+ open(File.join($srcdir, file + ".in")) do |fin|
+- File.makedirs(File.dirname(file))
++ FileUtils.mkdir_p(File.dirname(file))
+ open(file, "w") do |fout|
+ while line = fin.gets
+ line.gsub!(/@([A-Za-z_]+)@/) do |s|
+@@ -301,12 +301,22 @@
+ else
+ $CFLAGS = CFLAGS + " " + CONFIG["CCDLFLAGS"]
+ end
++if not CONFIG["rubyhdrdir"].nil?
++ $CFLAGS << " -I" + CONFIG["rubyhdrdir"] + "/" + $sitearch
++end
++if not ENV["EXTRA_CFLAGS"].nil?
++ $CFLAGS << " " + ENV["EXTRA_CFLAGS"]
++end
+ $LDFLAGS = CONFIG["LDFLAGS"]
++if not ENV["EXTRA_LDFLAGS"].nil?
++ $LDFLAGS << " " + ENV["EXTRA_LDFLAGS"]
++end
+ if $LDFLAGS.to_s.empty? && /mswin32/ =~ RUBY_PLATFORM
+ $LDFLAGS = "-link -incremental:no -pdb:none"
end
$LIBS = CONFIG["LIBS"]
$XLDFLAGS = CONFIG["XLDFLAGS"]
@@ -8,3 +41,57 @@
$XLDFLAGS.gsub!(/-L\./, "")
if /mswin32/ !~ RUBY_PLATFORM
$XLDFLAGS += " -L$(libdir)"
+@@ -333,7 +343,7 @@
+ $LIBRUBY_A = CONFIG["LIBRUBY_A"]
+ $RUBY_SO_NAME = CONFIG["RUBY_SO_NAME"]
+
+-case PLATFORM
++case RUBY_PLATFORM
+ when /-aix/
+ if $RUBY_SHARED
+ $LIBRUBYARG = "-Wl,$(libdir)/" + CONFIG["LIBRUBY_SO"]
+@@ -407,7 +417,7 @@
+ AC_MSG_CHECKING("whether we are using gcc")
+ if $CC == "gcc" || `#{$CC} -v 2>&1` =~ /gcc/
+ $using_gcc = true
+- $CFLAGS += " -Wall"
++ $CFLAGS += " -Wall -g"
+ else
+ $using_gcc = false
+ end
+@@ -431,7 +441,7 @@
+ $ENABLE_SHARED = false
+ AC_ENABLE("shared") { |enableval|
+ if enableval == "yes"
+- if PLATFORM =~ /-mswin32/
++ if RUBY_PLATFORM =~ /-mswin32/
+ AC_MSG_ERROR("can't enable shared on mswin32")
+ end
+ $ENABLE_SHARED = true
+@@ -449,7 +459,7 @@
+ if $ENABLE_SHARED
+ $LIBERUBY = "${LIBERUBY_SO}"
+ $LIBERUBYARG = "-L. -leruby"
+- case PLATFORM
++ case RUBY_PLATFORM
+ when /-sunos4/
+ $LIBERUBY_ALIASES = "liberuby.so.$(MAJOR).$(MINOR) liberuby.so"
+ when /-linux/
+@@ -457,7 +467,7 @@
+ $LIBERUBY_ALIASES = "liberuby.so.$(MAJOR).$(MINOR) liberuby.so"
+ when /-(freebsd|netbsd)/
+ $LIBERUBY_SO = "liberuby.so.$(MAJOR).$(MINOR)"
+- if PLATFORM =~ /elf/ || PLATFORM =~ /-freebsd[3-9]/
++ if RUBY_PLATFORM =~ /elf/ || RUBY_PLATFORM =~ /-freebsd[3-9]/
+ $LIBERUBY_SO = "liberuby.so.$(MAJOR_MINOR)"
+ $LIBERUBY_ALIASES = "liberuby.so"
+ else
+@@ -493,7 +503,7 @@
+ end
+ end
+
+-if PLATFORM =~ /-mswin32/
++if RUBY_PLATFORM =~ /-mswin32/
+ $AR = "lib"
+ $AROPT = "/out:$@"
+ $LIBERUBY_A = "liberuby.lib"
diff --git a/textproc/eruby/files/patch-eruby.h b/textproc/eruby/files/patch-eruby.h
new file mode 100644
index 000000000000..e5343cfc1505
--- /dev/null
+++ b/textproc/eruby/files/patch-eruby.h
@@ -0,0 +1,11 @@
+--- eruby.h.orig 2003-12-23 16:11:54.000000000 +0100
++++ eruby.h 2009-06-21 19:15:36.000000000 +0200
+@@ -30,7 +30,7 @@
+ extern int eruby_noheader;
+ extern VALUE eruby_charset;
+ extern VALUE eruby_default_charset;
+-#define ERUBY_CHARSET RSTRING(eruby_charset)->ptr
++#define ERUBY_CHARSET RSTRING_PTR(eruby_charset)
+
+ const char *eruby_version();
+ int eruby_parse_options(int argc, char **argv, int *optind);
diff --git a/textproc/eruby/files/patch-eruby_lib.c b/textproc/eruby/files/patch-eruby_lib.c
new file mode 100644
index 000000000000..1a37eeed050b
--- /dev/null
+++ b/textproc/eruby/files/patch-eruby_lib.c
@@ -0,0 +1,95 @@
+--- eruby_lib.c.orig 2003-07-29 05:42:56.000000000 +0200
++++ eruby_lib.c 2009-06-30 12:42:12.000000000 +0200
+@@ -34,10 +34,18 @@
+ #include <signal.h>
+
+ #include "ruby.h"
+-#include "regex.h"
+ #include "eruby.h"
+ #include "config.h"
+
++#if defined(RFLOAT_VALUE)
++#include "ruby/regex.h"
++#undef ismbchar
++#define ismbchar(c,e,enc) ((mbclen(c,e,enc)) != 1)
++#define ruby_top_self rb_vm_top_self
++#else
++#include "regex.h"
++#endif
++
+ EXTERN VALUE rb_stdin;
+ EXTERN VALUE ruby_top_self;
+
+@@ -133,6 +141,7 @@
+ }
+ s++;
+ goto again;
++#if !defined(RFLOAT_VALUE)
+ case 'K':
+ s++;
+ if (*s == '\0') {
+@@ -142,6 +151,7 @@
+ rb_set_kcode(s);
+ s++;
+ goto again;
++#endif
+ case 'C':
+ s++;
+ if (isspace(*s)) s++;
+@@ -296,18 +306,18 @@
+ VALUE s = compiler->lex_input;
+ char *beg, *end, *pend;
+
+- if (RSTRING(s)->len == compiler->lex_gets_ptr)
++ if (RSTRING_LEN(s) == compiler->lex_gets_ptr)
+ return Qnil;
+- beg = RSTRING(s)->ptr;
++ beg = RSTRING_PTR(s);
+ if (compiler->lex_gets_ptr > 0) {
+ beg += compiler->lex_gets_ptr;
+ }
+- pend = RSTRING(s)->ptr + RSTRING(s)->len;
++ pend = RSTRING_PTR(s) + RSTRING_LEN(s);
+ end = beg;
+ while (end < pend) {
+ if (*end++ == '\n') break;
+ }
+- compiler->lex_gets_ptr = end - RSTRING(s)->ptr;
++ compiler->lex_gets_ptr = end - RSTRING_PTR(s);
+ return rb_str_new(beg, end - beg);
+ }
+
+@@ -326,8 +336,8 @@
+
+ if (NIL_P(v)) return EOF;
+ compiler->sourceline++;
+- compiler->lex_pbeg = compiler->lex_p = RSTRING(v)->ptr;
+- compiler->lex_pend = compiler->lex_p + RSTRING(v)->len;
++ compiler->lex_pbeg = compiler->lex_p = RSTRING_PTR(v);
++ compiler->lex_pend = compiler->lex_p + RSTRING_LEN(v);
+ compiler->lex_lastline = v;
+ }
+ else {
+@@ -471,7 +481,7 @@
+ if (c == '!') {
+ unsigned char *p;
+ char *argv[2];
+- char *line = RSTRING(compiler->lex_lastline)->ptr;
++ char *line = RSTRING_PTR(compiler->lex_lastline);
+
+ if (line[strlen(line) - 1] == '\n') {
+ line[strlen(line) - 1] = '\0';
+@@ -577,8 +587,13 @@
+ if (prevc < 0) output_literal(compiler, "print \"");
+ output_char(compiler, c);
+ prevc = c;
++#if defined(RFLOAT_VALUE)
++ if (ismbchar(c,c+4,OnigEncDefaultCharEncoding)) {
++ int i, len = mbclen(c,c,OnigEncDefaultCharEncoding) - 1;
++#else
+ if (ismbchar(c)) {
+ int i, len = mbclen(c) - 1;
++#endif
+
+ for (i = 0; i < len; i++) {
+ c = nextc(compiler);
diff --git a/textproc/eruby/files/patch-eruby_main.c b/textproc/eruby/files/patch-eruby_main.c
new file mode 100644
index 000000000000..3b080d247eac
--- /dev/null
+++ b/textproc/eruby/files/patch-eruby_main.c
@@ -0,0 +1,253 @@
+--- eruby_main.c.orig 2003-12-23 16:10:54.000000000 +0100
++++ eruby_main.c 2009-06-30 12:45:54.000000000 +0200
+@@ -29,14 +29,27 @@
+ #endif
+
+ #include "ruby.h"
++#if defined(RFLOAT_VALUE)
++#define RUBY_VERSION_CODE 190
++#endif
++#if RUBY_VERSION_CODE < 190
+ #include "re.h"
++#endif
+ #include "regex.h"
++#if RUBY_VERSION_CODE < 190
+ #include "version.h"
++#endif
+
+ #include "eruby.h"
+ #include "eruby_logo.h"
+
++#if RUBY_VERSION_CODE < 190
+ EXTERN VALUE ruby_errinfo;
++static VALUE rb_errinfo(void)
++{
++ return ruby_errinfo;
++}
++#endif
+ EXTERN VALUE rb_stdout;
+ #if RUBY_VERSION_CODE < 180
+ EXTERN VALUE rb_defout;
+@@ -92,15 +105,23 @@
+ static void error_pos(FILE *out, int cgi)
+ {
+ char buff[BUFSIZ];
++#if RUBY_VERSION_CODE >= 190
++ const char *sourcefile = rb_sourcefile();
++ int sourceline = rb_sourceline();
++ ID last_func = rb_frame_callee();
++#else
++ const char *sourcefile = ruby_sourcefile;
++ int sourceline = ruby_sourceline;
+ ID last_func = rb_frame_last_func();
++#endif
+
+- if (ruby_sourcefile) {
++ if (sourcefile) {
+ if (last_func) {
+- snprintf(buff, BUFSIZ, "%s:%d:in `%s'", ruby_sourcefile, ruby_sourceline,
++ snprintf(buff, BUFSIZ, "%s:%d:in `%s'", sourcefile, sourceline,
+ rb_id2name(last_func));
+ }
+ else {
+- snprintf(buff, BUFSIZ, "%s:%d", ruby_sourcefile, ruby_sourceline);
++ snprintf(buff, BUFSIZ, "%s:%d", sourcefile, sourceline);
+ }
+ if (cgi)
+ write_escaping_html(out, buff, strlen(buff));
+@@ -115,38 +136,38 @@
+ VALUE eclass;
+ VALUE einfo;
+
+- if (NIL_P(ruby_errinfo)) return;
++ if (NIL_P(rb_errinfo())) return;
+
+- errat = rb_funcall(ruby_errinfo, rb_intern("backtrace"), 0);
++ errat = rb_funcall(rb_errinfo(), rb_intern("backtrace"), 0);
+ if (!NIL_P(errat)) {
+- VALUE mesg = RARRAY(errat)->ptr[0];
++ VALUE mesg = RARRAY_PTR(errat)[0];
+
+ if (NIL_P(mesg)) {
+ error_pos(out, cgi);
+ }
+ else {
+ if (cgi)
+- write_escaping_html(out, RSTRING(mesg)->ptr, RSTRING(mesg)->len);
++ write_escaping_html(out, RSTRING_PTR(mesg), RSTRING_LEN(mesg));
+ else
+- fwrite(RSTRING(mesg)->ptr, 1, RSTRING(mesg)->len, out);
++ fwrite(RSTRING_PTR(mesg), 1, RSTRING_LEN(mesg), out);
+ }
+ }
+
+- eclass = CLASS_OF(ruby_errinfo);
+- einfo = rb_obj_as_string(ruby_errinfo);
+- if (eclass == rb_eRuntimeError && RSTRING(einfo)->len == 0) {
++ eclass = CLASS_OF(rb_errinfo());
++ einfo = rb_obj_as_string(rb_errinfo());
++ if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) {
+ fprintf(out, ": unhandled exception\n");
+ }
+ else {
+ VALUE epath;
+
+ epath = rb_class_path(eclass);
+- if (RSTRING(einfo)->len == 0) {
++ if (RSTRING_LEN(einfo) == 0) {
+ fprintf(out, ": ");
+ if (cgi)
+- write_escaping_html(out, RSTRING(epath)->ptr, RSTRING(epath)->len);
++ write_escaping_html(out, RSTRING_PTR(epath), RSTRING_LEN(epath));
+ else
+- fwrite(RSTRING(epath)->ptr, 1, RSTRING(epath)->len, out);
++ fwrite(RSTRING_PTR(epath), 1, RSTRING_LEN(epath), out);
+ if (cgi)
+ fprintf(out, "<br>\n");
+ else
+@@ -154,24 +175,24 @@
+ }
+ else {
+ char *tail = 0;
+- int len = RSTRING(einfo)->len;
++ int len = RSTRING_LEN(einfo);
+
+- if (RSTRING(epath)->ptr[0] == '#') epath = 0;
+- if ((tail = strchr(RSTRING(einfo)->ptr, '\n')) != NULL) {
+- len = tail - RSTRING(einfo)->ptr;
++ if (RSTRING_PTR(epath)[0] == '#') epath = 0;
++ if ((tail = strchr(RSTRING_PTR(einfo), '\n')) != NULL) {
++ len = tail - RSTRING_PTR(einfo);
+ tail++; /* skip newline */
+ }
+ fprintf(out, ": ");
+ if (cgi)
+- write_escaping_html(out, RSTRING(einfo)->ptr, len);
++ write_escaping_html(out, RSTRING_PTR(einfo), len);
+ else
+- fwrite(RSTRING(einfo)->ptr, 1, len, out);
++ fwrite(RSTRING_PTR(einfo), 1, len, out);
+ if (epath) {
+ fprintf(out, " (");
+ if (cgi)
+- write_escaping_html(out, RSTRING(epath)->ptr, RSTRING(epath)->len);
++ write_escaping_html(out, RSTRING_PTR(epath), RSTRING_LEN(epath));
+ else
+- fwrite(RSTRING(epath)->ptr, 1, RSTRING(epath)->len, out);
++ fwrite(RSTRING_PTR(epath), 1, RSTRING_LEN(epath), out);
+ if (cgi)
+ fprintf(out, ")<br>\n");
+ else
+@@ -179,9 +200,9 @@
+ }
+ if (tail) {
+ if (cgi)
+- write_escaping_html(out, tail, RSTRING(einfo)->len - len - 1);
++ write_escaping_html(out, tail, RSTRING_LEN(einfo) - len - 1);
+ else
+- fwrite(tail, 1, RSTRING(einfo)->len - len - 1, out);
++ fwrite(tail, 1, RSTRING_LEN(einfo) - len - 1, out);
+ if (cgi)
+ fprintf(out, "<br>\n");
+ else
+@@ -200,38 +221,38 @@
+
+ rb_ary_pop(errat);
+ ep = RARRAY(errat);
+- for (i=1; i<ep->len; i++) {
+- if (TYPE(ep->ptr[i]) == T_STRING) {
++ for (i=1; i<RARRAY_LEN(ep); i++) {
++ if (TYPE(RARRAY_PTR(ep)[i]) == T_STRING) {
+ if (cgi) {
+ fprintf(out, "<div class=\"backtrace\">from ");
+ write_escaping_html(out,
+- RSTRING(ep->ptr[i])->ptr,
+- RSTRING(ep->ptr[i])->len);
++ RSTRING_PTR(RARRAY_PTR(ep)[i]),
++ RSTRING_LEN(RARRAY_PTR(ep)[i]));
+ }
+ else {
+ fprintf(out, " from ");
+- fwrite(RSTRING(ep->ptr[i])->ptr, 1,
+- RSTRING(ep->ptr[i])->len, out);
++ fwrite(RSTRING_PTR(RARRAY_PTR(ep)[i]), 1,
++ RSTRING_LEN(RARRAY_PTR(ep)[i]), out);
+ }
+ if (cgi)
+ fprintf(out, "<br></div>\n");
+ else
+ fprintf(out, "\n");
+ }
+- if (i == TRACE_HEAD && ep->len > TRACE_MAX) {
++ if (i == TRACE_HEAD && RARRAY_LEN(ep) > TRACE_MAX) {
+ char buff[BUFSIZ];
+ if (cgi)
+ snprintf(buff, BUFSIZ,
+ "<div class=\"backtrace\">... %ld levels...\n",
+- ep->len - TRACE_HEAD - TRACE_TAIL);
++ RARRAY_LEN(ep) - TRACE_HEAD - TRACE_TAIL);
+ else
+ snprintf(buff, BUFSIZ, " ... %ld levels...<br></div>\n",
+- ep->len - TRACE_HEAD - TRACE_TAIL);
++ RARRAY_LEN(ep) - TRACE_HEAD - TRACE_TAIL);
+ if (cgi)
+ write_escaping_html(out, buff, strlen(buff));
+ else
+ fputs(buff, out);
+- i = ep->len - TRACE_TAIL;
++ i = RARRAY_LEN(ep) - TRACE_TAIL;
+ }
+ }
+ }
+@@ -251,10 +272,10 @@
+ }
+
+ if (cgi) {
+- write_escaping_html(out, RSTRING(code)->ptr, RSTRING(code)->len);
++ write_escaping_html(out, RSTRING_PTR(code), RSTRING_LEN(code));
+ }
+ else {
+- fwrite(RSTRING(code)->ptr, 1, RSTRING(code)->len, out);
++ fwrite(RSTRING_PTR(code), 1, RSTRING_LEN(code), out);
+ }
+ if (cgi) {
+ fprintf(out, "</code></pre>\n");
+@@ -394,15 +415,14 @@
+ static VALUE defout_write(VALUE self, VALUE str)
+ {
+ str = rb_obj_as_string(str);
+- rb_str_cat(self, RSTRING(str)->ptr, RSTRING(str)->len);
++ rb_str_cat(self, RSTRING_PTR(str), RSTRING_LEN(str));
+ return Qnil;
+ }
+
+ static VALUE defout_cancel(VALUE self)
+ {
+- if (RSTRING(self)->len == 0) return Qnil;
+- RSTRING(self)->len = 0;
+- RSTRING(self)->ptr[0] = '\0';
++ if (RSTRING_LEN(self) == 0) return Qnil;
++ self = rb_str_new("", 0);
+ return Qnil;
+ }
+
+@@ -556,7 +576,7 @@
+
+ Init_stack(&stack_start);
+ code = eruby_load(eruby_filename, 0, &state);
+- if (state && !rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
++ if (state && !rb_obj_is_kind_of(rb_errinfo(), rb_eSystemExit)) {
+ if (RTEST(ruby_debug) &&
+ (eruby_mode == MODE_CGI || eruby_mode == MODE_NPHCGI)) {
+ error_print(stdout, state, 1, eruby_mode, code);
+@@ -571,8 +591,8 @@
+ print_generated_code(stderr, code, 0);
+ }
+ #if RUBY_VERSION_CODE >= 180
+- out = RSTRING(rb_stdout)->ptr;
+- nout = RSTRING(rb_stdout)->len;
++ out = RSTRING_PTR(rb_stdout);
++ nout = RSTRING_LEN(rb_stdout);
+ #else
+ out = RSTRING(rb_defout)->ptr;
+ nout = RSTRING(rb_defout)->len;