class MiniPortile

def activate

def activate
  vars = {
    'PATH'          => File.join(port_path, 'bin'),
    'CPATH'         => include_path,
    'LIBRARY_PATH'  => lib_path,
  }.reject { |env, path| !File.directory?(path) }
  output "Activating #{@name} #{@version} (from #{port_path})..."
  vars.each do |var, path|
    full_path = native_path(path)
    # save current variable value
    old_value = ENV[var] || ''
    unless old_value.include?(full_path)
      ENV[var] = "#{full_path}#{File::PATH_SEPARATOR}#{old_value}"
    end
  end
  # rely on LDFLAGS when cross-compiling
  if File.exist?(lib_path) && (@host != @original_host)
    full_path = native_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