23

我用自制软件(qt)安装了一个包。我想修改源代码并重建包。不过,我似乎找不到源代码。brew --cache返回一个不存在的目录,并且 qt 的代码不在 /usr/local/Cellar 中。我错过了什么吗?构建应用程序后自制程序会删除源代码吗?

4

2 回答 2

20

Homebrew 只保留二进制文件。如果您的 Homebrew 缓存目录(通常位于/Library/Caches/Homebrew,但可以使用 找到brew --cache,如您所述)已被移动或删除,那么您将不得不再次获取源代码。您可以使用brew fetch qt.

于 2011-02-01T05:35:56.293 回答
7

如果您只获得源包,它可能缺少公式中包含的补丁,而不是您当前运行的二进制文件的源。要获取应用了补丁的源代码树,您可以执行以下操作:

brew unpack --patch <formula>

从手册页:

   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.
于 2016-04-03T12:57:50.790 回答