diff --git a/lib/mini_portile2/mini_portile.rb b/lib/mini_portile2/mini_portile.rb index 4a30181..7743984 100644 --- a/lib/mini_portile2/mini_portile.rb +++ b/lib/mini_portile2/mini_portile.rb @@ -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