Skip to content

Commit 2c22b46

Browse files
lazify libLLVM_jll
1 parent 5e7db50 commit 2c22b46

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

stdlib/libLLVM_jll/Project.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ uuid = "8f36deef-c2a5-5394-99ed-8e07531fb29a"
33
version = "20.1.2+0"
44

55
[deps]
6-
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
76
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
7+
CompilerSupportLibraries_jll = "e66e0078-7015-5450-92f7-15fbd957f2ae"
8+
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
9+
Zlib_jll = "83775a58-1f1d-513f-b197-d71354ab007a"
810

911
[compat]
12+
CompilerSupportLibraries_jll = "1.3.0"
13+
Zlib_jll = "1.3.1"
1014
julia = "1.13"
1115

1216
[extras]

stdlib/libLLVM_jll/src/libLLVM_jll.jl

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,45 @@
33
## dummy stub for https://github.com/JuliaBinaryWrappers/libLLVM_jll.jl
44

55
baremodule libLLVM_jll
6-
using Base, Libdl
7-
8-
const PATH_list = String[]
9-
const LIBPATH_list = String[]
6+
using Base, Libdl, CompilerSupportLibraries_jll, Zlib_jll
107

118
export libLLVM
129

1310
# These get calculated in __init__()
1411
const PATH = Ref("")
12+
const PATH_list = String[]
1513
const LIBPATH = Ref("")
14+
const LIBPATH_list = String[]
1615
artifact_dir::String = ""
17-
libLLVM_handle::Ptr{Cvoid} = C_NULL
1816
libLLVM_path::String = ""
1917

18+
_libLLVM_dependencies = LazyLibrary[libstdcxx, libgcc_s, libz]
19+
2020
if Sys.iswindows()
21-
const libLLVM = "$(Base.libllvm_name).dll"
21+
const _libLLVM_path = BundledLazyLibraryPath("$(Base.libllvm_name).dll")
2222
elseif Sys.isapple()
23-
const libLLVM = "@rpath/libLLVM.dylib"
23+
const _libLLVM_path = BundledLazyLibraryPath("libLLVM.dylib")
2424
else
25-
const libLLVM = "$(Base.libllvm_name).so"
25+
const _libLLVM_path = BundledLazyLibraryPath("$(Base.libllvm_name).so")
2626
end
2727

28+
const libLLVM = LazyLibrary(
29+
_libLLVM_path,
30+
dependencies=_libLLVM_dependencies,
31+
)
32+
33+
function eager_mode()
34+
CompilerSupportLibraries_jll.eager_mode()
35+
Zlib_jll.eager_mode()
36+
dlopen(libLLVM)
37+
end
38+
is_available() = true
39+
2840
function __init__()
29-
global libLLVM_handle = dlopen(libLLVM)
30-
global libLLVM_path = dlpath(libLLVM_handle)
41+
global libLLVM_path = string(_libLLVM_path)
3142
global artifact_dir = dirname(Sys.BINDIR)
3243
LIBPATH[] = dirname(libLLVM_path)
3344
push!(LIBPATH_list, LIBPATH[])
3445
end
3546

36-
# JLLWrappers API compatibility shims. Note that not all of these will really make sense.
37-
# For instance, `find_artifact_dir()` won't actually be the artifact directory, because
38-
# there isn't one. It instead returns the overall Julia prefix.
39-
is_available() = true
40-
find_artifact_dir() = artifact_dir
41-
dev_jll() = error("stdlib JLLs cannot be dev'ed")
42-
best_wrapper = nothing
43-
get_libLLVM_path() = libLLVM_path
44-
4547
end # module libLLVM_jll

0 commit comments

Comments
 (0)