class PackageConfig

Constants

IDENTIFIER_RE
SEPARATOR

Attributes

msvc_syntax[RW]
paths[R]

Public Class Methods

clear_configure_args_cache() click to toggle source
# File lib/pkg-config.rb, line 43
def clear_configure_args_cache
  @native_pkg_config = nil
  @custom_override_variables = nil
end
custom_override_variables() click to toggle source
# File lib/pkg-config.rb, line 39
def custom_override_variables
  @custom_override_variables ||= with_config("override-variables", "")
end
native_pkg_config() click to toggle source
# File lib/pkg-config.rb, line 34
def native_pkg_config
  @native_pkg_config ||= guess_native_pkg_config
end
new(name, options={}) click to toggle source
# File lib/pkg-config.rb, line 106
def initialize(name, options={})
  @name = name
  @options = options
  path = @options[:path] || ENV["PKG_CONFIG_PATH"]
  @paths = [path, guess_default_path].compact.join(SEPARATOR).split(SEPARATOR)
  @paths.unshift(*(@options[:paths] || []))
  @paths = normalize_paths(@paths)
  @msvc_syntax = @options[:msvc_syntax]
  @variables = @declarations = nil
  override_variables = self.class.custom_override_variables
  @override_variables = parse_override_variables(override_variables)
  default_override_variables = @options[:override_variables] || {}
  @override_variables = default_override_variables.merge(@override_variables)
end

Public Instance Methods

cflags() click to toggle source
# File lib/pkg-config.rb, line 133
def cflags
  path_flags, other_flags = collect_cflags
  (other_flags + path_flags).join(" ")
end
cflags_only_I() click to toggle source
# File lib/pkg-config.rb, line 138
def cflags_only_I
  collect_cflags[0].join(" ")
end
declaration(name) click to toggle source
# File lib/pkg-config.rb, line 180
def declaration(name)
  parse_pc if @declarations.nil?
  expand_value(@declarations[name])
end
description() click to toggle source
# File lib/pkg-config.rb, line 171
def description
  declaration("Description")
end
exist?() click to toggle source
# File lib/pkg-config.rb, line 121
def exist?
  not pc_path.nil?
end
libs() click to toggle source
# File lib/pkg-config.rb, line 142
def libs
  path_flags, other_flags = collect_libs
  (path_flags + other_flags).join(" ")
end
libs_only_L() click to toggle source
# File lib/pkg-config.rb, line 157
def libs_only_L
  collect_libs[0].find_all do |arg|
    if @msvc_syntax
      %r\A\/libpath:/ =~ arg
    else
      %r\A-L/ =~ arg
    end
  end.join(" ")
end
libs_only_l() click to toggle source
# File lib/pkg-config.rb, line 147
def libs_only_l
  collect_libs[1].find_all do |arg|
    if @msvc_syntax
      %r\.lib\z/ =~ arg
    else
      %r\A-l/ =~ arg
    end
  end.join(" ")
end
pc_path() click to toggle source
# File lib/pkg-config.rb, line 185
def pc_path
  @paths.each do |path|
    _pc_path = File.join(path, "#{@name}.pc")
    return _pc_path if File.exist?(_pc_path)
  end
  nil
end
requires() click to toggle source
# File lib/pkg-config.rb, line 125
def requires
  parse_requires(declaration("Requires"))
end
requires_private() click to toggle source
# File lib/pkg-config.rb, line 129
def requires_private
  parse_requires(declaration("Requires.private"))
end
variable(name) click to toggle source
# File lib/pkg-config.rb, line 175
def variable(name)
  parse_pc if @variables.nil?
  expand_value(@override_variables[name] || @variables[name])
end
version() click to toggle source
# File lib/pkg-config.rb, line 167
def version
  declaration("Version")
end