なかだです。

testのことを忘れてました。それと$(OBJS)はdlconfig.hに依存させた
ほうがよさそうな気が。

二つ目のパッチは、一応1.4でもコンパイルできるようにしてみたんで
すが、Symbol関係でテストが通らないのでダメかも。


Index: depend =================================================================== RCS file: /cvs/ruby/src/rough/ext/dl/depend,v retrieving revision 1.17 diff -u -2 -p -u -r1.17 depend --- depend 2002/01/24 07:01:51 1.17 +++ depend 2002/01/24 08:50:46 @@ -11,11 +11,18 @@ test/libtest.so: test/test.o test/libtes test/test.o: test/test.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c test/test.c -o test/test.o + @$(RUBY) -rftools -e 'File.mkpath(*ARGV)' test + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ -test:: dl.so libtest.so +test:: dl.so libtest.so .force $(RUBY) -I. $(srcdir)/test/test.rb +.force: + +.PHONY: .force test + allclean: distclean @rm -f $(DISTCLEANFILES) + +$(OBJS): dlconfig.h sym.o: call.func Index: extconf.rb =================================================================== RCS file: /cvs/ruby/src/rough/ext/dl/extconf.rb,v retrieving revision 1.33 diff -u -2 -p -r1.33 extconf.rb --- extconf.rb 2002/01/24 07:01:51 1.33 +++ extconf.rb 2002/01/24 09:01:48 @@ -152,12 +152,20 @@ else end -File.open("dlconfig.h","w"){|f| - f.print("#ifndef DLCONFIG_H\n") - f.print("#define DLCONFIG_H\n") - f.print($dlconfig_h) - f.print("#endif /* DLCONFIG_H */\n") -} +def File.update(file, str) + begin + open(file){|f|f.read} == str + rescue Errno::ENOENT + false + end or open(file, "w"){|f|f.print(str)} +end + +File.update("dlconfig.h", <<EOF) +#ifndef DLCONFIG_H +#define DLCONFIG_H +#{$dlconfig_h} +#endif /* DLCONFIG_H */ +EOF -dlconfig_rb = <<EOF +File.update("dlconfig.rb", <<EOF) MAX_ARG = #{max_arg} MAX_CBARG = #{max_cbarg} @@ -171,8 +179,4 @@ DLTYPE[DOUBLE][:sym]= #{$with_type_doubl DLTYPE[VOIDP][:sym] = #{$with_type_voidp} EOF - -File.open("dlconfig.rb","w"){|f| - f.print(dlconfig_rb) -} create_makefile('dl') Index: test/test.rb =================================================================== RCS file: /cvs/ruby/src/rough/ext/dl/test/test.rb,v retrieving revision 1.39 diff -u -2 -p -u -r1.39 test/test.rb --- test/test.rb 2001/12/03 02:48:57 1.39 +++ test/test.rb 2002/01/24 08:15:21 @@ -145,5 +145,5 @@ debug sym_open,sym_gets,sym_close fp,rs = sym_open["extconf.rb", "r"] -File.open("extconf.rb"){|f| +File.open(File.expand_path("extconf.rb", File.dirname(File.dirname(__FILE__)))){|f| $line = f.gets }
--- extconf.rb~ Thu Jan 24 18:01:48 2002 +++ extconf.rb Thu Jan 24 18:02:59 2002 @@ -19,5 +19,5 @@ EOF end -$CPPFLAGS << " -I." +($CPPFLAGS || $CFLAGS) << " -I." case RUBY_PLATFORM # from Win32API @@ -151,6 +151,12 @@ exit(0) end +unless method(:have_func) == 1 + have_func("rb_str_cat2", "ruby.h") + have_func("rb_block_given_p", "ruby.h") or + $dlconfig_h << "#define rb_block_given_p rb_iterator_p\n" +end + def File.update(file, str) begin open(file){|f|f.read} == str Index: ptr.c =================================================================== RCS file: /cvs/ruby/src/rough/ext/dl/ptr.c,v retrieving revision 1.19 diff -u -2 -p -u -r1.19 ptr.c --- ptr.c 2002/01/21 13:47:25 1.19 +++ ptr.c 2002/01/24 08:53:12 @@ -11,4 +11,8 @@ VALUE rb_mDLMemorySpace; static VALUE DLMemoryTable; +#ifndef T_SYMBOL +# define T_SYMBOL T_FIXNUM +#endif + #if RUBY_VERSION_CODE < 171 static VALUE Index: sym.c =================================================================== RCS file: /cvs/ruby/src/rough/ext/dl/sym.c,v retrieving revision 1.15 diff -u -2 -p -u -r1.15 sym.c --- sym.c 2001/12/27 02:21:57 1.15 +++ sym.c 2002/01/24 08:47:01 @@ -8,4 +8,12 @@ VALUE rb_cDLSymbol; +#ifndef HAVE_RB_STR_CAT2 +static VALUE +rb_str_cat2(VALUE str, const char *s) +{ + return rb_str_cat(str, s, strlen(s)); +} +#endif + static const char * char2type(int ch)
-- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦