Relocate libtool (.la) files as well as pkgconfig (.pc)
Ignore quotes, just do a global substitution on cellar and prefix. Closes Homebrew/homebrew#24894. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
0daa33668b
commit
3d76a2c8df
@ -40,13 +40,13 @@ class Keg
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
pkgconfig_files.each do |pcfile|
|
(pkgconfig_files | libtool_files).each do |file|
|
||||||
pcfile.ensure_writable do
|
file.ensure_writable do
|
||||||
pcfile.open('rb') do |f|
|
file.open('rb') do |f|
|
||||||
s = f.read
|
s = f.read
|
||||||
replace_pkgconfig_file_path(s, old_cellar, new_cellar)
|
s.gsub!(old_cellar, new_cellar)
|
||||||
replace_pkgconfig_file_path(s, old_prefix, new_prefix)
|
s.gsub!(old_prefix, new_prefix)
|
||||||
f.reopen(pcfile, 'wb')
|
f.reopen(file, 'wb')
|
||||||
f.write(s)
|
f.write(s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -61,17 +61,6 @@ class Keg
|
|||||||
install_name_tool("-change", old, new, file)
|
install_name_tool("-change", old, new, file)
|
||||||
end
|
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
|
# Detects the C++ dynamic libraries in place, scanning the dynamic links
|
||||||
# of the files within the keg. This searches only libs contained within
|
# of the files within the keg. This searches only libs contained within
|
||||||
# lib/, and ignores binaries and other mach-o objects
|
# lib/, and ignores binaries and other mach-o objects
|
||||||
@ -198,4 +187,16 @@ class Keg
|
|||||||
end
|
end
|
||||||
pkgconfig_files
|
pkgconfig_files
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user