|
5 | 5 | baremodule CompilerSupportLibraries_jll |
6 | 6 | using Base, Libdl, Base.BinaryPlatforms |
7 | 7 |
|
8 | | -const PATH_list = String[] |
9 | | -const LIBPATH_list = String[] |
10 | | - |
11 | | -export libgfortran, libstdcxx, libgomp |
| 8 | +export libgfortran, libstdcxx, libgomp, libatomic, libgcc_s |
12 | 9 |
|
13 | 10 | # These get calculated in __init__() |
14 | | -const PATH = Ref("") |
15 | 11 | const LIBPATH = Ref("") |
| 12 | +const LIBPATH_list = String[] |
16 | 13 | artifact_dir::String = "" |
17 | | -libgcc_s_handle::Ptr{Cvoid} = C_NULL |
18 | 14 | libgcc_s_path::String = "" |
19 | | -libgfortran_handle::Ptr{Cvoid} = C_NULL |
20 | 15 | libgfortran_path::String = "" |
21 | | -libstdcxx_handle::Ptr{Cvoid} = C_NULL |
22 | 16 | libstdcxx_path::String = "" |
23 | | -libgomp_handle::Ptr{Cvoid} = C_NULL |
24 | 17 | libgomp_path::String = "" |
25 | 18 |
|
26 | 19 | if Sys.iswindows() |
| 20 | + const _libatomic_path = BundledLazyLibraryPath("bin\\libatomic-1.dll") |
| 21 | + const _libquadmath_path = BundledLazyLibraryPath("bin\\libquadmath-0.dll") |
27 | 22 | if arch(HostPlatform()) == "x86_64" |
28 | | - const libgcc_s = "libgcc_s_seh-1.dll" |
| 23 | + const _libgcc_s_path = BundledLazyLibraryPath("bin\\libgcc_s_seh-1.dll") |
29 | 24 | else |
30 | | - const libgcc_s = "libgcc_s_sjlj-1.dll" |
| 25 | + const _libgcc_s_path = BundledLazyLibraryPath("bin\\libgcc_s_sjlj-1.dll") |
31 | 26 | end |
32 | | - const libgfortran = string("libgfortran-", libgfortran_version(HostPlatform()).major, ".dll") |
33 | | - const libstdcxx = "libstdc++-6.dll" |
34 | | - const libgomp = "libgomp-1.dll" |
35 | | - const libssp = "libssp-0.dll" |
| 27 | + const _libgfortran_path = BundledLazyLibraryPath(string("bin\\libgfortran-", libgfortran_version(HostPlatform()).major, ".dll")) |
| 28 | + const _libstdcxx_path = BundledLazyLibraryPath("bin\\libstdc++-6.dll") |
| 29 | + const _libgomp_path = BundledLazyLibraryPath("bin\\libgomp-1.dll") |
| 30 | + const _libssp_path = BundledLazyLibraryPath("bin\\libssp-0.dll") |
36 | 31 | elseif Sys.isapple() |
| 32 | + const _libatomic_path = BundledLazyLibraryPath("lib/libatomic.1.dylib") |
| 33 | + const _libquadmath_path = BundledLazyLibraryPath("lib/libquadmath.0.dylib") |
37 | 34 | if arch(HostPlatform()) == "aarch64" || libgfortran_version(HostPlatform()) == v"5" |
38 | | - const libgcc_s = "@rpath/libgcc_s.1.1.dylib" |
| 35 | + const _libgcc_s_path = BundledLazyLibraryPath("lib/libgcc_s.1.1.dylib") |
39 | 36 | else |
40 | | - const libgcc_s = "@rpath/libgcc_s.1.dylib" |
| 37 | + const _libgcc_s_path = BundledLazyLibraryPath("lib/libgcc_s.1.dylib") |
41 | 38 | end |
42 | | - const libgfortran = string("@rpath/", "libgfortran.", libgfortran_version(HostPlatform()).major, ".dylib") |
43 | | - const libstdcxx = "@rpath/libstdc++.6.dylib" |
44 | | - const libgomp = "@rpath/libgomp.1.dylib" |
45 | | - const libssp = "@rpath/libssp.0.dylib" |
| 39 | + const _libgfortran_path = BundledLazyLibraryPath(string("lib/libgfortran.", libgfortran_version(HostPlatform()).major, ".dylib")) |
| 40 | + const _libstdcxx_path = BundledLazyLibraryPath("lib/libstdc++.6.dylib") |
| 41 | + const _libgomp_path = BundledLazyLibraryPath("lib/libgomp.1.dylib") |
| 42 | + const _libssp_path = BundledLazyLibraryPath("lib/libssp.0.dylib") |
46 | 43 | else |
47 | | - const libgcc_s = "libgcc_s.so.1" |
48 | | - const libgfortran = string("libgfortran.so.", libgfortran_version(HostPlatform()).major) |
49 | | - const libstdcxx = "libstdc++.so.6" |
50 | | - const libgomp = "libgomp.so.1" |
| 44 | + if !Sys.isfreebsd() |
| 45 | + const _libatomic_path = BundledLazyLibraryPath("lib/libatomic.so.1") |
| 46 | + end |
| 47 | + const _libgcc_s_path = BundledLazyLibraryPath("lib/libgcc_s.so.1") |
| 48 | + const _libgfortran_path = BundledLazyLibraryPath(string("lib/libgfortran.so.", libgfortran_version(HostPlatform()).major)) |
| 49 | + const _libstdcxx_path = BundledLazyLibraryPath("lib/libstdc++.so.6") |
| 50 | + const _libgomp_path = BundledLazyLibraryPath("lib/libgomp.so.1") |
51 | 51 | if libc(HostPlatform()) != "musl" |
52 | | - const libssp = "libssp.so.0" |
| 52 | + const _libssp_path = BundledLazyLibraryPath("lib/libssp.so.0") |
| 53 | + end |
| 54 | + if arch(HostPlatform()) ∈ ("x86_64", "i686") |
| 55 | + const _libquadmath_path = BundledLazyLibraryPath("lib/libquadmath.so.0") |
53 | 56 | end |
54 | 57 | end |
55 | 58 |
|
| 59 | +if @isdefined(_libatomic_path) |
| 60 | + const libatomic = LazyLibrary(_libatomic_path) |
| 61 | +end |
| 62 | +const libgcc_s = LazyLibrary(_libgcc_s_path) |
| 63 | +libgfortran_deps = [libgcc_s] |
| 64 | +if @isdefined _libquadmath_path |
| 65 | + const libquadmath = LazyLibrary(_libquadmath_path) |
| 66 | + push!(libgfortran_deps, libquadmath) |
| 67 | +end |
| 68 | +const libgfortran = LazyLibrary(_libgfortran_path, dependencies=libgfortran_deps) |
| 69 | +const libstdcxx = LazyLibrary(_libstdcxx_path, dependencies=[libgcc_s]) |
| 70 | +const libgomp = LazyLibrary(_libgomp_path) |
| 71 | +if @isdefined _libssp_path |
| 72 | + const libssp = LazyLibrary(_libssp_path) |
| 73 | +end |
| 74 | + |
| 75 | +# Conform to LazyJLLWrappers API |
| 76 | +function eager_mode() |
| 77 | + if @isdefined(libatomic) |
| 78 | + dlopen(libatomic) |
| 79 | + end |
| 80 | + dlopen(libgcc_s) |
| 81 | + dlopen(libgomp) |
| 82 | + if @isdefined libquadmath |
| 83 | + dlopen(libquadmath) |
| 84 | + end |
| 85 | + if @isdefined libssp |
| 86 | + dlopen(libssp) |
| 87 | + end |
| 88 | + dlopen(libgfortran) |
| 89 | + dlopen(libstdcxx) |
| 90 | +end |
| 91 | +is_available() = true |
| 92 | + |
56 | 93 | function __init__() |
57 | | - global libgcc_s_handle = dlopen(libgcc_s) |
58 | | - global libgcc_s_path = dlpath(libgcc_s_handle) |
59 | | - global libgfortran_handle = dlopen(libgfortran) |
60 | | - global libgfortran_path = dlpath(libgfortran_handle) |
61 | | - global libstdcxx_handle = dlopen(libstdcxx) |
62 | | - global libstdcxx_path = dlpath(libstdcxx_handle) |
63 | | - global libgomp_handle = dlopen(libgomp) |
64 | | - global libgomp_path = dlpath(libgomp_handle) |
65 | | - @static if libc(HostPlatform()) != "musl" |
66 | | - dlopen(libssp; throw_error = false) |
| 94 | + if @isdefined _libatomic_path |
| 95 | + global libatomic_path = string(_libatomic_path) |
67 | 96 | end |
| 97 | + global libgcc_s_path = string(_libgcc_s_path) |
| 98 | + global libgomp_path = string(_libgomp_path) |
| 99 | + if @isdefined _libquadmath_path |
| 100 | + global libquadmath_path = string(_libquadmath_path) |
| 101 | + end |
| 102 | + if @isdefined _libssp_path |
| 103 | + global libssp_path = string(_libssp_path) |
| 104 | + end |
| 105 | + global libgfortran_path = string(_libgfortran_path) |
| 106 | + global libstdcxx_path = string(_libstdcxx_path) |
68 | 107 | global artifact_dir = dirname(Sys.BINDIR) |
69 | 108 | LIBPATH[] = dirname(libgcc_s_path) |
70 | 109 | push!(LIBPATH_list, LIBPATH[]) |
71 | 110 | end |
72 | 111 |
|
73 | | -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. |
74 | | -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because |
75 | | -# there isn't one. It instead returns the overall Julia prefix. |
76 | | -is_available() = true |
77 | | -find_artifact_dir() = artifact_dir |
78 | | -dev_jll() = error("stdlib JLLs cannot be dev'ed") |
79 | | -best_wrapper = nothing |
80 | | -get_libgfortran_path() = libgfortran_path |
81 | | -get_libstdcxx_path() = libstdcxx_path |
82 | | -get_libgomp_path() = libgomp_path |
83 | | - |
84 | 112 | end # module CompilerSupportLibraries_jll |
0 commit comments