|
4 | 4 | baremodule MPFR_jll
|
5 | 5 | using Base, Libdl, GMP_jll
|
6 | 6 |
|
7 |
| -const PATH_list = String[] |
8 |
| -const LIBPATH_list = String[] |
9 |
| - |
10 | 7 | export libmpfr
|
11 | 8 |
|
12 | 9 | # These get calculated in __init__()
|
13 | 10 | const PATH = Ref("")
|
| 11 | +const PATH_list = String[] |
14 | 12 | const LIBPATH = Ref("")
|
| 13 | +const LIBPATH_list = String[] |
15 | 14 | artifact_dir::String = ""
|
16 |
| -libmpfr_handle::Ptr{Cvoid} = C_NULL |
17 | 15 | libmpfr_path::String = ""
|
18 | 16 |
|
| 17 | +_libmpfr_dependencies = LazyLibrary[libgmp, libgmpxx] |
| 18 | + |
19 | 19 | if Sys.iswindows()
|
20 |
| - const libmpfr = "libmpfr-6.dll" |
| 20 | + const _libmpfr_path = BundledLazyLibraryPath("libmpfr-6.dll") |
21 | 21 | elseif Sys.isapple()
|
22 |
| - const libmpfr = "@rpath/libmpfr.6.dylib" |
| 22 | + const _libmpfr_path = BundledLazyLibraryPath("libmpfr.6.dylib") |
23 | 23 | else
|
24 |
| - const libmpfr = "libmpfr.so.6" |
| 24 | + const _libmpfr_path = BundledLazyLibraryPath("libmpfr.so.6") |
25 | 25 | end
|
26 | 26 |
|
| 27 | +const libmpfr = LazyLibrary( |
| 28 | + _libmpfr_path, |
| 29 | + dependencies=_libmpfr_dependencies, |
| 30 | +) |
| 31 | + |
| 32 | +function eager_mode() |
| 33 | + dlopen(libmpfr) |
| 34 | +end |
| 35 | +is_available() = true |
| 36 | + |
27 | 37 | function __init__()
|
28 |
| - global libmpfr_handle = dlopen(libmpfr) |
29 |
| - global libmpfr_path = dlpath(libmpfr_handle) |
| 38 | + global libmpfr_path = string(_libmpfr_path) |
30 | 39 | global artifact_dir = dirname(Sys.BINDIR)
|
31 | 40 | LIBPATH[] = dirname(libmpfr_path)
|
32 | 41 | push!(LIBPATH_list, LIBPATH[])
|
33 | 42 | end
|
34 | 43 |
|
35 |
| -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. |
36 |
| -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because |
37 |
| -# there isn't one. It instead returns the overall Julia prefix. |
38 |
| -is_available() = true |
39 |
| -find_artifact_dir() = artifact_dir |
40 |
| -dev_jll() = error("stdlib JLLs cannot be dev'ed") |
41 |
| -best_wrapper = nothing |
42 |
| -get_libmpfr_path() = libmpfr_path |
43 |
| - |
44 | 44 | end # module MPFR_jll
|
0 commit comments