Flutter Engine
The Flutter Engine
Functions | Variables
pkg-config Namespace Reference

Functions

def SetConfigPath (options)
 
def GetPkgConfigPrefixToStrip (args)
 
def MatchesAnyRegexp (flag, list_of_regexps)
 
def RewritePath (path, strip_prefix, sysroot)
 

Variables

 parser = OptionParser()
 
 action
 
 dest
 
 type
 
 default
 
 options
 
 args
 
list strip_out = []
 
def prefix = GetPkgConfigPrefixToStrip(args)
 
 env
 
 libdir
 
 flag_string
 
 all_flags = flag_string.decode('utf-8').strip().split(' ')
 
 sysroot = options.sysroot
 
list includes = []
 
list cflags = []
 
list libs = []
 
list lib_dirs = []
 
list ldflags = []
 

Function Documentation

◆ GetPkgConfigPrefixToStrip()

def pkg-config.GetPkgConfigPrefixToStrip (   args)
Returns the prefix from pkg-config where packages are installed.
This returned prefix is the one that should be stripped from the beginning of
directory names to take into account sysroots.

Definition at line 69 of file pkg-config.py.

70 """Returns the prefix from pkg-config where packages are installed.
71 This returned prefix is the one that should be stripped from the beginning of
72 directory names to take into account sysroots."""
73 # Some sysroots, like the Chromium OS ones, may generate paths that are not
74 # relative to the sysroot. For example,
75 # /path/to/chroot/build/x86-generic/usr/lib/pkgconfig/pkg.pc may have all
76 # paths relative to /path/to/chroot (i.e. prefix=/build/x86-generic/usr)
77 # instead of relative to /path/to/chroot/build/x86-generic (i.e prefix=/usr).
78 # To support this correctly, it's necessary to extract the prefix to strip
79 # from pkg-config's |prefix| variable.
80 prefix = subprocess.check_output(
81 ["pkg-config", "--variable=prefix"] + args, env=os.environ)
82 if prefix[-4] == '/usr':
83 return prefix[4:]
84 return prefix
85
86
def GetPkgConfigPrefixToStrip(args)
Definition: pkg-config.py:69

◆ MatchesAnyRegexp()

def pkg-config.MatchesAnyRegexp (   flag,
  list_of_regexps 
)
Returns true if the first argument matches any regular expression in the
given list.

Definition at line 87 of file pkg-config.py.

87def MatchesAnyRegexp(flag, list_of_regexps):
88 """Returns true if the first argument matches any regular expression in the
89 given list."""
90 for regexp in list_of_regexps:
91 if regexp.search(flag) != None:
92 return True
93 return False
94
95
def MatchesAnyRegexp(flag, list_of_regexps)
Definition: pkg-config.py:87

◆ RewritePath()

def pkg-config.RewritePath (   path,
  strip_prefix,
  sysroot 
)
Rewrites a path by stripping the prefix and prepending the sysroot.

Definition at line 96 of file pkg-config.py.

96def RewritePath(path, strip_prefix, sysroot):
97 """Rewrites a path by stripping the prefix and prepending the sysroot."""
98 if os.path.isabs(path) and not path.startswith(sysroot):
99 if path.startswith(strip_prefix):
100 path = path[len(strip_prefix):]
101 path = path.lstrip('/')
102 return os.path.join(sysroot, path)
103 else:
104 return path
105
106
def RewritePath(path, strip_prefix, sysroot)
Definition: pkg-config.py:96

◆ SetConfigPath()

def pkg-config.SetConfigPath (   options)
Set the PKG_CONFIG_PATH environment variable.
This takes into account any sysroot and architecture specification from the
options on the given command line.

Definition at line 41 of file pkg-config.py.

41def SetConfigPath(options):
42 """Set the PKG_CONFIG_PATH environment variable.
43 This takes into account any sysroot and architecture specification from the
44 options on the given command line."""
45
46 sysroot = options.sysroot
47 if not sysroot:
48 sysroot = ""
49
50 # Compute the library path name based on the architecture.
51 arch = options.arch
52 if sysroot and not arch:
53 print("You must specify an architecture via -a if using a sysroot.")
54 sys.exit(1)
55 if arch == 'x64':
56 libpath = 'lib64'
57 else:
58 libpath = 'lib'
59
60 # Add the sysroot path to the environment's PKG_CONFIG_PATH
61 config_path = sysroot + '/usr/' + libpath + '/pkgconfig'
62 config_path += ':' + sysroot + '/usr/share/pkgconfig'
63 if 'PKG_CONFIG_PATH' in os.environ:
64 os.environ['PKG_CONFIG_PATH'] += ':' + config_path
65 else:
66 os.environ['PKG_CONFIG_PATH'] = config_path
67
68
def SetConfigPath(options)
Definition: pkg-config.py:41
def print(*args, **kwargs)
Definition: run_tests.py:49

Variable Documentation

◆ action

pkg-config.action

Definition at line 110 of file pkg-config.py.

◆ all_flags

pkg-config.all_flags = flag_string.decode('utf-8').strip().split(' ')

Definition at line 164 of file pkg-config.py.

◆ args

pkg-config.args

Definition at line 120 of file pkg-config.py.

◆ cflags

list pkg-config.cflags = []

Definition at line 174 of file pkg-config.py.

◆ default

pkg-config.default

Definition at line 113 of file pkg-config.py.

◆ dest

pkg-config.dest

Definition at line 111 of file pkg-config.py.

◆ env

pkg-config.env

Definition at line 140 of file pkg-config.py.

◆ flag_string

pkg-config.flag_string
Initial value:
1= subprocess.check_output(
2 [options.pkg_config, "--cflags", "--libs-only-l", "--libs-only-L"] +
3 args,
4 env=os.environ)

Definition at line 157 of file pkg-config.py.

◆ includes

list pkg-config.includes = []

Definition at line 173 of file pkg-config.py.

◆ ldflags

list pkg-config.ldflags = []

Definition at line 177 of file pkg-config.py.

◆ lib_dirs

list pkg-config.lib_dirs = []

Definition at line 176 of file pkg-config.py.

◆ libdir

pkg-config.libdir
Initial value:
1= subprocess.check_output(
2 [options.pkg_config, "--variable=libdir"] + args, env=os.environ)

Definition at line 148 of file pkg-config.py.

◆ libs

list pkg-config.libs = []

Definition at line 175 of file pkg-config.py.

◆ options

pkg-config.options

Definition at line 120 of file pkg-config.py.

◆ parser

pkg-config.parser = OptionParser()

Definition at line 107 of file pkg-config.py.

◆ prefix

string pkg-config.prefix = GetPkgConfigPrefixToStrip(args)

Definition at line 130 of file pkg-config.py.

◆ strip_out

list pkg-config.strip_out = []

Definition at line 123 of file pkg-config.py.

◆ sysroot

string pkg-config.sysroot = options.sysroot

Definition at line 169 of file pkg-config.py.

◆ type

pkg-config.type

Definition at line 112 of file pkg-config.py.