v.pkgconfig: fix building standalone pkgconfig (#14825)

* Update main.v

* add test to prevent future regressions

Co-authored-by: Delyan Angelov <delian66@gmail.com>
master
Dialga 2022-06-23 07:38:50 +12:00 committed by GitHub
parent c9ab086029
commit 5cd5d551e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -0,0 +1,17 @@
import os
const vexe = os.getenv('VEXE')
const vroot = os.dir(vexe)
fn test_pkgconfig_can_be_compiled() ? {
tmp_exe := os.join_path(os.temp_dir(), '${os.getpid()}_pkgconfig.exe')
pkgconfig_v_file := os.real_path(os.join_path(vroot, 'vlib/v/pkgconfig/bin/pkgconfig.v'))
assert !os.exists(tmp_exe)
res := os.system('${os.quoted_path(vexe)} -o ${os.quoted_path(tmp_exe)} ${os.quoted_path(pkgconfig_v_file)}')
if res != 0 {
assert false
}
assert os.exists(tmp_exe)
os.rm(tmp_exe)?
}

View File

@ -3,7 +3,7 @@ module pkgconfig
import flag import flag
import strings import strings
struct Main { pub struct Main {
pub mut: pub mut:
opt &MainOptions opt &MainOptions
res string res string