diff options
| author | Elliot Saba | 2013-12-04 22:37:58 -0600 | 
|---|---|---|
| committer | Jack Nagel | 2013-12-04 22:37:58 -0600 | 
| commit | ab29ca737944f0d67d00a8c0072bbe8504dd9001 (patch) | |
| tree | c4e4a14883b24c5a9604ebd59c556a539815c8d8 | |
| parent | 70dc0c52fb00a757b41ecb2edc7e7f2b7879074c (diff) | |
| download | homebrew-ab29ca737944f0d67d00a8c0072bbe8504dd9001.tar.bz2 | |
Relocate libtool (.la) files as well as pkgconfig (.pc)
Ignore quotes, just do a global substitution on cellar and prefix.
Closes #24894.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
| -rw-r--r-- | Library/Homebrew/keg_fix_install_names.rb | 35 | 
1 files changed, 18 insertions, 17 deletions
| diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb index 4fc4a7f49..99726166c 100644 --- a/Library/Homebrew/keg_fix_install_names.rb +++ b/Library/Homebrew/keg_fix_install_names.rb @@ -40,13 +40,13 @@ class Keg        end      end -    pkgconfig_files.each do |pcfile| -      pcfile.ensure_writable do -        pcfile.open('rb') do |f| +    (pkgconfig_files | libtool_files).each do |file| +      file.ensure_writable do +        file.open('rb') do |f|            s = f.read -          replace_pkgconfig_file_path(s, old_cellar, new_cellar) -          replace_pkgconfig_file_path(s, old_prefix, new_prefix) -          f.reopen(pcfile, 'wb') +          s.gsub!(old_cellar, new_cellar) +          s.gsub!(old_prefix, new_prefix) +          f.reopen(file, 'wb')            f.write(s)          end        end @@ -61,17 +61,6 @@ class Keg      install_name_tool("-change", old, new, file)    end -  # Given old == "/usr/local/Cellar" and new == "/opt/homebrew/Cellar", -  # then update lines of the form -  #   some_variable=/usr/local/Cellar/foo/1.0/lib -  # to -  #   some_variable="/opt/homebrew/Cellar/foo/1.0/lib" -  # and add quotes to protect against paths containing spaces. -  def replace_pkgconfig_file_path(s, old, new) -    return if old == new -    s.gsub!(%r[([\S]+)="?#{Regexp.escape(old)}(.*?)"?$], "\\1=\"#{new}\\2\"") -  end -    # Detects the C++ dynamic libraries in place, scanning the dynamic links    # of the files within the keg. This searches only libs contained within    # lib/, and ignores binaries and other mach-o objects @@ -198,4 +187,16 @@ class Keg      end      pkgconfig_files    end + +  def libtool_files +    libtool_files = [] + +    # find .la files, which are stored in lib/ +    la_dir = self/'lib' +    la_dir.find do |pn| +      next if pn.symlink? or pn.directory? or pn.extname.to_s != '.la' +      libtool_files << pn +    end +    libtool_files +  end  end | 
