Skip to content

Commit

Permalink
include support for cross platform
Browse files Browse the repository at this point in the history
  • Loading branch information
Rene Donner committed Mar 14, 2015
1 parent a9b34c1 commit 8b1bdcb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
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)\\n\\nPlease re-run Pkg.build(package), and restart Julia.")
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))
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

0 comments on commit 8b1bdcb

Please sign in to comment.