|
2 | 2 |
|
3 | 3 | ## dummy stub for https://github.com/JuliaBinaryWrappers/GMP_jll.jl |
4 | 4 | baremodule GMP_jll |
5 | | -using Base, Libdl |
6 | | - |
7 | | -const PATH_list = String[] |
8 | | -const LIBPATH_list = String[] |
| 5 | +using Base, Libdl, CompilerSupportLibraries_jll |
9 | 6 |
|
10 | 7 | export libgmp, libgmpxx |
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 | | -libgmp_handle::Ptr{Cvoid} = C_NULL |
17 | 15 | libgmp_path::String = "" |
18 | | -libgmpxx_handle::Ptr{Cvoid} = C_NULL |
19 | 16 | libgmpxx_path::String = "" |
20 | 17 |
|
21 | 18 | if Sys.iswindows() |
22 | | - const libgmp = "libgmp-10.dll" |
23 | | - const libgmpxx = "libgmpxx-4.dll" |
| 19 | + const _libgmp_path = BundledLazyLibraryPath("libgmp-10.dll") |
| 20 | + const _libgmpxx_path = BundledLazyLibraryPath("libgmpxx-4.dll") |
24 | 21 | elseif Sys.isapple() |
25 | | - const libgmp = "@rpath/libgmp.10.dylib" |
26 | | - const libgmpxx = "@rpath/libgmpxx.4.dylib" |
| 22 | + const _libgmp_path = BundledLazyLibraryPath("libgmp.10.dylib") |
| 23 | + const _libgmpxx_path = BundledLazyLibraryPath("libgmpxx.4.dylib") |
27 | 24 | else |
28 | | - const libgmp = "libgmp.so.10" |
29 | | - const libgmpxx = "libgmpxx.so.4" |
| 25 | + const _libgmp_path = BundledLazyLibraryPath("libgmp.so.10") |
| 26 | + const _libgmpxx_path = BundledLazyLibraryPath("libgmpxx.so.4") |
| 27 | +end |
| 28 | + |
| 29 | +const libgmp = LazyLibrary(_libgmp_path) |
| 30 | + |
| 31 | +_libgmpxx_dependencies = LazyLibrary[libgmp, libstdcxx, libgcc_s] |
| 32 | +const libgmpxx = LazyLibrary( |
| 33 | + _libgmpxx_path, |
| 34 | + dependencies=_libgmpxx_dependencies, |
| 35 | +) |
| 36 | + |
| 37 | +function eager_mode() |
| 38 | + CompilerSupportLibraries_jll.eager_mode() |
| 39 | + dlopen(libgmp) |
| 40 | + dlopen(libgmpxx) |
30 | 41 | end |
| 42 | +is_available() = true |
31 | 43 |
|
32 | 44 | function __init__() |
33 | | - global libgmp_handle = dlopen(libgmp) |
34 | | - global libgmp_path = dlpath(libgmp_handle) |
35 | | - global libgmpxx_handle = dlopen(libgmpxx) |
36 | | - global libgmpxx_path = dlpath(libgmpxx_handle) |
| 45 | + global libgmp_path = string(_libgmp_path) |
| 46 | + global libgmpxx_path = string(_libgmpxx_path) |
37 | 47 | global artifact_dir = dirname(Sys.BINDIR) |
38 | 48 | LIBPATH[] = dirname(libgmp_path) |
39 | 49 | push!(LIBPATH_list, LIBPATH[]) |
40 | 50 | end |
41 | 51 |
|
42 | | -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. |
43 | | -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because |
44 | | -# there isn't one. It instead returns the overall Julia prefix. |
45 | | -is_available() = true |
46 | | -find_artifact_dir() = artifact_dir |
47 | | -dev_jll() = error("stdlib JLLs cannot be dev'ed") |
48 | | -best_wrapper = nothing |
49 | | -get_libgmp_path() = libgmp_path |
50 | | -get_libgmpxx_path() = libgmpxx_path |
51 | | - |
52 | 52 | end # module GMP_jll |
0 commit comments