summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-01-09 02:20:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-01-09 02:20:28 +0000
commitbcdd892217f8dd600658a44d9c22f743ce051ab3 (patch)
tree1fdcebaa6bc742b88dcfda25ab8feea166c53a23
parent867ec3a778384176402975dbc1c51599ebc2ed77 (diff)
downloadruby-bcdd892217f8dd600658a44d9c22f743ce051ab3.tar.gz
ruby-bcdd892217f8dd600658a44d9c22f743ce051ab3.tar.xz
ruby-bcdd892217f8dd600658a44d9c22f743ce051ab3.zip
* ext/extmk.rb (extmake): should not reduce necessary libraries.
[ruby-dev:22440] * lib/mkmf.rb (merge_libs): merge libraries according to dependency. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--ext/extmk.rb2
-rw-r--r--lib/mkmf.rb15
3 files changed, 24 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 551f82545..6029212b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Fri Jan 9 11:20:24 2004 Siena. <siena@faculty.chiba-u.jp>
+
+ * ext/extmk.rb (extmake): should not reduce necessary libraries.
+ [ruby-dev:22440]
+
+ * lib/mkmf.rb (merge_libs): merge libraries according to
+ dependency.
+
Fri Jan 9 10:05:23 2004 Siena. <siena@faculty.chiba-u.jp>
* lib/mkmf.rb (libpathflag): use single quotes. [ruby-dev:22440]
diff --git a/ext/extmk.rb b/ext/extmk.rb
index 21d82ff32..04d559a54 100644
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -109,7 +109,7 @@ def extmake(target)
$extpath ||= []
$extflags += " " + $DLDFLAGS unless $DLDFLAGS.empty?
$extflags += " " + $LDFLAGS unless $LDFLAGS.empty?
- $extlibs |= $libs.split | $LOCAL_LIBS.split
+ $extlibs = merge_libs($extlibs, $libs.split, $LOCAL_LIBS.split)
$extpath |= $LIBPATH
end
ensure
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 17579ec01..ab1bea1b5 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -113,6 +113,21 @@ def modified?(target, times)
t if times.all? {|n| n <= t}
end
+def merge_libs(*libs)
+ libs.inject([]) do |x, y|
+ xy = x & y
+ xn = yn = 0
+ y.each_with_index do |v, yi|
+ if xy.include?(v)
+ xi = [x.index(v), xn].max()
+ x[xi, 1] = y[yn..yi]
+ xn, yn = xi + (yi - yn + 1), yi + 1
+ end
+ end
+ x.concat(y[yn..-1] || [])
+ end
+end
+
module Logging
@log = nil
@logfile = 'mkmf.log'