class Neutron::PkgConf
Attributes
packages[R]
Public Class Methods
new(packages)
click to toggle source
# File lib/neutron/pkgconf.rb, line 8 def initialize(packages) @packages = packages @packages.freeze found = [] checked = Neutron::PkgStatus.get_checked begin (packages-checked).each do |package| _, code = *Neutron.execute("pkg-config --exists #{package}") if code == 0 found << package else raise Neutron::PkgStatus::PkgNotFoundError, "Cannot find #{package}!" end end rescue Neutron::PkgStatus::PkgNotFoundError self.taint raise ensure Neutron::PkgStatus.add_found(found) end freeze end
Public Instance Methods
+(target)
click to toggle source
# File lib/neutron/pkgconf.rb, line 31 def +(target) raise InvalidPkgConfError, 'Current pkg-conf is invalid!' if tainted? raise InvalidPkgConfError, 'Target pkg-conf is invalid!' if target.tainted? Neutron::PkgConf.new((@packages+target.packages).uniq) end
to_cc(**opts)
click to toggle source
# File lib/neutron/pkgconf.rb, line 37 def to_cc(**opts) raise InvalidPkgConfError if tainted? o = { libs: true, cflags: true }.merge(opts) Neutron.execute("pkg-config #{"--libs" if o[:libs]} #{"--cflags" if o[:cflags]} #{@packages.join(' ')}")[0].strip end
to_valac()
click to toggle source
# File lib/neutron/pkgconf.rb, line 46 def to_valac raise InvalidPkgConfError if tainted? @packages.map{|p|"--pkg #{p}"}.join(' ') end