[26523] users/pipping/merge.rb
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jun 27 11:55:46 PDT 2007
Revision: 26523
http://trac.macosforge.org/projects/macports/changeset/26523
Author: pipping at macports.org
Date: 2007-06-27 11:55:46 -0700 (Wed, 27 Jun 2007)
Log Message:
-----------
improve algorithm for generating lists of linked libraries
add meaningful whitelist
remove todos
Modified Paths:
--------------
users/pipping/merge.rb
Modified: users/pipping/merge.rb
===================================================================
--- users/pipping/merge.rb 2007-06-27 18:28:46 UTC (rev 26522)
+++ users/pipping/merge.rb 2007-06-27 18:55:46 UTC (rev 26523)
@@ -28,10 +28,6 @@
###
# we need GNU file with Apple's patches applied, available here:
# http://www.opensource.apple.com/darwinsource/Current/file-6.2/patches/
-#
-# Its output might span multiple lines, causing problems when parsing, even
-# with `file -b`, hence we'll assume we're not passed universal binaries
-# TODO: do a real check, maybe using `lipo -info` (fails on non-Mach-O files)
FILE="/usr/bin/file"
class MergeArguments < Hash
@@ -89,7 +85,7 @@
arguments = MergeArguments.new(ARGV)
-# prevent duplicates and trailing backslashes
+# prevent duplicates and trailing slashes
ARGS=ARGV.collect {|arg| arg.chomp('/')}.uniq
def true_for_all? (filepath, args, &block)
@@ -177,7 +173,7 @@
case File.basename path
# TODO: more cases
when /\.h$/, /\.hpp$/
- # TODO: deal with header file
+ # TODO: deal with header files
else
file_output = %x{#{FILE} -b "#{File.join(arguments[:root],ARGS[0],path)}"}.chomp
case file_output
@@ -204,10 +200,24 @@
}
links=Hash.new
ARGS.each {|my_arch|
- links[my_arch]=%x{#{'otool'} -arch #{my_arch} -LX #{File.join(arguments[:root],my_arch,path)}}.split("\n").collect {|x| x.lstrip}.to_set
+ links[my_arch]=%x{
+ #{'otool'} -arch #{my_arch} -LX #{
+ File.join(arguments[:root],my_arch,path)}
+ }.split("\n").collect {|x|
+ x.lstrip.gsub(
+ / \(compatibility version \d+(\.\d+)*, current version \d+(\.\d+)*\)/, ''
+ )
+ }.to_set
}
- # TODO: dummy whitelist only! (64bit needs to be tested here)
- whitelist=%w{/usr/lib/libSystem.B.dylib}
+ whitelist=%w{
+ /usr/lib/libgcc_s.1.dylib
+ /usr/lib/libmx.A.dylib
+ /usr/lib/libmx.A_debug.dylib
+ /usr/lib/libmx.A_profile.dylib
+ /usr/lib/libstdc++.6.dylib
+ /usr/lib/libSystem.B.dylib
+ /usr/lib/system/libmathCommon.A.dylib
+ }
ARGS.each {|my_arch|
unless links[my_arch] == links[ARGS[0]]
missing_in = (links[my_arch]-links[ARGS[0]] - whitelist)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070627/2cd851a5/attachment.html
More information about the macports-changes
mailing list