|
5 | 5 | baremodule OpenSSL_jll |
6 | 6 | using Base, Libdl, Base.BinaryPlatforms |
7 | 7 |
|
8 | | -const PATH_list = String[] |
9 | | -const LIBPATH_list = String[] |
10 | | - |
11 | 8 | export libcrypto, libssl |
12 | 9 |
|
13 | 10 | # These get calculated in __init__() |
14 | 11 | const PATH = Ref("") |
| 12 | +const PATH_list = String[] |
15 | 13 | const LIBPATH = Ref("") |
| 14 | +const LIBPATH_list = String[] |
16 | 15 | artifact_dir::String = "" |
17 | | -libcrypto_handle::Ptr{Cvoid} = C_NULL |
18 | 16 | libcrypto_path::String = "" |
19 | | -libssl_handle::Ptr{Cvoid} = C_NULL |
20 | 17 | libssl_path::String = "" |
21 | 18 |
|
22 | 19 | if Sys.iswindows() |
23 | 20 | if arch(HostPlatform()) == "x86_64" |
24 | | - const libcrypto = "libcrypto-3-x64.dll" |
25 | | - const libssl = "libssl-3-x64.dll" |
| 21 | + const _libcrypto_path = BundledLazyLibraryPath("libcrypto-3-x64.dll") |
| 22 | + const _libssl_path = BundledLazyLibraryPath("libssl-3-x64.dll") |
26 | 23 | else |
27 | | - const libcrypto = "libcrypto-3.dll" |
28 | | - const libssl = "libssl-3.dll" |
| 24 | + const _libcrypto_path = BundledLazyLibraryPath("libcrypto-3.dll") |
| 25 | + const _libssl_path = BundledLazyLibraryPath("libssl-3.dll") |
29 | 26 | end |
30 | 27 | elseif Sys.isapple() |
31 | | - const libcrypto = "@rpath/libcrypto.3.dylib" |
32 | | - const libssl = "@rpath/libssl.3.dylib" |
| 28 | + const _libcrypto_path = BundledLazyLibraryPath("libcrypto.3.dylib") |
| 29 | + const _libssl_path = BundledLazyLibraryPath("libssl.3.dylib") |
33 | 30 | else |
34 | | - const libcrypto = "libcrypto.so.3" |
35 | | - const libssl = "libssl.so.3" |
| 31 | + const _libcrypto_path = BundledLazyLibraryPath("libcrypto.so.3") |
| 32 | + const _libssl_path = BundledLazyLibraryPath("libssl.so.3") |
36 | 33 | end |
37 | 34 |
|
| 35 | +const libcrypto = LazyLibrary(_libcrypto_path) |
| 36 | +const libssl = LazyLibrary(_libssl_path, dependencies=[libcrypto]) |
| 37 | + |
| 38 | +function eager_mode() |
| 39 | + dlopen(libcrypto) |
| 40 | + dlopen(libssl) |
| 41 | +end |
| 42 | +is_available() = true |
| 43 | + |
38 | 44 | function __init__() |
39 | | - global libcrypto_handle = dlopen(libcrypto) |
40 | | - global libcrypto_path = dlpath(libcrypto_handle) |
41 | | - global libssl_handle = dlopen(libssl) |
42 | | - global libssl_path = dlpath(libssl_handle) |
| 45 | + global libcrypto_path = string(_libcrypto_path) |
| 46 | + global libssl_path = string(_libssl_path) |
43 | 47 | global artifact_dir = dirname(Sys.BINDIR) |
44 | 48 | LIBPATH[] = dirname(libssl_path) |
45 | 49 | push!(LIBPATH_list, LIBPATH[]) |
46 | 50 | end |
47 | 51 |
|
48 | | -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. |
49 | | -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because |
50 | | -# there isn't one. It instead returns the overall Julia prefix. |
51 | | -is_available() = true |
52 | | -find_artifact_dir() = artifact_dir |
53 | | -dev_jll() = error("stdlib JLLs cannot be dev'ed") |
54 | | -best_wrapper = nothing |
55 | | -get_libcrypto_path() = libcrypto_path |
56 | | -get_libssl_path() = libssl_path |
57 | | - |
58 | 52 | end # module OpenSSL_jll |
0 commit comments