|
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") |
| 21 | +elseif Sys.isapple() |
| 22 | + const _libgmp_path = BundledLazyLibraryPath("libgmp.10.dylib") |
| 23 | + const _libgmpxx_path = BundledLazyLibraryPath("libgmpxx.4.dylib") |
| 24 | +else |
| 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 | +if Sys.isfreebsd() |
| 32 | + _libgmpxx_dependencies = LazyLibrary[libgmp, libgcc_s] |
24 | 33 | elseif Sys.isapple() |
25 | | - const libgmp = "@rpath/libgmp.10.dylib" |
26 | | - const libgmpxx = "@rpath/libgmpxx.4.dylib" |
| 34 | + _libgmpxx_dependencies = LazyLibrary[libgmp] |
27 | 35 | else |
28 | | - const libgmp = "libgmp.so.10" |
29 | | - const libgmpxx = "libgmpxx.so.4" |
| 36 | + _libgmpxx_dependencies = LazyLibrary[libgmp, libstdcxx, libgcc_s] |
| 37 | +end |
| 38 | +const libgmpxx = LazyLibrary( |
| 39 | + _libgmpxx_path, |
| 40 | + dependencies=_libgmpxx_dependencies, |
| 41 | +) |
| 42 | + |
| 43 | +function eager_mode() |
| 44 | + CompilerSupportLibraries_jll.eager_mode() |
| 45 | + dlopen(libgmp) |
| 46 | + dlopen(libgmpxx) |
30 | 47 | end |
| 48 | +is_available() = true |
31 | 49 |
|
32 | 50 | 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) |
| 51 | + global libgmp_path = string(_libgmp_path) |
| 52 | + global libgmpxx_path = string(_libgmpxx_path) |
37 | 53 | global artifact_dir = dirname(Sys.BINDIR) |
38 | 54 | LIBPATH[] = dirname(libgmp_path) |
39 | 55 | push!(LIBPATH_list, LIBPATH[]) |
40 | 56 | end |
41 | 57 |
|
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 |
| 58 | +if Base.generating_output() |
| 59 | + precompile(eager_mode, ()) |
| 60 | + precompile(is_available, ()) |
| 61 | +end |
51 | 62 |
|
52 | 63 | end # module GMP_jll |
0 commit comments