Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions base/binaryplatforms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,17 @@ function platform_dlext(p::AbstractPlatform = HostPlatform())
end
end

# Not general purpose, just for parse_dl_name_version
function _this_os_name()
if Sys.iswindows()
return "windows"
elseif Sys.isapple()
return "macos"
else
return "other"
end
end

"""
parse_dl_name_version(path::String, platform::AbstractPlatform)

Expand All @@ -806,9 +817,10 @@ valid dynamic library, this method throws an error. If no soversion
can be extracted from the filename, as in "libbar.so" this method
returns `"libbar", nothing`.
"""
function parse_dl_name_version(path::String, os::String)
function parse_dl_name_version(path::String, os::String=_this_os_name())
# Use an extraction regex that matches the given OS
local dlregex
# Keep this up to date with _this_os_name
if os == "windows"
# On Windows, libraries look like `libnettle-6.dll`
dlregex = r"^(.*?)(?:-((?:[\.\d]+)*))?\.dll$"sa
Expand Down Expand Up @@ -837,7 +849,7 @@ function parse_dl_name_version(path::String, os::String)
end

# Adapter for `AbstractString`
function parse_dl_name_version(path::AbstractString, os::AbstractString)
function parse_dl_name_version(path::AbstractString, os::AbstractString=_this_os_name())
return parse_dl_name_version(string(path)::String, string(os)::String)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,75 +13,123 @@ const PATH_list = String[]
const LIBPATH = Ref("")
const LIBPATH_list = String[]
artifact_dir::String = ""
libgcc_s_path::String = ""
libgfortran_path::String = ""
libstdcxx_path::String = ""
libgomp_path::String = ""

if Sys.iswindows()
const _libatomic_path = BundledLazyLibraryPath("libatomic-1.dll")
const _libquadmath_path = BundledLazyLibraryPath("libquadmath-0.dll")
if arch(HostPlatform()) == "x86_64"
const _libgcc_s_path = BundledLazyLibraryPath("libgcc_s_seh-1.dll")
else
const _libgcc_s_path = BundledLazyLibraryPath("libgcc_s_sjlj-1.dll")
end
const _libgfortran_path = BundledLazyLibraryPath(string("libgfortran-", libgfortran_version(HostPlatform()).major, ".dll"))
const _libstdcxx_path = BundledLazyLibraryPath("libstdc++-6.dll")
const _libgomp_path = BundledLazyLibraryPath("libgomp-1.dll")
const _libssp_path = BundledLazyLibraryPath("libssp-0.dll")
elseif Sys.isapple()
const _libatomic_path = BundledLazyLibraryPath("libatomic.1.dylib")
const _libquadmath_path = BundledLazyLibraryPath("libquadmath.0.dylib")
if arch(HostPlatform()) == "aarch64" || libgfortran_version(HostPlatform()) == v"5"
const _libgcc_s_path = BundledLazyLibraryPath("libgcc_s.1.1.dylib")
else
const _libgcc_s_path = BundledLazyLibraryPath("libgcc_s.1.dylib")
end
const _libgfortran_path = BundledLazyLibraryPath(string("libgfortran.", libgfortran_version(HostPlatform()).major, ".dylib"))
const _libstdcxx_path = BundledLazyLibraryPath("libstdc++.6.dylib")
const _libgomp_path = BundledLazyLibraryPath("libgomp.1.dylib")
const _libssp_path = BundledLazyLibraryPath("libssp.0.dylib")
else
if Sys.isfreebsd()
const _libatomic_path = BundledLazyLibraryPath("libatomic.so.3")
libatomic_path::String = ""
const libatomic = LazyLibrary(
if Sys.iswindows()
BundledLazyLibraryPath("libatomic-1.dll")
elseif Sys.isapple()
BundledLazyLibraryPath("libatomic.1.dylib")
elseif Sys.isfreebsd()
BundledLazyLibraryPath("libatomic.so.3")
elseif Sys.islinux()
BundledLazyLibraryPath("libatomic.so.1")
else
const _libatomic_path = BundledLazyLibraryPath("libatomic.so.1")
end
const _libgcc_s_path = BundledLazyLibraryPath("libgcc_s.so.1")
const _libgfortran_path = BundledLazyLibraryPath(string("libgfortran.so.", libgfortran_version(HostPlatform()).major))
const _libstdcxx_path = BundledLazyLibraryPath("libstdc++.so.6")
const _libgomp_path = BundledLazyLibraryPath("libgomp.so.1")
if libc(HostPlatform()) != "musl"
const _libssp_path = BundledLazyLibraryPath("libssp.so.0")
error("CompilerSupportLibraries_jll: Library 'libatomic' is not available for $(Sys.KERNEL)")
end
if arch(HostPlatform()) ∈ ("x86_64", "i686")
const _libquadmath_path = BundledLazyLibraryPath("libquadmath.so.0")
end
end
)

if @isdefined(_libatomic_path)
const libatomic = LazyLibrary(_libatomic_path)
if Sys.iswindows() || Sys.isapple() || arch(HostPlatform()) ∈ ("x86_64", "i686")
global libquadmath_path::String = ""
const libquadmath = LazyLibrary(
if Sys.iswindows()
BundledLazyLibraryPath("libquadmath-0.dll")
elseif Sys.isapple()
BundledLazyLibraryPath("libquadmath.0.dylib")
elseif (Sys.islinux() || Sys.isfreebsd()) && arch(HostPlatform()) ∈ ("x86_64", "i686")
BundledLazyLibraryPath("libquadmath.so.0")
else
error("CompilerSupportLibraries_jll: Library 'libquadmath' is not available for $(Sys.KERNEL)")
end
)
end
const libgcc_s = LazyLibrary(_libgcc_s_path)

_libgfortran_deps = [libgcc_s]
if @isdefined _libquadmath_path
const libquadmath = LazyLibrary(_libquadmath_path)
push!(_libgfortran_deps, libquadmath)
end
libgcc_s_path::String = ""
const libgcc_s = LazyLibrary(
if Sys.iswindows()
if arch(HostPlatform()) == "x86_64"
BundledLazyLibraryPath("libgcc_s_seh-1.dll")
else
BundledLazyLibraryPath("libgcc_s_sjlj-1.dll")
end
elseif Sys.isapple()
if arch(HostPlatform()) == "aarch64" || libgfortran_version(HostPlatform()) == v"5"
BundledLazyLibraryPath("libgcc_s.1.1.dylib")
else
BundledLazyLibraryPath("libgcc_s.1.dylib")
end
elseif Sys.islinux() || Sys.isfreebsd()
BundledLazyLibraryPath("libgcc_s.so.1")
else
error("CompilerSupportLibraries_jll: Library 'libgcc_s' is not available for $(Sys.KERNEL)")
end
)

const libgfortran = LazyLibrary(_libgfortran_path, dependencies=_libgfortran_deps)
libgfortran_path::String = ""
const libgfortran = LazyLibrary(
if Sys.iswindows()
BundledLazyLibraryPath(string("libgfortran-", libgfortran_version(HostPlatform()).major, ".dll"))
elseif Sys.isapple()
BundledLazyLibraryPath(string("libgfortran.", libgfortran_version(HostPlatform()).major, ".dylib"))
elseif Sys.islinux() || Sys.isfreebsd()
BundledLazyLibraryPath(string("libgfortran.so.", libgfortran_version(HostPlatform()).major))
else
error("CompilerSupportLibraries_jll: Library 'libgfortran' is not available for $(Sys.KERNEL)")
end;
dependencies = @static if @isdefined(libquadmath)
LazyLibrary[libgcc_s, libquadmath]
else
LazyLibrary[libgcc_s]
end
)

_libstdcxx_dependencies = LazyLibrary[libgcc_s]
const libstdcxx = LazyLibrary(_libstdcxx_path, dependencies=_libstdcxx_dependencies)
libstdcxx_path::String = ""
const libstdcxx = LazyLibrary(
if Sys.iswindows()
BundledLazyLibraryPath("libstdc++-6.dll")
elseif Sys.isapple()
BundledLazyLibraryPath("libstdc++.6.dylib")
elseif Sys.islinux() || Sys.isfreebsd()
BundledLazyLibraryPath("libstdc++.so.6")
else
error("CompilerSupportLibraries_jll: Library 'libstdcxx' is not available for $(Sys.KERNEL)")
end;
dependencies = LazyLibrary[libgcc_s]
)

const libgomp = LazyLibrary(_libgomp_path)
libgomp_path::String = ""
const libgomp = LazyLibrary(
if Sys.iswindows()
BundledLazyLibraryPath("libgomp-1.dll")
elseif Sys.isapple()
BundledLazyLibraryPath("libgomp.1.dylib")
elseif Sys.islinux() || Sys.isfreebsd()
BundledLazyLibraryPath("libgomp.so.1")
else
error("CompilerSupportLibraries_jll: Library 'libgomp' is not available for $(Sys.KERNEL)")
end;
dependencies = if Sys.iswindows()
LazyLibrary[libgcc_s]
else
LazyLibrary[]
end
)

# Some installations (such as those from-source) may not have `libssp`
# So let's do a compile-time check to see if we've got it.
if @isdefined(_libssp_path) && isfile(string(_libssp_path))
const libssp = LazyLibrary(_libssp_path)
# only define if isfile
let
if Sys.iswindows() || Sys.isapple() || libc(HostPlatform()) != "musl"
_libssp_path = if Sys.iswindows()
BundledLazyLibraryPath("libssp-0.dll")
elseif Sys.isapple()
BundledLazyLibraryPath("libssp.0.dylib")
elseif Sys.islinux() && libc(HostPlatform()) != "musl"
BundledLazyLibraryPath("libssp.so.0")
end
if isfile(string(_libssp_path))
global libssp_path::String = ""
@eval const libssp = LazyLibrary($(_libssp_path))
end
end
end

# Conform to LazyJLLWrappers API
Expand All @@ -103,19 +151,17 @@ end
is_available() = true

function __init__()
if @isdefined _libatomic_path
global libatomic_path = string(_libatomic_path)
end
global libgcc_s_path = string(_libgcc_s_path)
global libgomp_path = string(_libgomp_path)
if @isdefined _libquadmath_path
global libquadmath_path = string(_libquadmath_path)
global libatomic_path = string(libatomic.path)
global libgcc_s_path = string(libgcc_s.path)
global libgomp_path = string(libgomp.path)
if @isdefined libquadmath_path
global libquadmath_path = string(libquadmath.path)
end
if @isdefined _libssp_path
global libssp_path = string(_libssp_path)
if @isdefined libssp_path
global libssp_path = string(libssp.path)
end
global libgfortran_path = string(_libgfortran_path)
global libstdcxx_path = string(_libstdcxx_path)
global libgfortran_path = string(libgfortran.path)
global libstdcxx_path = string(libstdcxx.path)
global artifact_dir = dirname(Sys.BINDIR)
LIBPATH[] = dirname(libgcc_s_path)
push!(LIBPATH_list, LIBPATH[])
Expand Down
61 changes: 34 additions & 27 deletions stdlib/GMP_jll/src/GMP_jll.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

## dummy stub for https://github.com/JuliaBinaryWrappers/GMP_jll.jl
baremodule GMP_jll
using Base, Libdl, CompilerSupportLibraries_jll
using Base, Libdl
if !Sys.isapple()
using CompilerSupportLibraries_jll
end

export libgmp, libgmpxx

Expand All @@ -12,44 +15,48 @@ const PATH_list = String[]
const LIBPATH = Ref("")
const LIBPATH_list = String[]
artifact_dir::String = ""
libgmp_path::String = ""
libgmpxx_path::String = ""

if Sys.iswindows()
const _libgmp_path = BundledLazyLibraryPath("libgmp-10.dll")
const _libgmpxx_path = BundledLazyLibraryPath("libgmpxx-4.dll")
elseif Sys.isapple()
const _libgmp_path = BundledLazyLibraryPath("libgmp.10.dylib")
const _libgmpxx_path = BundledLazyLibraryPath("libgmpxx.4.dylib")
else
const _libgmp_path = BundledLazyLibraryPath("libgmp.so.10")
const _libgmpxx_path = BundledLazyLibraryPath("libgmpxx.so.4")
end

const libgmp = LazyLibrary(_libgmp_path)
libgmp_path::String = ""
const libgmp = LazyLibrary(
if Sys.iswindows()
BundledLazyLibraryPath("libgmp-10.dll")
elseif Sys.isapple()
BundledLazyLibraryPath("libgmp.10.dylib")
else
BundledLazyLibraryPath("libgmp.so.10")
end
)

if Sys.isfreebsd()
_libgmpxx_dependencies = LazyLibrary[libgmp, libgcc_s]
elseif Sys.isapple()
_libgmpxx_dependencies = LazyLibrary[libgmp]
else
_libgmpxx_dependencies = LazyLibrary[libgmp, libstdcxx, libgcc_s]
end
libgmpxx_path::String = ""
const libgmpxx = LazyLibrary(
_libgmpxx_path,
dependencies=_libgmpxx_dependencies,
if Sys.iswindows()
BundledLazyLibraryPath("libgmpxx-4.dll")
elseif Sys.isapple()
BundledLazyLibraryPath("libgmpxx.4.dylib")
else
BundledLazyLibraryPath("libgmpxx.so.4")
end,
dependencies = if Sys.isfreebsd()
LazyLibrary[libgmp, libgcc_s]
elseif Sys.isapple()
LazyLibrary[libgmp]
else
LazyLibrary[libgmp, libstdcxx, libgcc_s]
end
)

function eager_mode()
CompilerSupportLibraries_jll.eager_mode()
@static if @isdefined CompilerSupportLibraries_jll
CompilerSupportLibraries_jll.eager_mode()
end
dlopen(libgmp)
dlopen(libgmpxx)
end
is_available() = true

function __init__()
global libgmp_path = string(_libgmp_path)
global libgmpxx_path = string(_libgmpxx_path)
global libgmp_path = string(libgmp.path)
global libgmpxx_path = string(libgmpxx.path)
global artifact_dir = dirname(Sys.BINDIR)
LIBPATH[] = dirname(libgmp_path)
push!(LIBPATH_list, LIBPATH[])
Expand Down
6 changes: 3 additions & 3 deletions stdlib/LLVMLibUnwind_jll/src/LLVMLibUnwind_jll.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ const PATH_list = String[]
const LIBPATH = Ref("")
const LIBPATH_list = String[]
artifact_dir::String = ""

llvmlibunwind_path::String = ""
const llvmlibunwind = LazyLibrary(BundledLazyLibraryPath("libunwind"))

const _llvmlibunwind_path = BundledLazyLibraryPath("libunwind")
const llvmlibunwind = LazyLibrary(_llvmlibunwind_path)
function eager_mode()
dlopen(llvmlibunwind)
end
is_available() = @static Sys.isapple() ? true : false

function __init__()
global llvmlibunwind_path = string(_llvmlibunwind_path)
global llvmlibunwind_path = string(llvmlibunwind.path)
global artifact_dir = dirname(Sys.BINDIR)
LIBPATH[] = dirname(llvmlibunwind_path)
push!(LIBPATH_list, LIBPATH[])
Expand Down
8 changes: 5 additions & 3 deletions stdlib/LibCURL_jll/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
version = "8.12.1+1"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
CompilerSupportLibraries_jll = "e66e0078-7015-5450-92f7-15fbd957f2ae"
LibSSH2_jll = "29816b5a-b9ab-546f-933c-edad1886dfa8"
nghttp2_jll = "8e850ede-7688-5339-a07c-302acd2aaf8d"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
OpenSSL_jll = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
Zlib_jll = "83775a58-1f1d-513f-b197-d71354ab007a"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
nghttp2_jll = "8e850ede-7688-5339-a07c-302acd2aaf8d"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand All @@ -17,4 +18,5 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
test = ["Test"]

[compat]
CompilerSupportLibraries_jll = "1.3.0"
julia = "1.11"
Loading