【问题标题】:How to I install Ghostscript 9.21 with homebrew?如何使用自制软件安装 Ghostscript 9.21?
【发布时间】:2021-11-17 21:55:30
【问题描述】:

我在项目中一直使用 Ghostscript 9.21,而自制软件正在安装 9.55。如何安装 9.21?我试过brew install ghostscript@9.21,但包没有版本控制。

我想使用https://github.com/Homebrew/homebrew-core/blob/f7092d9202dbfbd9ea0ae70064c59e796b81d5df/Formula/ghostscript.rb,但是当我brew install https://github.com/Homebrew/homebrew-core/blob/f7092d9202dbfbd9ea0ae70064c59e796b81d5df/Formula/ghostscript.rb 时,我得到:

/opt/homebrew/Homebrew/Library/Homebrew/formulary.rb:277:in `load_file': Invalid usage: Installation of ghostscript from a GitHub commit URL is unsupported! `brew extract ghostscript` to a stable tap on GitHub instead. (UsageError)

我一直无法弄清楚如何使用brew extract 进行操作。

【问题讨论】:

    标签: homebrew


    【解决方案1】:

    brew extract 已损坏,a fix 已合并。现在可以提取公式了:

    1. 创建一个 Homebrew 水龙头,公式将被提取到:

      brew tap-new $USER/local-tap
      
    2. 将 Ghostscript 9.21 提取到您的水龙头:

      brew extract --version=9.21 ghostscript $USER/local-tap
      

    但是,仍然需要进行一些更改来修复公式:

    1. HOMEBREW_EDITOR 环境变量设置为您选择的编辑器。我的是code

    2. 运行brew edit ghostscript@9.21

    3. 删除revision 4,因为这是一个新公式。

    4. 补丁的 sha256 哈希值不对,可能是因为a=patch adds the Git version at the bottom of the patch。让我们将 a=patch 更改为 a=commitdiff_plain 并删除 sha256 以便稍后获取新的哈希值:

          patch do
            url "https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff_plain;h=4f83478c88"
            sha256 ""
          end
      
          patch do
            url "https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff_plain;h=04b37bbce1"
            sha256 ""
          end
      
          patch do
            url "https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff_plain;h=57f20719e1"
            sha256 ""
          end
      
    5. 删除devel 块:

      -  devel do
      -    url "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs922rc2/ghostscript-9.22rc2.tar.gz"
      -    sha256 "1861c0cee1e005bd2712873e3058ee1c131c79819625fe479ebcef68e055648e"
      -  end
      

      devel 最近被弃用了。)

    6. 删除depends_on :x11 => :optional(假设您不需要 X11 支持)

    7. 也像这样删除if build.without? "x11"

      -    args << "--without-x" if build.without? "x11"
      +    args << "--without-x"
      

      :x11 已替换为 libx11 公式。)

    8. 现在运行brew install -s ghostscript@9.21,您将获得上述新的 sha256 哈希:

      $ brew install -s ghostscript@9.21
      ==> Downloading https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff_plain;h=4f83478c88
      -#O#- #   #                                                                   
      Warning: Cannot verify integrity of '86093339e3f806acdd14f4ba35d2748f1c31cd4f5008d39a4646e9036b5cb767--ghostpdl.git-4f83478c88.patch'.
      For your reference, the checksum is:
        sha256 "fa46ee96c9896a6feb0f23fd4276023477988c904da52e581efbc78c307eb435"
      

    最后,您的公式应该类似于this

    【讨论】:

      猜你喜欢
      • 2011-10-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-18
      • 2021-12-13
      • 1970-01-01
      相关资源
      最近更新 更多