From 5cd5d551e3d0fdf4e47a854ec1c956275763947d Mon Sep 17 00:00:00 2001 From: Dialga Date: Thu, 23 Jun 2022 07:38:50 +1200 Subject: [PATCH] v.pkgconfig: fix building standalone pkgconfig (#14825) * Update main.v * add test to prevent future regressions Co-authored-by: Delyan Angelov --- vlib/v/pkgconfig/bin/pkgconfig_test.v | 17 +++++++++++++++++ vlib/v/pkgconfig/main.v | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 vlib/v/pkgconfig/bin/pkgconfig_test.v diff --git a/vlib/v/pkgconfig/bin/pkgconfig_test.v b/vlib/v/pkgconfig/bin/pkgconfig_test.v new file mode 100644 index 0000000000..d0c4e9f5c2 --- /dev/null +++ b/vlib/v/pkgconfig/bin/pkgconfig_test.v @@ -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)? +} diff --git a/vlib/v/pkgconfig/main.v b/vlib/v/pkgconfig/main.v index 0064536746..e3ff155139 100644 --- a/vlib/v/pkgconfig/main.v +++ b/vlib/v/pkgconfig/main.v @@ -3,7 +3,7 @@ module pkgconfig import flag import strings -struct Main { +pub struct Main { pub mut: opt &MainOptions res string