JuliaPackaging / Homebrew.jl

OSX Binary dependency provider for Julia
Other
27 stars 32 forks source link

Updated readme example for 1.0 #250

Open IanButterworth opened 5 years ago

IanButterworth commented 5 years ago

Apart from the depreciated @osx_only macro, is there anything else outdated on the build.jl code on the readme? @staticfloat

using BinDeps
@BinDeps.setup
nettle = library_dependency("nettle", aliases = ["libnettle","libnettle-4-6"])

...
# Wrap in @static Sys.isapple() to avoid non-OSX users from erroring out
@static Sys.isapple()
    using Homebrew
    provides( Homebrew.HB, "nettle", nettle, os = :Darwin )
end
staticfloat commented 5 years ago

I'm not certain what you're asking? Could you be a little bit more specific? Are you seeing some kind of error?

IanButterworth commented 5 years ago

You're right, apologies for lack of detail. The errors I'm experiencing in using the example are 1) @osx_only is depreciated in 1.0 2) The code below seems to attempt to install GraphViz with every build. I assumed that it would install once and detect from thereon

using BinDeps
@BinDeps.setup
graphviz = library_dependency("graphviz")

@static if Sys.isapple()    
    using Homebrew
    if !Homebrew.installed("graphviz")
        println("Installing GraphViz in local homebrew environment")
        provides( Homebrew.HB, "graphviz", graphviz, os = :Darwin )
    else
        println("GraphViz already installed in local homebrew environment")
    end
end
staticfloat commented 5 years ago

The intention for this package is to have these commands within your deps/build.jl file. That file gets run once at Pkg.build() time, which typically happens directly after package installation. If you think the README can be worded better (it probably can) I would be happy to merge a documentation fix.

IanButterworth commented 5 years ago

Indeed, the code I mentioned resides in deps/build.jl. I'm referring to the build process detecting whether a Homebrew package is installed already and acting accordingly.

i.e. Homebrew.installed("graphviz") is perpetually false when the package is built and rebuilt.

Or is that expected behavior? Is the Homebrew installation environment local to the package itself and thus destroyed at the start of a rebuild? (I had assumed it was a local julia-wide environment, thus sustained outside of packages)

staticfloat commented 5 years ago

Hmmm, no, Homebrew.jl should definitely be installing into a Homebrew-version-specific directory. E.g. packages/Homebrew.jl/<homebrew/julia version hash>/deps/usr. So if you Homebrew.add("graphviz"), unless something goes wrong, Homebrew.installed("graphviz") should be true.

IanButterworth commented 5 years ago

Indeed, Homebrew.add(pkg) does result in the package installing and being detectable. However the provides( line in the example doesn’t seem to invoke the installation of graphviz.

staticfloat commented 5 years ago

That's correct; it only registers Homebrew as one possible provider of graphviz. You need a BinDeps.@install at the bottom of your installation script to actually do the installation. I've added that to the README now.