JuliaPackaging / BinDeps.jl

Tool for building binary dependencies for Julia modules
Other
56 stars 74 forks source link

better ext.jl #77

Open vtjnash opened 10 years ago

vtjnash commented 10 years ago

It would be nice if packages ship with a default ext.jl file which just worked if the user already had the dependencies. The hinderance to this appears to be the convoluted way in which the ext.jl file is generated: it uses a macro to do the runtime dlopen check. https://github.com/JuliaLang/BinDeps.jl/blob/master/src/dependencies.jl#L477

Instead, I propose the following template for ext.jl. ext_paths.jl would be auto-generated and would return the set of paths that BinDeps wants to search:

ext_paths = isfile("ext_paths.jl") ? include("ext_paths.jl") : String[]

checked_lib(path::String) = checked_lib([path])
function checked_lib{T}(path::Vector{T})
  lib = find_library(path, ext_paths)
  lib != "" || error("Unable to load $path\n\nPlease re-run Pkg.build(package), and restart Julia.")
  lib
end
_jl_libpangocairo = checked_lib("libpangocairo-1.0")
_jl_libcairo = checked_lib("libcairo")
_jl_libgobject = checked_lib("libgobject-2.0")
_jl_libpango = checked_lib("libpango-1.0")
#some_lib = checked_lib(["name1", "name2"])

This still assumes that the runtime name/location of the file is mostly constant, but it also allows some runtime determination and checking.

timholy commented 10 years ago

That link to the problematic macro is out of date (not surprising, since this was filed in January). @vtjnash, just so the rest of us can understand, can you edit it using y to get a permalink to a particular version of the file?