Skip to content

Commit

Permalink
use jl_read_sonames and jl_lookup_soname on older julia versions (#332)
Browse files Browse the repository at this point in the history
use the code path from before #277 on versions of julia where the new code freezes
ref JuliaStats/Rmath.jl#38
  • Loading branch information
tkelman authored and ararslan committed Nov 15, 2017
1 parent 74daea0 commit 0989784
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/dependencies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,15 @@ sudoname(c::Cmd) = c == `` ? "" : "sudo "

const have_sonames = Ref(false)
const sonames = Dict{String,String}()
reread_sonames() = (empty!(sonames); have_sonames[] = false; nothing)
function reread_sonames()
if VERSION >= v"0.7.0-DEV.1287" # only use this where julia issue #22832 is fixed
empty!(sonames)
have_sonames[] = false
nothing
else
ccall(:jl_read_sonames, Void, ())
end
end

if Compat.Sys.iswindows() || Compat.Sys.isapple()
function read_sonames()
Expand Down Expand Up @@ -410,10 +418,20 @@ else
end
end

lookup_soname(s) = lookup_soname(String(s))
function lookup_soname(s::String)
have_sonames[] || read_sonames()
return get(sonames, s, "")
if VERSION >= v"0.7.0-DEV.1287" # only use this where julia issue #22832 is fixed
lookup_soname(s) = lookup_soname(String(s))
function lookup_soname(s::String)
have_sonames[] || read_sonames()
return get(sonames, s, "")
end
else
function lookup_soname(lib)
if Compat.Sys.islinux() || (Compat.Sys.isbsd() && !Compat.Sys.isapple())
soname = ccall(:jl_lookup_soname, Ptr{UInt8}, (Ptr{UInt8}, Csize_t), lib, sizeof(lib))
soname != C_NULL && return unsafe_string(soname)
end
return ""
end
end

generate_steps(h::DependencyProvider,dep::LibraryDependency) = error("Must also pass provider options")
Expand Down

0 comments on commit 0989784

Please sign in to comment.