Add a ruby19 FLAVOR to build a ruby 1.9 version that can be installed

side by side with the default ruby 1.8 version.

OK landry@
This commit is contained in:
jeremy 2011-07-12 18:06:23 +00:00
parent 9d2131227f
commit fda7e2fba6
4 changed files with 91 additions and 28 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.24 2011/01/15 01:09:43 naddy Exp $
# $OpenBSD: Makefile,v 1.25 2011/07/12 18:06:23 jeremy Exp $
SHARED_ONLY= Yes
@ -21,6 +21,17 @@ PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=hyperestraier/}
FLAVORS = ruby19
FLAVOR ?=
.if ${FLAVOR:L:Mruby19}
MODRUBY_REV = 1.9
FULLPKGNAME = ruby19-hyperestraier-1.0.0
BIN_SUFFIX = 19
.else
BIN_SUFFIX =
.endif
SUBST_VARS += BIN_SUFFIX
WANTLIB= c m pthread estraier ${MODRUBY_WANTLIB}
MODULES= lang/ruby
@ -29,10 +40,14 @@ LIB_DEPENDS= ${MODRUBY_LIB_DEPENDS} \
CONFIGURE_STYLE= gnu
CONFIGURE_ARGS= ${CONFIGURE_SHARED}
CONFIGURE_ENV = RUBY=${RUBY} RDOC=`echo ${RUBY} | sed s/ruby/rdoc/`
WRKSRC= ${WRKDIST}/rubynative
post-install:
.if ${FLAVOR:L:Mruby19}
mv ${PREFIX}/bin/estcmd{,19}.rb
.endif
${INSTALL_DATA_DIR} ${MODRUBY_EXAMPLEDIR}/hyperestraier
${INSTALL_DATA} ${WRKSRC}/example/*.rb \
${MODRUBY_EXAMPLEDIR}/hyperestraier

View File

@ -1,51 +1,47 @@
$OpenBSD: patch-rubynative_configure,v 1.2 2010/09/23 22:15:32 jeremy Exp $
$OpenBSD: patch-rubynative_configure,v 1.3 2011/07/12 18:06:23 jeremy Exp $
--- rubynative/configure.orig Mon Dec 24 17:53:40 2007
+++ rubynative/configure Mon Sep 13 12:44:01 2010
@@ -1228,8 +1228,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+++ rubynative/configure Fri Jul 8 09:01:02 2011
@@ -1228,8 +1228,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Export variables
-RUBY="ruby"
-RDOC="rdoc"
+RUBY="ruby18"
+RDOC="rdoc18"
MYRBLIBDIR=/usr/local/lib/ruby/site_ruby
MYRUNPATH=""
@@ -1258,7 +1258,7 @@ fi
@@ -1258,7 +1256,7 @@ fi
# Setting the default prefix
if test "$prefix" = NONE
then
- prefix=`ruby -rrbconfig -e 'puts(Config::CONFIG.fetch("prefix"))'`
+ prefix=`ruby18 -rrbconfig -e 'puts(Config::CONFIG.fetch("prefix"))'`
+ prefix=`$RUBY -rrbconfig -e 'puts(Config::CONFIG.fetch("prefix"))'`
fi
@@ -1270,22 +1270,22 @@ fi
@@ -1268,24 +1266,8 @@ fi
#================================================================
# Ruby interpreter
printf 'checking RUBY... '
-# Ruby interpreter
-printf 'checking RUBY... '
-if which ruby > /dev/null
+if which ruby18 > /dev/null
then
-then
- RUBY=`which ruby`
+ RUBY=`which ruby18`
fi
printf '%s\n' "$RUBY"
# Other building tools
printf 'checking RDOC... '
-fi
-printf '%s\n' "$RUBY"
-
-# Other building tools
-printf 'checking RDOC... '
-if which rdoc > /dev/null
+if which rdoc18 > /dev/null
then
-then
- RDOC=`which rdoc`
+ RDOC=`which rdoc18`
fi
printf '%s\n' "$RDOC"
-fi
-printf '%s\n' "$RDOC"
-
# Librarh path
-myrblibdir=`ruby -rrbconfig -e 'puts(Config::CONFIG.fetch("sitelibdir"))'`
+myrblibdir=`ruby18 -rrbconfig -e 'puts(Config::CONFIG.fetch("sitearchdir"))'`
+myrblibdir=`$RUBY -rrbconfig -e 'puts(Config::CONFIG.fetch("sitearchdir"))'`
if test -n "$myrblibdir"
then
MYRBLIBDIR="$myrblibdir"

View File

@ -0,0 +1,52 @@
$OpenBSD: patch-rubynative_src_estraier_c,v 1.1 2011/07/12 18:06:23 jeremy Exp $
--- rubynative/src/estraier.c.orig Fri Jul 8 09:05:46 2011
+++ rubynative/src/estraier.c Fri Jul 8 09:08:29 2011
@@ -351,7 +351,7 @@ static VALUE doc_make_snippet(VALUE vself, VALUE vword
vdoc = rb_iv_get(vself, VNDATA);
Data_Get_Struct(vdoc, ESTDOC, doc);
Check_Type(vwords, T_ARRAY);
- len = RARRAY(vwords)->len;
+ len = RARRAY_LEN(vwords);
for(i = 0; i < len; i++){
Check_Type(rb_ary_entry(vwords, i), T_STRING);
}
@@ -764,7 +764,7 @@ static VALUE db_search_meta(VALUE vself, VALUE vdbs, V
CBMAP *hints;
int i, dnum, *res, rnum;
Check_Type(vdbs, T_ARRAY);
- dnum = RARRAY(vdbs)->len;
+ dnum = RARRAY_LEN(vdbs);
dbs = cbmalloc(dnum * sizeof(ESTMTDB *) + 1);
for(i = 0; i < dnum; i++){
vdb = rb_ary_entry(vdbs, i);
@@ -1189,10 +1189,10 @@ static CBLIST *objtocblist(VALUE obj){
VALUE str;
int i, len;
list = cblistopen();
- len = RARRAY(obj)->len;
+ len = RARRAY_LEN(obj);
for(i = 0; i < len; i++){
str = rb_ary_entry(obj, i);
- cblistpush(list, RSTRING(str)->ptr, RSTRING(str)->len);
+ cblistpush(list, RSTRING_PTR(str), RSTRING_LEN(str));
}
return list;
}
@@ -1218,14 +1218,14 @@ static CBMAP *objtocbmap(VALUE obj){
int i, len;
map = cbmapopenex(31);
keys = rb_funcall(obj, rb_intern("keys"), 0);
- len = RARRAY(keys)->len;
+ len = RARRAY_LEN(keys);
for(i = 0; i < len; i++){
key = rb_ary_entry(keys, i);
val = rb_hash_aref(obj, key);
key = rb_String(key);
val = rb_String(val);
- cbmapput(map, RSTRING(key)->ptr, RSTRING(key)->len,
- RSTRING(val)->ptr, RSTRING(val)->len, 0);
+ cbmapput(map, RSTRING_PTR(key), RSTRING_LEN(key),
+ RSTRING_PTR(val), RSTRING_LEN(val), 0);
}
return map;
}

View File

@ -1,5 +1,5 @@
@comment $OpenBSD: PLIST,v 1.3 2010/11/09 18:47:57 jeremy Exp $
bin/estcmd.rb
@comment $OpenBSD: PLIST,v 1.4 2011/07/12 18:06:23 jeremy Exp $
bin/estcmd${BIN_SUFFIX}.rb
lib/ruby/site_ruby/${MODRUBY_LIBREV}/${MODRUBY_ARCH}/estraier.so
${MODRUBY_RELEXAMPLEDIR}/
${MODRUBY_RELEXAMPLEDIR}/hyperestraier/