mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
v.pkgconfig: fix parser, when includedir= lines, had trailing spaces (fix -d use_openssl
for openssl 3.3.2 installed through brew on macos)
This commit is contained in:
parent
0fb95a8ff8
commit
65e2834347
3 changed files with 26 additions and 2 deletions
|
@ -3,6 +3,8 @@ module pkgconfig
|
||||||
import semver
|
import semver
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
const version = '0.3.4'
|
||||||
|
|
||||||
const default_paths = [
|
const default_paths = [
|
||||||
'/usr/local/lib/x86_64-linux-gnu/pkgconfig',
|
'/usr/local/lib/x86_64-linux-gnu/pkgconfig',
|
||||||
'/usr/local/lib64/pkgconfig',
|
'/usr/local/lib64/pkgconfig',
|
||||||
|
@ -18,7 +20,6 @@ const default_paths = [
|
||||||
'/usr/libdata/pkgconfig', // FreeBSD
|
'/usr/libdata/pkgconfig', // FreeBSD
|
||||||
'/usr/lib/i386-linux-gnu/pkgconfig', // Debian 32bit
|
'/usr/lib/i386-linux-gnu/pkgconfig', // Debian 32bit
|
||||||
]
|
]
|
||||||
const version = '0.3.3'
|
|
||||||
|
|
||||||
pub struct Options {
|
pub struct Options {
|
||||||
pub:
|
pub:
|
||||||
|
@ -31,6 +32,7 @@ pub:
|
||||||
|
|
||||||
pub struct PkgConfig {
|
pub struct PkgConfig {
|
||||||
pub mut:
|
pub mut:
|
||||||
|
file_path string
|
||||||
options Options
|
options Options
|
||||||
name string
|
name string
|
||||||
modname string
|
modname string
|
||||||
|
@ -92,6 +94,7 @@ fn (mut pc PkgConfig) setvar(line string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (mut pc PkgConfig) parse(file string) bool {
|
fn (mut pc PkgConfig) parse(file string) bool {
|
||||||
|
pc.file_path = file
|
||||||
data := os.read_file(file) or { return false }
|
data := os.read_file(file) or { return false }
|
||||||
if pc.options.debug {
|
if pc.options.debug {
|
||||||
eprintln(data)
|
eprintln(data)
|
||||||
|
@ -105,7 +108,8 @@ fn (mut pc PkgConfig) parse(file string) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for line in lines {
|
for oline in lines {
|
||||||
|
line := oline.trim_space()
|
||||||
if line.starts_with('#') {
|
if line.starts_with('#') {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,5 +88,13 @@ fn test_samples() {
|
||||||
assert x.version == '2.64.3'
|
assert x.version == '2.64.3'
|
||||||
assert x.conflicts == []
|
assert x.conflicts == []
|
||||||
}
|
}
|
||||||
|
if x.name == 'OpenSSL' {
|
||||||
|
assert x.modname == 'openssl-3.3.2'
|
||||||
|
assert x.version == '3.3.2'
|
||||||
|
assert x.description == 'Secure Sockets Layer and cryptography libraries and tools'
|
||||||
|
assert x.vars['prefix'] == '/opt/homebrew/Cellar/openssl@3/3.3.2'
|
||||||
|
assert x.vars['libdir'] == '/opt/homebrew/Cellar/openssl@3/3.3.2/lib'
|
||||||
|
assert x.vars['includedir'] == '/opt/homebrew/Cellar/openssl@3/3.3.2/include'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
vlib/v/pkgconfig/test_samples/openssl-3.3.2.pc
Normal file
12
vlib/v/pkgconfig/test_samples/openssl-3.3.2.pc
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
## NOTE: this file has a space at the end of the includedir line. It is *deliberate*!
|
||||||
|
## That version with the space, was present in homebrew, and failed V compilations with `-d use_openssl` on macos.
|
||||||
|
## This .pc file is here, to prevent silent regressions for future cases like this.
|
||||||
|
prefix=/opt/homebrew/Cellar/openssl@3/3.3.2
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
libdir=${exec_prefix}/lib
|
||||||
|
includedir=${prefix}/include
|
||||||
|
|
||||||
|
Name: OpenSSL
|
||||||
|
Description: Secure Sockets Layer and cryptography libraries and tools
|
||||||
|
Version: 3.3.2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue