- make configure work with ruby19

- set PKGNAMEPREFIX
- ugly fix for threads with ruby-1.8.7.160
- replace obsolteted funtions, experimental build with ruby19
This commit is contained in:
Dirk Meyer 2009-07-12 14:36:01 +00:00
parent 22d024b8ce
commit 08a5a0f3a7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=237637
6 changed files with 480 additions and 6 deletions

View file

@ -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>

View file

@ -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@

View file

@ -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"

View file

@ -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);

View file

@ -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);

View file

@ -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;