Skip to content

Commit

Permalink
Fixes for Libdl moving to the stdlib (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Jan 15, 2018
1 parent a016a93 commit 4959cd5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/BinDeps.jl
Expand Up @@ -10,6 +10,10 @@ else
const _HOME = JULIA_HOME
end

if VERSION >= v"0.7.0-DEV.3382"
using Libdl
end

export @build_steps, find_library, download_cmd, unpack_cmd,
Choice, Choices, CCompile, FileDownloader, FileRule,
ChangeDirectory, FileUnpacker, prepare_src,
Expand Down
12 changes: 10 additions & 2 deletions src/dependencies.jl
Expand Up @@ -1010,10 +1010,18 @@ macro install(_libmaps...)
println(depsfile_buffer, join(pre_hooks, "\n"))
println(depsfile_buffer,
"""
if VERSION >= v"0.7.0-DEV.3382"
using Libdl
end
# Macro to load a library
macro checked_lib(libname, path)
((VERSION >= v"0.4.0-dev+3844" ? Base.Libdl.dlopen_e : Base.dlopen_e)(path) == C_NULL) && error("Unable to load \\n\\n\$libname (\$path)\\n\\nPlease re-run Pkg.build(package), and restart Julia.")
quote const \$(esc(libname)) = \$path end
if Libdl.dlopen_e(path) == C_NULL
error("Unable to load \\n\\n\$libname (\$path)\\n\\nPlease ",
"re-run Pkg.build(package), and restart Julia.")
end
quote
const \$(esc(libname)) = \$path
end
end
""")
println(depsfile_buffer, "# Load dependencies")
Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
Expand Up @@ -2,6 +2,10 @@ using Compat
using Compat.Test, Compat.Unicode
using BinDeps

if VERSION >= v"0.7.0-DEV.3382"
using Libdl
end

Pkg.build("Cairo") # Tests apt-get code paths
using Cairo
Pkg.build("HttpParser") # Tests build-from-source code paths
Expand Down

0 comments on commit 4959cd5

Please sign in to comment.