aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/os/mac/ruby_keg.rb
blob: 8f7b37419a515d53260f1d8e25f81a183c21ca7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require "vendor/macho/macho"

module RubyKeg
  def change_dylib_id(id, file)
    @require_install_name_tool = true
    puts "Changing dylib ID of #{file}\n  from #{file.dylib_id}\n    to #{id}" if ARGV.debug?
    MachO::Tools.change_dylib_id(file, id, :strict => false)
  rescue MachO::MachOError
    onoe <<-EOS.undent
      Failed changing dylib ID of #{file}
        from #{file.dylib_id}
          to #{id}
    EOS
    raise
  end

  def change_install_name(old, new, file)
    @require_install_name_tool = true
    puts "Changing install name in #{file}\n  from #{old}\n    to #{new}" if ARGV.debug?
    MachO::Tools.change_install_name(file, old, new, :strict => false)
  rescue MachO::MachOError
    onoe <<-EOS.undent
      Failed changing install name in #{file}
        from #{old}
          to #{new}
    EOS
    raise
  end

  def require_install_name_tool?
    !!@require_install_name_tool
  end
end