def activate
lib_path = File.join(port_path, "lib")
vars = {
'PATH' => File.join(port_path, 'bin'),
'CPATH' => File.join(port_path, 'include'),
'LIBRARY_PATH' => lib_path
}.reject { |env, path| !File.directory?(path) }
output "Activating #{@name} #{@version} (from #{port_path})..."
vars.each do |var, path|
full_path = File.expand_path(path)
full_path.gsub!(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR
old_value = ENV[var] || ''
unless old_value.include?(full_path)
ENV[var] = "#{full_path}#{File::PATH_SEPARATOR}#{old_value}"
end
end
if File.exist?(lib_path) && (@host != @original_host)
full_path = File.expand_path(lib_path)
old_value = ENV.fetch("LDFLAGS", "")
unless old_value.include?(full_path)
ENV["LDFLAGS"] = "-L#{full_path} #{old_value}".strip
end
end
end