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

better ext.jl #77

Open
vtjnash opened this issue Jan 25, 2014 · 1 comment
Open

better ext.jl #77

vtjnash opened this issue Jan 25, 2014 · 1 comment

Comments

@vtjnash
Copy link
Member

vtjnash commented Jan 25, 2014

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
Copy link
Member

timholy commented Sep 30, 2014

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants