[#7300] resolver を呼ばない UDPsocket#recvfrom — Toshihiko SHIMOKAWA / 下川俊彦 <toshi@...>

あんまり ruby-dev な話でも無いのですが、ちょっとした機能拡張の提案なので、

12 messages 1999/07/12
[#7321] Re: resolver を呼ばない UDPsocket#recvfrom — Toshihiko SHIMOKAWA / 下川俊彦 <toshi@...> 1999/07/15

From: Toshihiko SHIMOKAWA / 下川俊彦 <toshi@csce.kyushu-u.ac.jp>

[#7313] Ruby 1.3.5 — Yukihiro Matsumoto <matz@...>

Ruby 1.3.5 is out, check out:

59 messages 1999/07/15
[#7318] Re: Ruby 1.3.5 — WATANABE Hirofumi <watanabe@...> 1999/07/15

わたなべです.

[#7326] Re: Ruby 1.3.5 — Wakou Aoyama <wakou@...> 1999/07/15

青山です。

[#7331] Re: Ruby 1.3.5 — matz@... (Yukihiro Matsumoto) 1999/07/16

まつもと ゆきひろです

[#7340] Re: Ruby 1.3.5 — Wakou Aoyama <wakou@...> 1999/07/16

青山です。

[#7368] Re: Ruby 1.3.5 — matz@... (Yukihiro Matsumoto) 1999/07/19

まつもと ゆきひろです

[#7373] Re: Ruby 1.3.5 — Shin-ichiro Hara <sinara@...> 1999/07/19

原です。

[#7374] Re: Ruby 1.3.5 — matz@... (Yukihiro Matsumoto) 1999/07/19

まつもと ゆきひろです

[#7382] Re: Ruby 1.3.5 — Wakou Aoyama <wakou@...> 1999/07/19

青山です。

[#7386] Re: Ruby 1.3.5 — matz@... (Yukihiro Matsumoto) 1999/07/21

まつもと ゆきひろです

[#7388] Re: Ruby 1.3.5 — Wakou Aoyama <wakou@...> 1999/07/21

青山です。

[#7387] [PATCH]extconf.rb, tcltklib.c, and rubytest.rb for NetBSD — Ryo HAYASAKA <hayasaka@...21.u-aizu.ac.jp>

早坂@会津大学です。

10 messages 1999/07/21

[#7466] [PATCH] for djgpp — WATANABE Hirofumi <watanabe@...>

わたなべです.

21 messages 1999/07/29
[#7467] Re: [PATCH] for djgpp — Katsuyuki Komatsu <komatsu@...> 1999/07/29

小松です。

[ruby-dev:7327] [PATCH] ext/extmk.rb.in, instruby.rb, lib/mkmf.rb

From: Katsuyuki Komatsu <komatsu@...>
Date: 1999-07-16 00:53:02 UTC
List: ruby-dev #7327
小松です.

cygwin対応+αです。

1.  ext/extmk.rb.in
    cygwinで、cleanでdllが消えないので$(DLLIB)を追加
    "prefix = @prefix@"の重複を削除
    install_rbをmkmf.rbと合わせるように修正

2.  instruby.rb
    cygwinでBuild Directoryを作った場合、instruby.rbでimport.hが
    インストールされなかったので対応。

3.  lib/mkmf.rb
    cygwinで、cleanでdllが消えないので$(DLLIB)を追加
    extmk.rb.inのcygwinのフラグ関係の部分をmkmf.rbに反映
    extmk.rb.inのbeosのruby.exp/ruby.defの生成をmkmf.rbに反映
    mkmf.rbのhave_libraryの中の消し忘れを削除
    install_rbをextmk.rb.inと合わせるように修正
    mkmf.rbのPLATFORM =~ /cygwin32/を/cygwin/に変更
    mkmf.rbの$foundを$cache_modに変更

実行するとdiffが膨大になるので入れてませんが、extmk.rb.in,
mkmf.rbのTRUE/FALSEはtrue/falseへの一括置換をしていただけると
うれしいです。

obsolete constantsのPLATFORMもRUBY_PLATFORMへ置換した
ほうがいいかもしれません。

動作確認は、とりあえず2プラットフォームのみ行いました。

    NT 4.0 SP5 + cygwin b20.1 + cygwin1-19990628.dll + egcs-1.1.2:
	../configure --enable-shared
    Solaris 2.5.1 + egcs-1.1.2:
	env CFLAGS=-O2 ../configure --with-readline-dir=/usr/local \
	--with-make-prog=gmake --enable-shared

Index: ext/extmk.rb.in
===================================================================
RCS file: /home/cvs/ruby/ext/extmk.rb.in,v
retrieving revision 1.1.1.3.2.24
diff -u -p -r1.1.1.3.2.24 extmk.rb.in
--- ext/extmk.rb.in	1999/07/15 07:59:57	1.1.1.3.2.24
+++ ext/extmk.rb.in	1999/07/15 13:46:01
@@ -17,7 +17,7 @@ end
 SRC_EXT = ["c", "cc", "cxx", "C"]
 $extlist = []
 
-$cache_mod = FALSE;
+$cache_mod = false
 $lib_cache = {}
 $func_cache = {}
 $hdr_cache = {}
@@ -147,8 +147,9 @@ def try_run(src, opt="")
   end
 end
 
-def install_rb(mfile, srcdir)
-  libdir = srcdir + "/lib"
+def install_rb(mfile, srcdir = nil)
+  libdir = "lib"
+  libdir = srcdir + "/" + libdir if srcdir
   path = []
   dir = []
   Find.find(libdir) do |f|
@@ -354,7 +355,6 @@ DESTDIR = 
 
 CC = @CC@
 
-prefix = @prefix@
 CFLAGS   = %s -I$(topdir) -I$(hdrdir) -I@includedir@ #{CFLAGS} #$CFLAGS %s
 DLDFLAGS = #$DLDFLAGS #$LDFLAGS
 LDSHARED = @LDSHARED@ #{defflag}
@@ -401,7 +401,7 @@ binsuffix = @binsuffix@
 
 all:		$(DLLIB)
 
-clean:;		@rm -f *.o *.a *.so *.sl *.a
+clean:;		@rm -f *.o *.so *.sl *.a $(DLLIB)
 		@rm -f Makefile extconf.h conftest.*
 		@rm -f core ruby$(binsuffix) *~
 
@@ -424,7 +424,7 @@ EOS
   mfile.printf "\n"
 
   if $static
-      mfile.printf "\
+    mfile.printf "\
 $(DLLIB): $(OBJS)
 	@AR@ cru $(DLLIB) $(OBJS)
 	@-@RANLIB@ $(DLLIB) 2> /dev/null || true
@@ -462,7 +462,7 @@ $(DLLIB): $(OBJS)
     else
       deffilename = "ruby.def"
     end
-    print "creating ruby.def\n"
+    print "creating #{deffilename}\n"
     open(deffilename, "w") do |file|
       file.print("EXPORTS\n") if PLATFORM =~ /^i/
       file.print("Init_#{target}\n")
@@ -499,7 +499,7 @@ def extmake(target)
       if File.exist?("#{$top_srcdir}/ext/#{target}/extconf.rb")
 	load "#{$top_srcdir}/ext/#{target}/extconf.rb"
       else
-	create_makefile(target);
+	create_makefile(target)
       end
     end
     if File.exist?("./Makefile")
Index: instruby.rb
===================================================================
RCS file: /home/cvs/ruby/instruby.rb,v
retrieving revision 1.1.1.2.2.14
diff -u -p -r1.1.1.2.2.14 instruby.rb
--- instruby.rb	1999/06/24 04:23:55	1.1.1.2.2.14
+++ instruby.rb	1999/07/15 13:46:01
@@ -52,6 +52,10 @@ File.makedirs archdir, true
 File.makedirs pkglibdir+"/site_ruby", true
 File.makedirs pkglibdir+"/site_ruby/"+CONFIG["arch"], true
 
+if PLATFORM =~ /cygwin/ and File.exist? "import.h"
+  File.install "import.h", archdir, 0644, true
+end
+
 if PLATFORM =~ /-aix/
   File.install "ruby.imp", archdir, 0644, true
 end
Index: lib/mkmf.rb
===================================================================
RCS file: /home/cvs/ruby/lib/mkmf.rb,v
retrieving revision 1.1.1.2.2.20
diff -u -p -r1.1.1.2.2.20 mkmf.rb
--- lib/mkmf.rb	1999/07/15 07:59:58	1.1.1.2.2.20
+++ lib/mkmf.rb	1999/07/15 13:46:01
@@ -6,7 +6,7 @@ require 'find'
 
 include Config
 
-$found = false;
+$cache_mod = false
 $lib_cache = {}
 $lib_found = {}
 $func_cache = {}
@@ -55,7 +55,7 @@ CFLAGS = CONFIG["CFLAGS"]
 if PLATFORM == "m68k-human"
   CFLAGS.gsub!(/-c..-stack=[0-9]+ */, '')
 elsif PLATFORM =~ /-nextstep|-rhapsody/
-  CFLAGS.gsub!( /-arch\s\w*/, '' );
+  CFLAGS.gsub!( /-arch\s\w*/, '' )
 end
 if /win32|djgpp|mingw32|m68k-human|i386-os2_emx/i =~ PLATFORM
   $null = open("nul", "w")
@@ -100,7 +100,6 @@ def try_cpp(src, opt="")
   cfile.print src
   cfile.close
   begin
-
     xsystem(format(CPP, $CFLAGS, opt))
   ensure
     system "rm -f conftest*"
@@ -134,12 +133,14 @@ def try_run(src, opt="")
   end
 end
 
-def install_rb(mfile)
+def install_rb(mfile, srcdir = nil)
+  libdir = "lib"
+  libdir = srcdir + "/" + libdir if srcdir
   path = []
   dir = []
-  Find.find("lib") do |f|
+  Find.find(libdir) do |f|
     next unless /\.rb$/ =~ f
-    f = f[4..-1]
+    f = f[libdir.length+1..-1]
     path.push f
     dir |= File.dirname(f)
   end
@@ -171,13 +172,6 @@ def have_library(lib, func="main")
   end
 
   if func && func != ""
-    cfile = open("conftest.c", "w")
-    cfile.printf "\
-int main() { return 0; }
-int t() { %s(); return 0; }
-", func
-    cfile.close
-
     if $libs
       libs = "-l" + lib + " " + $libs 
     else
@@ -230,13 +224,13 @@ int main() { return 0; }
 int t() { #{func}(); return 0; }
 SRC
     $func_found[func] = 'no'
-    $found = TRUE
+    $cache_mod = true
     print "no\n"
     return FALSE
   end
   $defs.push(format("-DHAVE_%s", func.upcase))
   $func_found[func] = 'yes'
-  $found = TRUE
+  $cache_mod = true
   print "yes\n"
   return TRUE
 end
@@ -260,14 +254,14 @@ def have_header(header)
 #include <#{header}>
 SRC
     $hdr_found[header] = 'no'
-    $found = TRUE
+    $cache_mod = true
     print "no\n"
     return FALSE
   end
   $hdr_found[header] = 'yes'
   header.tr!("a-z./\055", "A-Z___")
   $defs.push(format("-DHAVE_%s", header))
-  $found = TRUE
+  $cache_mod = true
   print "yes\n"
   return TRUE
 end
@@ -337,6 +331,15 @@ def create_makefile(target)
     $DLDFLAGS = $DLDFLAGS + " -L" + CONFIG["prefix"] + "/lib"
   end
 
+  defflag = ''
+  if PLATFORM =~ /cygwin/
+    if File.exist? target + ".def"
+      defflag = "--def=" + target + ".def"
+    end
+    $libs = $libs + " " + CONFIG["LIBRUBYARG"]
+    $DLDFLAGS = $DLDFLAGS + " -L$(topdir)"
+  end
+
   unless $objs then
     $objs = Dir["*.{c,cc,m}"]
     for f in $objs
@@ -360,7 +363,7 @@ CC = #{CONFIG["CC"]}
 CFLAGS   = #{CONFIG["CCDLFLAGS"]} -I$(hdrdir) -I#{CONFIG["includedir"]} #{CFLAGS} #{$CFLAGS} #{$defs.join(" ")}
 CXXFLAGS = $(CFLAGS)
 DLDFLAGS = #{$DLDFLAGS} #{$LDFLAGS}
-LDSHARED = #{CONFIG["LDSHARED"]}
+LDSHARED = #{CONFIG["LDSHARED"]} #{defflag}
 
 prefix = #{CONFIG["prefix"]}
 exec_prefix = #{CONFIG["exec_prefix"]}
@@ -384,7 +387,7 @@ binsuffix = #{CONFIG["binsuffix"]}
 
 all:		$(DLLIB)
 
-clean:;		@rm -f *.o *.so *.sl *.a
+clean:;		@rm -f *.o *.so *.sl *.a $(DLLIB)
 		@rm -f Makefile extconf.h conftest.*
 		@rm -f core ruby$(binsuffix) *~
 
@@ -425,7 +428,7 @@ EOMF
   end
   mfile.close
 
-  if $found
+  if $cache_mod
     begin
       f = open($config_cache, "w")
       for k,v in $lib_cache
@@ -452,15 +455,20 @@ EOMF
   end
   
   if PLATFORM =~ /beos/
-    print "creating ruby.def\n"
-    open("ruby.def", "w") do |file|
+    if PLATFORM =~ /^powerpc/ then
+      deffilename = "ruby.exp"
+    else
+      deffilename = "ruby.def"
+    end
+    print "creating #{deffilename}\n"
+    open(deffilename, "w") do |file|
       file.print("EXPORTS\n") if PLATFORM =~ /^i/
       file.print("Init_#{target}\n")
     end
   end
 end
 
-$libs = PLATFORM =~ /cygwin32|beos|rhapsody|nextstep/ ? nil : "-lc"
+$libs = PLATFORM =~ /cygwin|beos|openstep|nextstep|rhapsody/ ? nil : "-lc"
 $objs = nil
 $LOCAL_LIBS = ""
 $CFLAGS = ""

--
小松克行 / Katsuyuki Komatsu <komatsu@sarion.co.jp>

In This Thread

Prev Next