Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename files in install part of homebrew formula

Tags:

homebrew

I'm writing a homebrew formula, that installs a alternate clang version. As I want both, the original, system-provided clang and the modified clang in my PATH, I would like to rename the modified one to clang-omp.

One attempt is to do this in the install-part of the formula. Sadly without success.

def install
  #...
  system "./configure", "--prefix=#{prefix}"
  system "make", "install"

  # The following isn't working:
  (bin/'clang').mv 'clang-omp'
  (bin/'clang++').mv 'clang++-omp'
end

Another idea was to mark the formula as keg-only, and create install the binaries manually while changing the names.

Yet another approach (maybe the best) might be to configure the symlinks created in /usr/local/bin/*. But I can't find any information on the symlink creation step.

like image 540
Sebastian S Avatar asked Oct 15 '14 21:10

Sebastian S


2 Answers

In install: mv bin/"clang", bin/"clang-omp"

Grepping through the installed formulas in e.g. /usr/local/Library/Formula can give you a good sense of what works.

like image 181
Tim Smith Avatar answered Nov 16 '22 23:11

Tim Smith


According to this paragraph of the Homebrew formula cookbook documentation, one could rename a package by using the => notation, e.g.:

def install
  bin.install "n3dr-macos-10.15" => "n3dr"
end
like image 24
030 Avatar answered Nov 16 '22 22:11

030