Browse files

Make ruby_deploy check the entire embedded framework

And also improve the output, when an offending bundle is found only the potentially
bad linked libraries are listed.
  • Loading branch information...
1 parent 8b4d3bd commit 8c90461a361b08cb5f00c40f89b6071e35bc923e @ferrous26 ferrous26 committed Jun 21, 2011
Showing with 18 additions and 7 deletions.
  1. +18 −7 bin/ruby_deploy
View
25 bin/ruby_deploy
@@ -241,13 +241,6 @@ class Deployer
mkdir_p(gems_libdirs_dest)
gems_libdirs_to_embed.each do |libdir|
execute("/usr/bin/ditto \"#{libdir}\" \"#{gems_libdirs_dest}\"")
- Dir.glob(File.join(libdir, '**', '*.bundle')).each do |file|
- linked_libs = execute("/usr/bin/otool -L #{file}")
- if linked_libs.include?('/opt') || linked_libs.include?('/usr/local')
- warn "'#{File.basename(file)}' is linked against libraries that are not standard to Mac OS X"
- warn linked_libs
- end
- end
end
end
@@ -262,6 +255,7 @@ class Deployer
# Wait with fixing install name until all binaries are available.
fix_install_name
+ check_linked_bundles
end
# Hack the application binaries to link against the MacRuby.framework copy.
@@ -284,6 +278,23 @@ class Deployer
end
end
+ def check_linked_bundles
+ dirs = [%r{^/opt}, %r{^/usr/local/lib}, %r{^/Users}, %r{^/Library}]
+ Dir.glob(File.join(app_macruby, '**', '*.bundle')).each do |bundle|
+ libs = execute("/usr/bin/otool -L #{bundle}").split("\n").map(&:strip)
+ libs[1..-1].each do |lib|
+ bad_libs = dirs.map { |dir| lib.match(dir) ? lib : nil }.compact
+ next if bad_libs.empty?
+ name = File.basename(bundle)
+ warn '******WARNING******'
+ warn "'#{name}' is linked against libraries that are not standard to Mac OS X"
+ warn "#{bundle}\n links against:"
+ bad_libs.each { |lib| warn "\t#{lib}" }
+ warn '******WARNING******'
+ end
+ end
+ end
+
def execute(line, error_message = nil)
$stdout.puts(line) if @verbose
ret = `#{line}`

0 comments on commit 8c90461

Please sign in to comment.