Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 May 2013 16:19:05 +0900 (JST)
From:      Tsurutani Naoki <turutani@scphys.kyoto-u.ac.jp>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        turutani@scphys.kyoto-u.ac.jp
Subject:   ports/178293: fix japanese/ruby-eb
Message-ID:  <201305020719.r427J5TQ088153@h120.65.226.10.32118.vlan.kuins.net>
Resent-Message-ID: <201305020720.r427K1JN045174@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         178293
>Category:       ports
>Synopsis:       fix japanese/ruby-eb
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 02 07:20:01 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Tsurutani Naoki
>Release:        FreeBSD 8.4-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD h120.65.226.10.32118.vlan.kuins.net 8.4-PRERELEASE FreeBSD 8.4-PRERELEASE #26 r249149: Fri Apr 5 22:13:25 JST 2013 turutani@h120.65.226.10.32118.vlan.kuins.net:/usr/local/work/usr/obj/usr/src/sys/POLYMER i386


	
>Description:
	japanese/ruby-eb is marked as deprecated, for it does not work on ruby 1.9.
	is it possible to make it alive again ?
	
>How-To-Repeat:
	
>Fix:
	here are patches available from https://github.com/kubo/rubyeb19 .
	would you test with these patches ?

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	files/patch-eb.c
#	files/patch-extconf.rb
#	files/patch-test.rb
#
echo x - files/patch-eb.c
sed 's/^X//' >files/patch-eb.c << '8c6319ab6d948c05f4506bf46c68339b'
X--- eb.c.orig	2004-07-13 02:46:01.000000000 +0900
X+++ eb.c	2013-05-02 15:17:21.000000000 +0900
X@@ -19,6 +19,13 @@
X 
X #if HAVE_EB_SYSDEFS_H
X #include <eb/sysdefs.h>
X+#if (defined RUBY_EB_ENABLE_PTHREAD && !defined(EB_ENABLE_PTHREAD)) \
X+ || (!defined RUBY_EB_ENABLE_PTHREAD && defined(EB_ENABLE_PTHREAD))
X+#error The EB library is incompatible with EB heders.
X+#endif
X+
X+#elif defined RUBY_EB_ENABLE_PTHREAD
X+#define EBCONF_ENABLE_PTHREAD 1
X #endif
X 
X #include <eb/eb.h>
X@@ -55,6 +62,21 @@
X 
X #define APPENDIX_EB_IVAR "__appendix"
X 
X+#ifdef HAVE_TYPE_RB_ENCODING
X+#include <ruby/encoding.h>
X+#define REB_TO_RB_ENCODING(reb) rb_enc_from_index(NUM2INT(rb_ivar_get(reb, id_eb_encidx)))
X+#else
X+#define rb_encoding void
X+#define REB_TO_RB_ENCODING(reb) NULL
X+#define rb_ascii8bit_encindex() 0
X+#define rb_enc_find_index(name) 0
X+#define rb_usascii_str_new_cstr(ptr) rb_str_new2(ptr)
X+#define rb_filesystem_str_new_cstr(ptr) rb_str_new2(ptr)
X+/* "((void)enc, ...)" is a hack to suppress warnings: unused variable 'enc' */
X+#define rb_external_str_new_with_enc(ptr, len, enc) ((void)enc, rb_tainted_str_new((ptr), (len)))
X+#define rb_str_export_to_enc(str, enc) ((void)enc, (str))
X+#endif
X+
X struct ExtFont {
X     int code;
X     int wideflag;               /* boolean */
X@@ -67,20 +89,30 @@
X 
X 
X 
X-VALUE mEB;
X-VALUE cEBook;
X-VALUE cEBCancel;
X-VALUE cEBPosition;
X-VALUE cEBExtFont;
X-VALUE cEBHook;
X-VALUE cEBAppendix;
X+static VALUE mEB;
X+static VALUE cEBook;
X+static VALUE cEBCancel;
X+static VALUE cEBPosition;
X+static VALUE cEBExtFont;
X+static VALUE cEBHook;
X+static VALUE cEBAppendix;
X 
X-ID id_call;
X+static ID id_call;
X+static ID id_eb_encidx;
X+
X+static void
X+reb_check_type(VALUE obj, VALUE klass)
X+{
X+    if (!rb_obj_is_kind_of(obj, klass)) {
X+        rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)",
X+                 rb_obj_classname(obj), rb_class2name(klass));
X+    }
X+}
X 
X-int
X+static int
X text_hook(EB_Book * book, EB_Appendix * appendix, void *container, EB_Hook_Code code, int argc, const int *argv)
X {
X-    VALUE func, ret_buff, rb_argv, rb_eb, rb_hookset;
X+    VALUE func, ret_buff, rargv, rb_eb, rb_hookset;
X     int idx;
X     char *tmpbuffer;
X 
X@@ -92,17 +124,17 @@
X 
X     func = rb_ary_entry(rb_iv_get(rb_hookset, HOOKSET_PROCS_IVAR), code);
X 
X-    rb_argv = rb_ary_new2(argc);
X+    rargv = rb_ary_new2(argc);
X     for (idx = 0; idx < argc; idx++) {
X-        rb_ary_store(rb_argv, idx, INT2FIX(argv[idx]));
X+        rb_ary_store(rargv, idx, INT2FIX(argv[idx]));
X     }
X 
X-    ret_buff = rb_funcall(func, id_call, 2, rb_eb, rb_argv);
X+    ret_buff = rb_funcall(func, id_call, 2, rb_eb, rargv);
X     if (ret_buff != Qnil) {
X         if (TYPE(ret_buff) == T_STRING) {
X             ret_buff = rb_funcall(ret_buff, rb_intern("to_str"), 0);
X         }
X-        tmpbuffer = STR2CSTR(ret_buff);
X+        tmpbuffer = StringValueCStr(ret_buff);
X         eb_write_text_string(book, tmpbuffer);
X     }
X     return 0;
X@@ -164,6 +196,7 @@
X     reb_appendix = Data_Make_Struct(cEBAppendix, EB_Appendix, 0, finalize_appendix, appendix);
X     eb_initialize_appendix(appendix);
X     rb_iv_set(robj, APPENDIX_EB_IVAR, reb_appendix);
X+    rb_ivar_set(robj, id_eb_encidx, INT2FIX(rb_ascii8bit_encindex()));
X 
X     return robj;
X }
X@@ -185,13 +218,30 @@
X {
X     EB_Book *eb;
X     int r;
X+    EB_Character_Code charcode = EB_CHARCODE_INVALID;
X+    int encidx;
X 
X     Data_Get_Struct(obj, EB_Book, eb);
X-    r = eb_bind(eb, STR2CSTR(path));
X+    r = eb_bind(eb, StringValueCStr(path));
X     if (r != EB_SUCCESS) {
X-        rb_raise(rb_eRuntimeError, eb_error_message(r));
X+        rb_raise(rb_eRuntimeError, "%s", eb_error_message(r));
X         return Qfalse;
X     }
X+
X+    eb_character_code(eb, &charcode);
X+    switch (charcode) {
X+    case EB_CHARCODE_ISO8859_1:
X+        encidx = rb_enc_find_index("ISO-8859-1");
X+        break;
X+    case EB_CHARCODE_JISX0208:
X+        encidx = rb_enc_find_index("EUC-JP");
X+        break;
X+    default:
X+        encidx = rb_ascii8bit_encindex();
X+        break;
X+    }
X+    rb_ivar_set(obj, id_eb_encidx, INT2FIX(encidx));
X+
X     return obj;
X }
X 
X@@ -206,13 +256,13 @@
X     eb_error = eb_disc_type(eb, &r);
X     switch (r) {
X     case EB_DISC_EB:
X-        return rb_str_new2("EB/EBG/EBXA/EBXA-C/S-EBXA");
X+        return rb_usascii_str_new_cstr("EB/EBG/EBXA/EBXA-C/S-EBXA");
X         break;
X     case EB_DISC_EPWING:
X-        return rb_str_new2("EPWING");
X+        return rb_usascii_str_new_cstr("EPWING");
X         break;
X     }
X-    return rb_str_new2("Unknown");
X+    return rb_usascii_str_new_cstr("Unknown");
X }
X 
X static VALUE
X@@ -241,29 +291,29 @@
X reb_path(VALUE obj)
X {
X     EB_Book *eb;
X-    char r[1024];               /*絶対値はまずいと思う */
X+    char r[EB_MAX_PATH_LENGTH + 1];
X 
X     Data_Get_Struct(obj, EB_Book, eb);
X     eb_error = eb_path(eb, r);
X 
X-    return rb_str_new2(r);
X+    return rb_filesystem_str_new_cstr(r);
X }
X 
X static VALUE
X reb_charcode(VALUE obj)
X {
X     EB_Book *eb;
X-    EB_Character_Code r;
X+    EB_Character_Code r = EB_CHARCODE_INVALID;
X 
X     Data_Get_Struct(obj, EB_Book, eb);
X     eb_error = eb_character_code(eb, &r);
X 
X     switch (r) {
X     case EB_CHARCODE_ISO8859_1:
X-        return rb_str_new2("ISO8859_1");
X+        return rb_usascii_str_new_cstr("ISO8859_1");
X         break;
X     case EB_CHARCODE_JISX0208:
X-        return rb_str_new2("JISX0208");
X+        return rb_usascii_str_new_cstr("JISX0208");
X         break;
X     }
X     return Qnil;
X@@ -303,19 +353,21 @@
X reb_subbooktitle(int argc, VALUE * argv, VALUE obj)
X {
X     EB_Book *eb;
X-    char r[1024];               /*絶対値はまずいと思う */
X+    char r[EB_MAX_TITLE_LENGTH + 1];
X+    rb_encoding *enc = REB_TO_RB_ENCODING(obj);
X 
X     Data_Get_Struct(obj, EB_Book, eb);
X     eb_error = (argc == 0) ?
X         eb_subbook_title(eb, r) : eb_subbook_title2(eb, NUM2INT(argv[0]), r);
X-    return rb_str_new2(r);
X+
X+    return rb_external_str_new_with_enc(r, strlen(r), enc);
X }
X 
X static VALUE
X reb_subbookdirectory(int argc, VALUE * argv, VALUE obj)
X {
X     EB_Book *eb;
X-    char r[1024];               /*絶対値はまずいと思う */
X+    char r[EB_MAX_DIRECTORY_NAME_LENGTH + 1];
X 
X     Data_Get_Struct(obj, EB_Book, eb);
X     eb_error = (argc == 0) ?
X@@ -371,7 +423,7 @@
X     return obj;
X }
X 
X-VALUE
X+static VALUE
X have_search(VALUE obj, EB_Error_Code(*funct) (EB_Book *))
X {
X     EB_Book *eb;
X@@ -379,7 +431,7 @@
X     Data_Get_Struct(obj, EB_Book, eb);
X     r = (*funct) (eb);
X     if (!r && eb_error == EB_ERR_NO_CUR_SUB) {
X-        rb_raise(rb_eRuntimeError, eb_error_message(eb_error));
X+        rb_raise(rb_eRuntimeError, "%s", eb_error_message(eb_error));
X         return Qfalse;
X     }
X     return (r) ? Qtrue : Qfalse;
X@@ -432,8 +484,9 @@
X static VALUE
X content_read(VALUE reb, EB_Book * eb, EB_Appendix * appendix, EB_Hookset * text_hookset)
X {
X-    int len;
X+    ssize_t len;
X     char desc[MAX_STRLEN + 1];
X+    rb_encoding *enc = REB_TO_RB_ENCODING(reb);
X 
X     eb_error = eb_read_text(eb, appendix, text_hookset, (void *) reb,
X                             MAX_STRLEN, desc, &len);
X@@ -442,7 +495,7 @@
X         rb_raise(rb_eRuntimeError, "fail fetching text");
X         return Qfalse;
X     }
X-    return rb_str_new(desc, len);
X+    return rb_external_str_new_with_enc(desc, len, enc);
X }
X 
X static VALUE
X@@ -455,14 +508,15 @@
X     return content_read(reb, eb, appendix, text_hookset);
X }
X 
X-VALUE
X+static VALUE
X get_item(VALUE reb, EB_Book * eb, EB_Hit * hit)
X {
X     EB_Hookset *text_hookset;
X     EB_Appendix *appendix;
X     VALUE item;
X     char desc[MAX_STRLEN + 1];
X-    int len;
X+    ssize_t len;
X+    rb_encoding *enc = REB_TO_RB_ENCODING(reb);
X     item = rb_ary_new2(2);
X 
X     if (eb_seek_text(eb, &(hit->heading)) < 0) {
X@@ -480,14 +534,14 @@
X         return Qfalse;
X     }
X 
X-    rb_ary_push(item, rb_str_new(desc, len));
X+    rb_ary_push(item, rb_external_str_new_with_enc(desc, len, enc));
X     rb_ary_push(item, content_fetch_from_pos(reb, eb, &(hit->text), appendix, text_hookset));
X 
X     return item;
X }
X 
X 
X-VALUE
X+static VALUE
X hitmaker(VALUE reb, EB_Book * eb, unsigned int max, int flag)
X {
X     int hitpushed, hitcount;
X@@ -536,20 +590,22 @@
X     return (flag == 0) ? robj : INT2NUM(hitpushed);
X }
X 
X-void
X-set_keywords(VALUE array, char **buffer)
X+static void
X+set_keywords(VALUE array, char **buffer, volatile VALUE *gc_guard, rb_encoding *enc)
X {
X     int i, sz;
X+
X     if (TYPE(array) != T_ARRAY) {
X         rb_raise(rb_eTypeError, "wordlist must be array of String.");
X     }
X 
X-    sz = RARRAY(array)->len;
X+    sz = RARRAY_LEN(array);
X     if (sz > MAX_KEYWORDS) {
X         rb_raise(rb_eRuntimeError, "too many keywords(%d).", sz);
X     }
X     for (i = 0; i < sz; i++) {
X-        buffer[i] = STR2CSTR(rb_ary_entry(array, i));
X+        gc_guard[i] = rb_str_export_to_enc(rb_ary_entry(array, i), enc);
X+        buffer[i] = RSTRING_PTR(gc_guard[i]);
X     }
X     buffer[sz] = NULL;
X }
X@@ -563,6 +619,12 @@
X     char *buffer[MAX_KEYWORDS + 1];
X     int max;
X     int r;
X+    rb_encoding *enc = REB_TO_RB_ENCODING(obj);
X+    /* The following two variables are used to prevent GC from freeing
X+     * temporary objects.
X+     */
X+    volatile VALUE gc_guard[MAX_KEYWORDS];
X+    volatile VALUE str;
X 
X     if (argc < 1) {
X         rb_raise(rb_eArgError, "missing searchstring");
X@@ -570,10 +632,11 @@
X     }
X 
X     if (wordtype == SEARCHTYPE_WORD) {
X-        word = STR2CSTR(argv[0]);
X+        str = rb_str_export_to_enc(argv[0], enc);
X+        word = RSTRING_PTR(str);
X     }
X     else {
X-        set_keywords(argv[0], buffer);
X+        set_keywords(argv[0], buffer, gc_guard, enc);
X         word = buffer;
X     }
X     max = (argc > 1) ? NUM2INT(argv[1]) : -1;
X@@ -616,10 +679,11 @@
X 
X 
X /*   Thanks for Kuroda-san  */
X-VALUE
X+static VALUE
X hitmaker2(VALUE reb, EB_Book * eb, unsigned int max, int flag)
X {
X-    int hitcount, i, len, broken;
X+    int hitcount, i, broken;
X+    ssize_t len;
X     int hitpushed;
X     VALUE robj, item, can;
X     EB_Hit hits[MAX_HITS];
X@@ -629,6 +693,7 @@
X     char descbuf2[MAX_STRLEN + 1];
X     char *prevdesc;
X     int prevpage, prevoffset;
X+    rb_encoding *enc = REB_TO_RB_ENCODING(reb);
X     desc = descbuf1;
X 
X /*** this 2 lines necessary? (2/4) eblook do like this ***/
X@@ -669,7 +734,7 @@
X 
X             item = rb_ary_new2(2);
X             rb_ary_push(item, Data_Make_Struct(cEBPosition, EB_Position, 0, free, ebpos));
X-            rb_ary_push(item, rb_str_new(desc, len));
X+            rb_ary_push(item, rb_external_str_new_with_enc(desc, len, enc));
X             ebpos->page = hits[i].text.page;
X             ebpos->offset = hits[i].text.offset;
X 
X@@ -707,7 +772,7 @@
X     return (flag == 0) ? robj : INT2NUM(hitpushed);
X }
X 
X-VALUE
X+static VALUE
X position_search(int argc, VALUE * argv, VALUE obj, int wordtype,
X                 EB_Error_Code(*funct) ())
X {
X@@ -716,6 +781,12 @@
X     void *word;
X     int max;
X     int r;
X+    rb_encoding *enc = REB_TO_RB_ENCODING(obj);
X+    /* The following two variables are used to prevent GC from freeing
X+     * temporary objects.
X+     */
X+    volatile VALUE gc_guard[MAX_KEYWORDS];
X+    volatile VALUE str;
X 
X     if (argc < 1) {
X         rb_raise(rb_eArgError, "missing searchstring");
X@@ -723,10 +794,11 @@
X     }
X 
X     if (wordtype == SEARCHTYPE_WORD) {
X-        word = STR2CSTR(argv[0]);
X+        str = rb_str_export_to_enc(argv[0], enc);
X+        word = RSTRING_PTR(str);
X     }
X     else {
X-        set_keywords(argv[0], buffer);
X+        set_keywords(argv[0], buffer, gc_guard, enc);
X         word = buffer;
X     }
X     max = (argc > 1) ? NUM2INT(argv[1]) : -1;
X@@ -775,6 +847,7 @@
X     VALUE robj;
X 
X     Data_Get_Struct(obj, EB_Book, eb);
X+    reb_check_type(position, cEBPosition);
X     Data_Get_Struct(position, EB_Position, ppos);
X     apx = get_eb_appendix(obj);
X     thook = get_eb_texthook(obj);
X@@ -785,7 +858,7 @@
X         do {
X             rb_yield(robj);
X             robj = content_read(obj, eb, apx, thook);
X-            dlen = MAX_STRLEN - RSTRING(robj)->len;
X+            dlen = MAX_STRLEN - RSTRING_LEN(robj);
X         } while (dlen == 0);
X     }
X     return robj;
X@@ -803,7 +876,7 @@
X static VALUE
X reb_sethookset(VALUE obj, VALUE hkset)
X {
X-    if (rb_funcall(hkset, rb_intern("is_a?"), 1, cEBHook) != Qtrue && hkset != Qnil) {
X+    if (!rb_obj_is_kind_of(hkset, cEBHook) && !NIL_P(hkset)) {
X         rb_raise(rb_eArgError, "hookset must be nil or an instance of Hookset");
X         return Qfalse;
X     }
X@@ -874,7 +947,7 @@
X     return robj;
X }
X 
X-EB_Font_Code
X+static EB_Font_Code
X get_fontcode(EB_Book * eb)
X {
X     EB_Font_Code r;
X@@ -991,7 +1064,7 @@
X {
X     char buffer[MAX_STRLEN];
X     long readbytes;
X-    int bitmap_len;
X+    ssize_t bitmap_len;
X     int blocksize;
X     EB_Error_Code retcode;
X     VALUE robj;
X@@ -1010,7 +1083,7 @@
X     while (bitmap_len != 0) {
X         retcode = eb_read_binary(eb, blocksize, buffer, &bitmap_len);
X         if (retcode != EB_SUCCESS) {
X-            rb_raise(rb_eRuntimeError, eb_error_message(retcode));
X+            rb_raise(rb_eRuntimeError, "%s", eb_error_message(retcode));
X             return Qfalse;
X         }
X         if (iterateflag) {
X@@ -1024,6 +1097,7 @@
X                 break;
X         }
X     }
X+    rb_obj_taint(robj);
X 
X     return iterateflag ? INT2NUM(readbytes) : robj;
X }
X@@ -1036,6 +1110,7 @@
X     EB_Position *epos;
X 
X     Data_Get_Struct(obj, EB_Book, eb);
X+    reb_check_type(pos, cEBPosition);
X     Data_Get_Struct(pos, EB_Position, epos);
X 
X     retcode = eb_set_binary_mono_graphic(eb, epos, NUM2UINT(width), NUM2UINT(height));
X@@ -1086,7 +1161,9 @@
X     maxlen = (argc > 2) ? NUM2UINT(argv[2]) : MAX_STRLEN;
X 
X     Data_Get_Struct(obj, EB_Book, eb);
X+    reb_check_type(argv[0], cEBPosition);
X     Data_Get_Struct(argv[0], EB_Position, spos);
X+    reb_check_type(argv[1], cEBPosition);
X     Data_Get_Struct(argv[1], EB_Position, epos);
X 
X     retcode = eb_set_binary_wave(eb, spos, epos);
X@@ -1104,7 +1181,7 @@
X     EB_Error_Code retcode;
X     EB_Book *eb;
X     long maxlen;
X-    int param[4];
X+    unsigned int param[4];
X     int i;
X 
X     if (argc < 4) {
X@@ -1129,8 +1206,8 @@
X reb_compose_mpegfilename(int argc, VALUE * argv, VALUE obj)
X {
X     EB_Error_Code retcode;
X-    char buffer[1024];
X-    int param[4];
X+    char buffer[EB_MAX_DIRECTORY_NAME_LENGTH + 1];
X+    unsigned int param[4];
X     int i;
X     if (argc != 4) {
X         rb_raise(rb_eArgError, "4 args needed.(code1-code4)");
X@@ -1174,7 +1251,7 @@
X         return Qnil;
X     }
X     else if (err != EB_SUCCESS) {
X-        rb_raise(rb_eRuntimeError, eb_error_message(err));
X+        rb_raise(rb_eRuntimeError, "%s", eb_error_message(err));
X         return Qfalse;
X     }
X     return content_fetch_from_pos(obj, eb, &pos,
X@@ -1212,7 +1289,7 @@
X     EB_Appendix *appendix;
X     appendix = get_eb_appendix(obj);
X     if (path != Qnil) {
X-        eb_bind_appendix(appendix, STR2CSTR(path));
X+        eb_bind_appendix(appendix, StringValueCStr(path));
X     }
X     else {
X         eb_finalize_appendix(appendix);
X@@ -1291,7 +1368,7 @@
X     };
X 
X     (*conv_func) (font->bitmap, width, height, buffer, &size);
X-    robj = rb_str_new(buffer, size);
X+    robj = rb_tainted_str_new(buffer, size);
X     free(buffer);
X     return robj;
X }
X@@ -1439,13 +1516,17 @@
X         break;
X     case 2:
X         proc = argv[1];
X+        if (!rb_respond_to(proc, id_call)) {
X+            rb_raise(rb_eArgError, "wrong type argument %s (should respond to 'call')",
X+                     rb_obj_classname(proc));
X+        }
X         break;
X     default:
X         rb_raise(rb_eArgError, "wrong # of arguments");
X         break;
X     }
X 
X-    hook_type = FIX2UINT(argv[0]);
X+    hook_type = NUM2UINT(argv[0]);
X     rb_ary_store(rb_iv_get(self, HOOKSET_PROCS_IVAR), hook_type, proc);
X     Data_Get_Struct(self, EB_Hookset, text_hookset);
X     hook.code = hook_type;
X@@ -1485,7 +1566,7 @@
X     return Qfalse;
X }
X 
X-void
X+static void
X define_constants_under(VALUE mod)
X {
X     rb_define_const(mod, "HOOK_INITIALIZE", INT2FIX(EB_HOOK_INITIALIZE));
X@@ -1557,7 +1638,19 @@
X void
X Init_eb()
X {
X+#ifdef HAVE_EB_PTHREAD_ENABLED
X+#ifdef RUBY_EB_ENABLE_PTHREAD
X+    if (!eb_pthread_enabled()) {
X+       rb_raise(rb_eRuntimeError, "The RubyEB is compiled for pthread-enabled EB library.");
X+     }
X+#else
X+    if (eb_pthread_enabled()) {
X+       rb_raise(rb_eRuntimeError, "The RubyEB is compiled for pthread-disabled EB library.");
X+     }
X+#endif
X+#endif
X     id_call = rb_intern("call");
X+    id_eb_encidx = rb_intern("@__ruby_eb_encidx__");
X 
X     mEB = rb_define_module("EB");
X     rb_define_const(mEB,"RUBYEB_VERSION",rb_str_new2(RUBYEB_VERSION));
8c6319ab6d948c05f4506bf46c68339b
echo x - files/patch-extconf.rb
sed 's/^X//' >files/patch-extconf.rb << 'f4a06a32d63e21c2feaf1c25db2f37ca'
X--- extconf.rb.orig	2004-07-13 02:46:01.000000000 +0900
X+++ extconf.rb	2013-05-02 15:17:55.000000000 +0900
X@@ -5,9 +5,26 @@
X have_library('eb')
X have_func("rb_block_proc")
X have_func("eb_bitmap_to_png")
X-have_header('eb/sysdefs.h')                                                    
X+have_header('eb/sysdefs.h')
X+have_type('rb_encoding', ['ruby/ruby.h', 'ruby/encoding.h'])
X 
X-# uncomment the following line if you use eb-4.0beta* with pthread support.
X-# $defs << '-DEBCONF_ENABLE_PTHREAD'
X+if have_func("eb_pthread_enabled")
X+  print "checking that the EB library is pthread enabled... "
X+  STDOUT.flush
X+  if try_run(<<EOS)
X+#include <eb/eb.h>
X+
X+int main()
X+{
X+    printf("eb_pthread_enabled() => %d\\n", eb_pthread_enabled());
X+    return eb_pthread_enabled() ? 0 : 1;
X+}
X+EOS
X+    puts "yes"
X+    $defs << '-DRUBY_EB_ENABLE_PTHREAD'
X+  else
X+    puts "no"
X+  end
X+end
X 
X create_makefile("eb")
f4a06a32d63e21c2feaf1c25db2f37ca
echo x - files/patch-test.rb
sed 's/^X//' >files/patch-test.rb << 'bcc3bfda01f7a7012f701daf4fd1f006'
X--- test.rb.orig	2004-07-13 02:46:01.000000000 +0900
X+++ test.rb	2013-05-02 15:18:18.000000000 +0900
X@@ -1,8 +1,13 @@
X #!/bin/env ruby -Ke
X+# -*- coding: euc-jp -*-
X require "eb"
X 
X-if $KCODE!="EUC" then
X-  raise RuntimeError,"lib eb requires EUC coding system"
X+if defined? Encoding
X+  Encoding.default_internal = "UTF-8"
X+else
X+  if $KCODE!="EUC" then
X+    raise RuntimeError,"lib eb requires EUC coding system"
X+  end
X end
X 
X b=EB::Book.new
bcc3bfda01f7a7012f701daf4fd1f006
exit

	


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305020719.r427J5TQ088153>