Skip to content
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

WIP: Include support for cross-platform deps.jl #130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/BinDeps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module BinDeps
export @make_run, @build_steps, find_library, download_cmd, unpack_cmd,
Choice, Choices, CCompile, FileDownloader, FileRule,
ChangeDirectory, FileDownloader, FileUnpacker, prepare_src,
autotools_install, CreateDirectory, MakeTargets, SystemLibInstall
autotools_install, CreateDirectory, MakeTargets, SystemLibInstall, include_deps

const dlext = isdefined(Base.Sys, :shlib_ext) ? Base.Sys.shlib_ext : Base.Sys.dlext # Julia 0.2/0.3 compatibility
const shlib_ext = dlext # compatibility with older packages (e.g. ZMQ)
Expand Down
23 changes: 20 additions & 3 deletions src/dependencies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ end

execute(dep::LibraryDependency,method) = run(lower(generate_steps(dep,method)))

macro install (_libmaps...)
macro install (pkgname, _libmaps...)
if length(_libmaps) == 0
return esc(quote
if bindeps_context.do_install
Expand Down Expand Up @@ -822,8 +822,16 @@ macro install (_libmaps...)
"""
# Macro to load a library
macro checked_lib(libname, path)
(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 dlopen_e(path) == C_NULL
depsfile = joinpath(Pkg.dir(pkgname), "deps/deps.jl")
if myid() != 1 && isfile(depsfile)
path = eval(include_string(readall(depsfile)))
else
error("Unable to load \\n\\n\$libname (\$path) on $(gethostname())\\n\\nPlease re-run Pkg.build(package), and restart Julia.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you should print the hostname here. That's not the right layer to handle this kind of information: the host on which the error occurred should be reported by the parallel support code.

end
else
quote const \$(esc(libname)) = \$path end
end
end
""")
println(depsfile, "# Load dependencies")
Expand Down Expand Up @@ -978,6 +986,15 @@ function build(pkg::String, method; dep::String="", force=false)
end
end

function include_deps(pkg::String)
depsfile = joinpath(Pkg.dir(pkg),"deps/deps.jl")
if isfile(depsfile)
include_string(readall(depsfile))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just include(depsfile)?

else
error("$pkg not properly installed. Please run Pkg.build(\"$pkg\")")
end
end

# Calculate the SHA-512 hash of a file
using SHA

Expand Down