Bug #3238
closedcross-compiling ext/tk
Description
=begin
なかだです。
クロスコンパイルのときにext/tk/extconf.rbが適切なディレクトリを
探していません。また、is_win32?のときに同じディレクトリを、与え
られたパス自体と\を/に置換したものとドライブレターの直後の/を二
重にしたものとと、各3回ずつ探しているようなんですが、これはなぜ
でしょうか。とくに最後のものはドライブレターがない場合はUNCになっ
てしまうので意味が変わってしまうと思います。
diff --git i/ext/tk/extconf.rb w/ext/tk/extconf.rb
index 676c132..a8adac2 100644
--- i/ext/tk/extconf.rb
+++ w/ext/tk/extconf.rb
@@ -193,5 +193,6 @@ def get_shlib_path_head
end
- if is_win32?
- if CROSS_COMPILING
- elsif is_win32?
drive, drv_regexp = win_drive
if TkLib_Config["ActiveTcl"]
@@ -422,5 +423,6 @@ def get_tclConfig_dirs
config_dir = []
- if is_win32?
- if CROSS_COMPILING
- elsif is_win32?
drive, drv_regexp = win_drive
if TkLib_Config["ActiveTcl"]
@@ -559,5 +561,6 @@ def search_tclConfig(*paths) # libdir list or [tcl-libdir|file, tk-libdir|file]
conf = nil
- (config_dir | config_dir).map{|dir|
- config_dir.uniq!
- config_dir.map{|dir|
if dir.kind_of? Array
[dir[0].strip.chomp('/'), dir[1].strip.chomp('/')]
@@ -603,5 +606,5 @@ def search_tclConfig(*paths) # libdir list or [tcl-libdir|file, tk-libdir|file]
# nativethread check
if !TkLib_Config["ruby_with_thread"] && tclconf['TCL_THREADS'] == '1'
@@ -648,5 +651,5 @@ def search_tclConfig(*paths) # libdir list or [tcl-libdir|file, tk-libdir|file]
@@ -788,17 +791,15 @@ def check_shlib_search_path(paths)
- path_list.map!{|path| path.strip}
- if is_win32?
- if !CROSS_COMPILING and is_win32?
exist-dir only¶
drive, drv_regexp = win_drive
- path_list.each{|path|
- }
- else
-
keep paths for searching dynamic libs¶
- path_list.each{|path| $LIBPATH |= [path.strip] }
- path_list.map!{|path| path.sub(%r|^(#{drv_regexp})?//|, '\1/')}
- path_list.delete_if{|path| Dir.glob(File.join(path, "*.{a,so,dll,lib}")).empty?}
end -
keep paths for searching dynamic libs¶
- $LIBPATH |= path_list
end
@@ -842,5 +843,5 @@ def find_tcl(tcllib, stubs, version, *opt_paths)
File.join(RbConfig::CONFIG['prefix'], 'lib'),
"/usr/local/lib", "/usr/pkg/lib", "/usr/contrib/lib", "/usr/lib"
- ].find_all{|dir| File.directory?(dir)}
-
].find_all{|dir| File.directory?(dir)} unless CROSS_COMPILING
if TkLib_Config["ActiveTcl"].kind_of?(String) # glob path
@@ -848,5 +849,5 @@ def find_tcl(tcllib, stubs, version, *opt_paths)
end
- if is_win32?
- if !CROSS_COMPILING and is_win32?
drive, drv_regexp = win_drive
if TkLib_Config["ActiveTcl"]
@@ -874,34 +875,22 @@ def find_tcl(tcllib, stubs, version, *opt_paths)
end
- env_paths = []
- ENV['PATH'].split(File::PATH_SEPARATOR).each{|dir|
- env_paths << File.expand_path(File.join(dir, '..', 'lib'))
- env_paths << dir
- env_paths << File.expand_path(File.join(dir, '..'))
- if is_win32?
- unless CROSS_COMPILING
- env_paths = []
- ENV['PATH'].split(File::PATH_SEPARATOR).each{|dir|
- }
- if File::ALT_SEPARATOR
- end
-
}
-
if is_win32?
-
env_paths = env_paths.find_all{|d|
-
}
-
else
-
env_paths = env_paths.find_all{|d|
- env_paths.delete_if{|d|
- }
-
end
-
default_paths.concat env_paths
-
default_paths.concat env_paths
-
end
default_paths |= default_paths
@@ -1010,5 +999,5 @@ def find_tk(tklib, stubs, version, *opt_paths)
File.join(RbConfig::CONFIG['prefix'], 'lib'),
"/usr/local/lib", "/usr/pkg/lib", "/usr/contrib/lib", "/usr/lib"
- ].find_all{|dir| File.directory?(dir)}
-
].find_all{|dir| File.directory?(dir)} unless CROSS_COMPILING
if TkLib_Config["ActiveTcl"].kind_of?(String) # glob path
@@ -1016,5 +1005,5 @@ def find_tk(tklib, stubs, version, *opt_paths)
end
- if is_win32?
- if !CROSS_COMPILING and is_win32?
drive, drv_regexp = win_drive
if TkLib_Config["ActiveTcl"]
@@ -1042,34 +1031,22 @@ def find_tk(tklib, stubs, version, *opt_paths)
end
- env_paths = []
- ENV['PATH'].split(File::PATH_SEPARATOR).each{|dir|
- env_paths << File.expand_path(File.join(dir, '..', 'lib'))
- env_paths << dir
- env_paths << File.expand_path(File.join(dir, '..'))
- if is_win32?
- unless CROSS_COMPILING
- env_paths = []
- ENV['PATH'].split(File::PATH_SEPARATOR).each{|dir|
- }
- if File::ALT_SEPARATOR
- end
-
}
-
if is_win32?
-
env_paths = env_paths.find_all{|d|
-
}
-
else
-
env_paths = env_paths.find_all{|d|
- env_paths.delete_if{|d|
- }
-
end
-
default_paths.concat env_paths
-
default_paths.concat env_paths
-
end
default_paths |= default_paths
@@ -1166,5 +1143,5 @@ def find_tcltk_header(tclver, tkver)
end
- if is_win32?
- if !CROSS_COMPILING && is_win32?
drive, drv_regexp = win_drive
if TkLib_Config["ActiveTcl"]
@@ -1199,15 +1176,9 @@ def find_tcltk_header(tclver, tkver)
base_dir << dir
base_dir << File.expand_path(File.join(dir, '..'))
- }
- if File::ALT_SEPARATOR
- end
end
--
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
中田 伸悦
=end