From 073ab61060beeb65a9c3ca4d663b38ea6be78620 Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Mon, 11 Nov 2024 04:05:59 +0100 Subject: [PATCH] fix: update build on windows; update path in ci --- curl/build.vsh | 21 +++++++++++++++++---- curl/lib.v | 8 ++++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/curl/build.vsh b/curl/build.vsh index 8c2a11f..689a3db 100755 --- a/curl/build.vsh +++ b/curl/build.vsh @@ -46,8 +46,7 @@ fn setup(silent bool) ! { if !silent { spawn spinner(s) } - // execute('./configure --with-openssl --disable-shared') - execute('./configure --with-openssl') + execute('./configure --with-openssl --disable-static') s <- true } time.sleep(100 * time.millisecond) @@ -98,7 +97,7 @@ fn setup_windows(silent bool) ! { mkdir(dst_dir)! execute_opt('powershell -command Expand-Archive -LiteralPath ${curl_mod_dir}/${dl_archive} -DestinationPath ${curl_mod_dir}')! mv('${extracted_dir}/include', '${dst_dir}/include')! - mv('${extracted_dir}/bin/libcurl-x64.dll', '${dst_dir}/libcurl.dll')! + mv('${extracted_dir}/bin/', '${dst_dir}/bin/')! rmdir_all(extracted_dir) or {} s <- true } @@ -148,7 +147,21 @@ mut cmd := cli.Command{ // TODO: build in temp then remove old and move new from temp. rmdir_all(dst_dir) or {} // Remove old library files. silent := cmd.flags.get_bool('silent')! - $if windows { setup_windows(silent)! } $else { setup(silent)! } + $if windows { + setup_windows(silent)! + defer { + println('\nOn Windows, libcurl requires access to a compatible curl.exe.') + println('A reliable way is to use the curl.exe that is shipped with every libcurl version.') + println("Add '${curl_mod_dir.replace('/', os.path_separator)}\\libcurl\\bin' to your PATH to make it accessible.") + if getenv('CI') != '' { + // For now, don't automatically update PATH outside of CI, as it's + // easily corrupted and might cause annoyances on a users machine. + system('setx PATH "%PATH%;C:\\${vmodules_dir()}\\vibe\\curl\\libcurl\\bin"') + } + } + } $else { + setup(silent)! + } println('\rFinished!') } } diff --git a/curl/lib.v b/curl/lib.v index 2e193ca..d892307 100644 --- a/curl/lib.v +++ b/curl/lib.v @@ -9,10 +9,14 @@ import instructions import state #flag -I@VMODROOT/curl/libcurl/include -#flag -L@VMODROOT/curl/libcurl -#flag windows @VMODROOT/curl/libcurl/libcurl.dll #include "curl/curl.h" +#flag windows @VMODROOT/curl/libcurl/bin/libcurl-x64.dll +$if !windows { + #flag -L@VMODROOT/curl/libcurl + #flag -lcurl +} + pub type Handle = C.CURL pub type LinkedList = C.curl_slist