@@ -9,41 +9,46 @@ if !(Sys.iswindows() || Sys.isapple())
99 using OpenSSL_jll
1010end
1111
12- const PATH_list = String[]
13- const LIBPATH_list = String[]
14-
1512export libcurl
1613
1714# These get calculated in __init__()
1815const PATH = Ref (" " )
16+ const PATH_list = String[]
1917const LIBPATH = Ref (" " )
18+ const LIBPATH_list = String[]
2019artifact_dir:: String = " "
21- libcurl_handle:: Ptr{Cvoid} = C_NULL
2220libcurl_path:: String = " "
2321
22+ _libcurl_dependencies = LazyLibrary[
23+ libz, libnghttp2, libssh2
24+ ]
2425if Sys. iswindows ()
25- const libcurl = " libcurl-4.dll"
26+ const _libcurl_path = BundledLazyLibraryPath ( " libcurl-4.dll" )
2627elseif Sys. isapple ()
27- const libcurl = " @rpath/ libcurl.4.dylib"
28+ const _libcurl_path = BundledLazyLibraryPath ( " libcurl.4.dylib" )
2829else
29- const libcurl = " libcurl.so.4"
30+ const _libcurl_path = BundledLazyLibraryPath (" libcurl.so.4" )
31+ append! (_libcurl_dependencies, [libssl, libcrypto])
3032end
3133
34+ const libcurl = LazyLibrary (
35+ _libcurl_path,
36+ dependencies= _libcurl_dependencies,
37+ )
38+
39+ function eager_mode ()
40+ Zlib_jll. eager_mode ()
41+ nghttp2_jll. eager_mode ()
42+ LibSSH2_jll. eager_mode ()
43+ dlopen (libcurl)
44+ end
45+ is_available () = true
46+
3247function __init__ ()
33- global libcurl_handle = dlopen (libcurl)
34- global libcurl_path = dlpath (libcurl_handle)
48+ global libcurl_path = string (_libcurl_path)
3549 global artifact_dir = dirname (Sys. BINDIR)
3650 LIBPATH[] = dirname (libcurl_path)
3751 push! (LIBPATH_list, LIBPATH[])
3852end
3953
40- # JLLWrappers API compatibility shims. Note that not all of these will really make sense.
41- # For instance, `find_artifact_dir()` won't actually be the artifact directory, because
42- # there isn't one. It instead returns the overall Julia prefix.
43- is_available () = true
44- find_artifact_dir () = artifact_dir
45- dev_jll () = error (" stdlib JLLs cannot be dev'ed" )
46- best_wrapper = nothing
47- get_libcurl_path () = libcurl_path
48-
4954end # module LibCURL_jll
0 commit comments