修改自制软件包的源代码。

24

我使用Homebrew安装了一个包(qt),现在想要修改源代码并重新构建该软件。但是我好像找不到源代码的位置。brew --cache返回的目录不存在,qt的源代码也不在/usr/local/Cellar中。我是否漏掉了什么?Homebrew在构建完应用之后会移除源代码吗?

2个回答

20

Homebrew仅保留二进制文件。如果您的Homebrew缓存目录(通常位于/Library/Caches/Homebrew,但可以使用brew --cache找到,如您所指出)已被移动或删除,则需要重新获取源代码。您可以使用brew fetch qt仅获取源代码。


4
不确定这是否是Homebrew最近更改的内容,但我发现我的下载软件包位于/Library/Caches...而不是~/Library/Caches...,以防对任何人有所帮助! - taber

10

如果你只得到了源代码包,可能会缺少配方中包含的补丁,而不是你当前运行的二进制文件的确切源代码。为了获取应用了补丁的源代码树,可以执行以下操作:

brew unpack --patch <formula>

以下是man页面的内容:

   unpack [--git|--patch] [--destdir=path] formulae
          Unpack the source files for formulae into subdirectories of  the
          current  working directory. If --destdir=path is given, the sub-
          directories will be created in the  directory  named  by  <path>
          instead.

          If  --patch  is  passed, patches for formulae will be applied to
          the unpacked source.

          If --git is passed, a Git repository will be initalized  in  the
          unpacked  source.  This  is  useful for creating patches for the
          software.

3
当我修改了本地源代码后,如何构建并安装软件包? - juanes
1
@juanes https://dev59.com/x43da4cB1Zd3GeqPwS9r - Braham Snyder

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接