Skip to content

Commit

Permalink
fix: update build on windows; update path in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Nov 11, 2024
1 parent 1715088 commit 073ab61
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
21 changes: 17 additions & 4 deletions curl/build.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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!')
}
}
Expand Down
8 changes: 6 additions & 2 deletions curl/lib.v
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 073ab61

Please # to comment.