mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v.pkgconfig: support PKG_CONFIG_PATH_DEFAULTS for overriding the default search path list too (enable easier -m32 with a custom tcc cross compiler)
This commit is contained in:
parent
1ba1f99b9c
commit
7c02274754
@ -224,21 +224,37 @@ fn (mut pc PkgConfig) load_require(dep string) ? {
|
||||
}
|
||||
|
||||
fn (mut pc PkgConfig) add_path(path string) {
|
||||
p := if path.ends_with('/') { path[0..path.len - 1] } else { path }
|
||||
if path == '' {
|
||||
return
|
||||
}
|
||||
p := path.trim_right('/')
|
||||
if !os.exists(p) {
|
||||
return
|
||||
}
|
||||
$if trace_pkgconfig_add_path ? {
|
||||
eprintln('> PkgConfig.add_path path: ${p}')
|
||||
}
|
||||
if pc.paths.index(p) == -1 {
|
||||
pc.paths << p
|
||||
}
|
||||
}
|
||||
|
||||
fn (mut pc PkgConfig) load_paths() {
|
||||
// Allow for full custom user control over the default paths too, through
|
||||
// setting `PKG_CONFIG_PATH_DEFAULTS` to a list of search paths, separated
|
||||
// by `:`.
|
||||
config_path_override := os.getenv('PKG_CONFIG_PATH_DEFAULTS')
|
||||
if config_path_override != '' {
|
||||
for path in config_path_override.split(':') {
|
||||
pc.add_path(path)
|
||||
}
|
||||
} else {
|
||||
if pc.options.use_default_paths {
|
||||
for path in pkgconfig.default_paths {
|
||||
pc.add_path(path)
|
||||
}
|
||||
}
|
||||
}
|
||||
for path in pc.options.path.split(':') {
|
||||
pc.add_path(path)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user