Strategy for copying binary from dynamically named build folder


I’m working on a new formular but I’m not sure how to solve the following. Currently, my install method looks like this:

 def install
    system "./configure"
    system "make"
    bin.install "build.fn/x86_64-darwin-LLVM-9.1.0-debug/scc"

As you can probably tell, the path changes with different versions of LLVM, the same might be true for the suffix of the build folder (will test this at home).

My first idea was to read the version printed out by clang, but this is what the output looks like:

$ clang --version
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.6.0
Thread model: posix

Should I use Regex to get the version and if so, does Homebrew provide a method for this or should I just to with match()? Or is there an even better way I haven’t thought of yet? If it helps: there aren’t any other files or folders inside the build folder.

(Jonathan Chang) #2

Would it be possible to pass a flag to configure or make (or use make install?) that would put the binaries in the right place? Alternatively you could try something like:

bin.install Dir["build.fn/**/scc"]


Unfortunately not, but I’ve requested this from the author.

This works great, thank you!