From 4959cd5b60424ef62551dc4acf8bb0bb0872354c Mon Sep 17 00:00:00 2001 From: Alex Arslan Date: Sun, 14 Jan 2018 19:56:42 -0800 Subject: [PATCH] Fixes for Libdl moving to the stdlib (#348) --- src/BinDeps.jl | 4 ++++ src/dependencies.jl | 12 ++++++++++-- test/runtests.jl | 4 ++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/BinDeps.jl b/src/BinDeps.jl index 7cc3924..0116d97 100644 --- a/src/BinDeps.jl +++ b/src/BinDeps.jl @@ -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, diff --git a/src/dependencies.jl b/src/dependencies.jl index 6efea37..aa0e1c7 100644 --- a/src/dependencies.jl +++ b/src/dependencies.jl @@ -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") diff --git a/test/runtests.jl b/test/runtests.jl index ed0c312..6c6ce75 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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