aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend/os/mac/requirements/osxfuse_requirement.rb
blob: 3f10a951acb3c2cd95835c9d4d5d011806385d70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require "requirement"

class OsxfuseRequirement < Requirement
  cask "osxfuse"
  download "https://osxfuse.github.io/"

  satisfy(build_env: false) { self.class.binary_osxfuse_installed? }

  def self.binary_osxfuse_installed?
    File.exist?("/usr/local/include/osxfuse/fuse.h") &&
      !File.symlink?("/usr/local/include/osxfuse")
  end

  env do
    ENV.append_path "PKG_CONFIG_PATH", HOMEBREW_LIBRARY/"Homebrew/os/mac/pkgconfig/fuse"

    unless HOMEBREW_PREFIX.to_s == "/usr/local"
      ENV.append_path "HOMEBREW_LIBRARY_PATHS", "/usr/local/lib"
      ENV.append_path "HOMEBREW_INCLUDE_PATHS", "/usr/local/include/osxfuse"
    end
  end
end

class NonBinaryOsxfuseRequirement < Requirement
  fatal true
  satisfy(build_env: false) { HOMEBREW_PREFIX.to_s != "/usr/local" || !OsxfuseRequirement.binary_osxfuse_installed? }

  def message
    <<~EOS
      osxfuse is already installed from the binary distribution and
      conflicts with this formula.
    EOS
  end
end