Is there a way to to recompile from an edited source code via homebrew?
I did a change on the source user.hpp of Boost which I now want to recompile Boost with. I tried --build-from-source
and --enable-bar
but neither works, saying that it is already installed. The only way I can recompile is by reinstall but that simply overwrites the source code I changed.
Any idea?
First option Download the archive, edit the files, and zip the archive as homebrew does (same name and format).
If you kept the original folder structure created by Homebrew, you can put the modified archive in ~/Library/Caches/Homebrew
and then try brew install -f
. (the -f is maybe not strictly necessary but it may be need for the SHA-1 mismatch.)
More info on this blog.
Second option
Pulled out from the Homebrew wiki, install the package without homebrew and then link it with brew
.
./configure --prefix=/usr/local/Cellar/foo/1.2 && make && make install && brew link foo
Another approach is to add a patch to the homebrew formula (you can edit the formula using brew edit <formula-name>
):
https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md#patches
来源:https://stackoverflow.com/questions/31511553/homebrew-recompile-from-edited-source-code