Skip to content

Commit bb89ce4

Browse files
authored
fix-machos.rb handling of bare lib names (#171)
* fix-machos.rb handle bare lib names * add boost.org to ci
1 parent 886fddd commit bb89ce4

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- c-ares.org
2020
- vim.org
2121
- tea.xyz/gx/cc
22+
- boost.org
2223
# FIXME? requires a darwin platform to run, and needs
2324
# macOS 12 to test. That'll require a more complex matrix
2425
# using get-platform.

share/brewkit/fix-machos.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,8 @@ def bad_install_names
164164
end
165165
elsif lib.start_with? '@rpath'
166166
path = Pathname.new(lib.sub(%r{^@rpath}, $tea_prefix))
167-
if path.exist?
168-
lib
169-
else
170-
puts "warn:#{@file.filename}:#{lib}"
171-
end
167+
puts "warn:#{@file.filename}:#{lib}" unless path.exist?
168+
lib
172169
elsif lib.start_with? '@'
173170
puts "warn:#{@file.filename}:#{lib}"
174171
# noop
@@ -201,7 +198,13 @@ def fix_tea_prefix s
201198
s = s.relative_path_from(Pathname.new($tea_prefix))
202199
s = s.sub(%r{/v(\d+)\.(\d+\.)+\d+[a-z]?/}, '/v\1/')
203200

204-
abort "#{s} doesn’t exist!" unless File.exist?(File.join($tea_prefix, s))
201+
# Some libs, like boost, have @rpath/filename.dylib. They lose the subpath.
202+
# We can fix this.
203+
if !File.exist?(File.join($tea_prefix, s))
204+
lib = Pathname.new(@file.filename).parent.join(Pathname.new(s).basename)
205+
abort "#{s} doesn’t exist!" unless lib.exist?
206+
s = lib.relative_path_from(Pathname.new($tea_prefix))
207+
end
205208

206209
s = "@rpath/#{s}"
207210

0 commit comments

Comments
 (0)