Skip to content

Commit e99d484

Browse files
lazify PCRE2_jll
1 parent f328bf7 commit e99d484

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

stdlib/PCRE2_jll/src/PCRE2_jll.jl

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,36 @@
44
baremodule PCRE2_jll
55
using Base, Libdl
66

7-
const PATH_list = String[]
8-
const LIBPATH_list = String[]
9-
107
export libpcre2_8
118

129
# These get calculated in __init__()
1310
const PATH = Ref("")
11+
const PATH_list = String[]
1412
const LIBPATH = Ref("")
13+
const LIBPATH_list = String[]
1514
artifact_dir::String = ""
16-
libpcre2_8_handle::Ptr{Cvoid} = C_NULL
1715
libpcre2_8_path::String = ""
1816

1917
if Sys.iswindows()
20-
const libpcre2_8 = "libpcre2-8-0.dll"
18+
const _libpcre2_8_path = BundledLazyLibraryPath("libpcre2-8-0.dll")
2119
elseif Sys.isapple()
22-
const libpcre2_8 = "@rpath/libpcre2-8.0.dylib"
20+
const _libpcre2_8_path = BundledLazyLibraryPath("libpcre2-8.0.dylib")
2321
else
24-
const libpcre2_8 = "libpcre2-8.so.0"
22+
const _libpcre2_8_path = BundledLazyLibraryPath("libpcre2-8.so.0")
2523
end
2624

25+
const libpcre2_8 = LazyLibrary(_libpcre2_8_path)
26+
27+
function eager_mode()
28+
dlopen(libpcre2_8)
29+
end
30+
is_available() = true
31+
2732
function __init__()
28-
global libpcre2_8_handle = dlopen(libpcre2_8)
29-
global libpcre2_8_path = dlpath(libpcre2_8_handle)
33+
global libpcre2_8_path = string(_libpcre2_8_path)
3034
global artifact_dir = dirname(Sys.BINDIR)
3135
LIBPATH[] = dirname(libpcre2_8_path)
3236
push!(LIBPATH_list, LIBPATH[])
3337
end
3438

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_libpcre2_8_path() = libpcre2_8_path
43-
4439
end # module PCRE2_jll

0 commit comments

Comments
 (0)