Skip to content

Commit

Permalink
fix: include the recipe's lib path in $LDFLAGS
Browse files Browse the repository at this point in the history
Fixes #118
  • Loading branch information
flavorjones committed Sep 9, 2023
1 parent dbbeb23 commit 491e0d7
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions lib/mini_portile2/mini_portile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,26 @@ def activate
end
end

# rely on LDFLAGS when cross-compiling
if File.exist?(lib_path) && (@host != @original_host)
full_path = File.expand_path(lib_path)
if File.exist?(lib_path)
# rely on LDFLAGS when cross-compiling
if (@host != @original_host)
full_path = File.expand_path(lib_path)

old_value = ENV.fetch("LDFLAGS", "")
old_value = ENV.fetch("LDFLAGS", "")

unless old_value.include?(full_path)
ENV["LDFLAGS"] = "-L#{full_path} #{old_value}".strip
unless old_value.include?(full_path)
ENV["LDFLAGS"] = "-L#{full_path} #{old_value}".strip
end
end

# if we're in an extconf (mkmf.rb sets $LDFLAGS), append the library path. this works around
# an issue with fedora's pkgconf as detailed in:
#
# https://github.com/flavorjones/mini_portile/issues/118
#
flag = "-L#{lib_path}"
if $LDFLAGS && !$LDFLAGS.split.include?(flag)
$LDFLAGS << " #{flag}"
end
end
end
Expand Down

0 comments on commit 491e0d7

Please sign in to comment.