-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Convert remaining JLL stdlibs to LazyLibraries #58444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
using Test, Libdl, GMP_jll | ||
|
||
@testset "GMP_jll" begin | ||
vn = VersionNumber(unsafe_string(unsafe_load(cglobal((:__gmp_version, libgmp), Ptr{Cchar})))) | ||
vn = VersionNumber(unsafe_string(unsafe_load(cglobal(dlsym(libgmp, :__gmp_version), Ptr{Cchar})))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should/could cglobal be taught how to handle a LazyLibrary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could, the most annoying thing is just that |
||
@test vn == v"6.3.0" | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
# This file is a part of Julia. License is MIT: https://julialang.org/license | ||
|
||
using Test, Libdl | ||
using LLVMLibUnwind_jll: llvmlibunwind_handle | ||
|
||
using Test, Libdl, LLVMLibUnwind_jll | ||
@testset "LLVMLibUnwind_jll" begin | ||
if Sys.isapple() | ||
@test dlsym(llvmlibunwind_handle, :unw_getcontext; throw_error=false) !== nothing | ||
@test dlsym(llvmlibunwind_handle, :unw_init_local; throw_error=false) !== nothing | ||
@test dlsym(llvmlibunwind_handle, :unw_init_local_dwarf; throw_error=false) !== nothing | ||
@test dlsym(llvmlibunwind_handle, :unw_step; throw_error=false) !== nothing | ||
@test dlsym(llvmlibunwind_handle, :unw_get_reg; throw_error=false) !== nothing | ||
@test dlsym(llvmlibunwind_handle, :unw_set_reg; throw_error=false) !== nothing | ||
@test dlsym(llvmlibunwind_handle, :unw_resume; throw_error=false) !== nothing | ||
@test dlsym(llvmlibunwind, :unw_getcontext; throw_error=false) !== nothing | ||
@test dlsym(llvmlibunwind, :unw_init_local; throw_error=false) !== nothing | ||
@test dlsym(llvmlibunwind, :unw_init_local_dwarf; throw_error=false) !== nothing | ||
@test dlsym(llvmlibunwind, :unw_step; throw_error=false) !== nothing | ||
@test dlsym(llvmlibunwind, :unw_get_reg; throw_error=false) !== nothing | ||
@test dlsym(llvmlibunwind, :unw_set_reg; throw_error=false) !== nothing | ||
@test dlsym(llvmlibunwind, :unw_resume; throw_error=false) !== nothing | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,41 +9,56 @@ if !(Sys.iswindows() || Sys.isapple()) | |
using OpenSSL_jll | ||
end | ||
|
||
const PATH_list = String[] | ||
const LIBPATH_list = String[] | ||
|
||
export libcurl | ||
|
||
# These get calculated in __init__() | ||
const PATH = Ref("") | ||
const PATH_list = String[] | ||
const LIBPATH = Ref("") | ||
const LIBPATH_list = String[] | ||
artifact_dir::String = "" | ||
libcurl_handle::Ptr{Cvoid} = C_NULL | ||
libcurl_path::String = "" | ||
|
||
if Sys.isfreebsd() | ||
_libcurl_dependencies = LazyLibrary[] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of these zero-dependency lists for FreeBSD are surprising - why is it so common for that platform? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know. They are all empty, actually. @staticfloat I didn't see any obvious place the testing could be incorrect? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apparently there's a readelf styling difference on freebsd where it shows as |
||
else | ||
_libcurl_dependencies = LazyLibrary[libz, libnghttp2, libssh2] | ||
if !(Sys.iswindows() || Sys.isapple()) | ||
append!(_libcurl_dependencies, [libssl, libcrypto]) | ||
end | ||
end | ||
|
||
if Sys.iswindows() | ||
const libcurl = "libcurl-4.dll" | ||
const _libcurl_path = BundledLazyLibraryPath("libcurl-4.dll") | ||
elseif Sys.isapple() | ||
const libcurl = "@rpath/libcurl.4.dylib" | ||
const _libcurl_path = BundledLazyLibraryPath("libcurl.4.dylib") | ||
else | ||
const libcurl = "libcurl.so.4" | ||
const _libcurl_path = BundledLazyLibraryPath("libcurl.so.4") | ||
end | ||
|
||
const libcurl = LazyLibrary( | ||
_libcurl_path, | ||
dependencies=_libcurl_dependencies, | ||
) | ||
|
||
function eager_mode() | ||
Zlib_jll.eager_mode() | ||
nghttp2_jll.eager_mode() | ||
LibSSH2_jll.eager_mode() | ||
dlopen(libcurl) | ||
end | ||
is_available() = true | ||
|
||
function __init__() | ||
global libcurl_handle = dlopen(libcurl) | ||
global libcurl_path = dlpath(libcurl_handle) | ||
global libcurl_path = string(_libcurl_path) | ||
global artifact_dir = dirname(Sys.BINDIR) | ||
LIBPATH[] = dirname(libcurl_path) | ||
push!(LIBPATH_list, LIBPATH[]) | ||
end | ||
|
||
# JLLWrappers API compatibility shims. Note that not all of these will really make sense. | ||
# For instance, `find_artifact_dir()` won't actually be the artifact directory, because | ||
# there isn't one. It instead returns the overall Julia prefix. | ||
is_available() = true | ||
find_artifact_dir() = artifact_dir | ||
dev_jll() = error("stdlib JLLs cannot be dev'ed") | ||
best_wrapper = nothing | ||
get_libcurl_path() = libcurl_path | ||
if Base.generating_output() | ||
precompile(eager_mode, ()) | ||
precompile(is_available, ()) | ||
end | ||
|
||
end # module LibCURL_jll |
Uh oh!
There was an error while loading. Please reload this page.