homebrew-core/Formula/watchman.rb

84 lines
3.1 KiB
Ruby

class Watchman < Formula
desc "Watch files and take action when they change"
homepage "https://github.com/facebook/watchman"
url "https://github.com/facebook/watchman/archive/v2022.06.27.00.tar.gz"
sha256 "50940f77c4c27859ff0f0b5f880e596dd9ecfc53e7ef9b4f72bf75bc61423253"
license "MIT"
revision 1
head "https://github.com/facebook/watchman.git", branch: "main"
bottle do
sha256 cellar: :any, arm64_monterey: "ffd4296f97eb7be502a7af6ca6363bec46b8700d0d5347c6914910d4a4e5cb56"
sha256 cellar: :any, arm64_big_sur: "ee0151d4c73d4218458a36854eb3220adba856e541ab3af05c87378775959885"
sha256 cellar: :any, monterey: "da44d09f29d01c1cade9dda586a053d368fba0661361aaeba9cc84a5a1f46ab3"
sha256 cellar: :any, big_sur: "968f7aeff4ffcd4d70816bb8cae29744cd6c7f147b8cc3c91996f230ebcd0fed"
sha256 cellar: :any, catalina: "ff97b79d7f44d5cb2f72ae40d4bda141419ac3b6a7384da43f93919aeab0089b"
sha256 x86_64_linux: "7e90a03210b7ca896e8b974823d928159dde457b45e566f9bef28dc676f9c6a1"
end
# https://github.com/facebook/watchman/issues/963
pour_bottle? only_if: :default_prefix
depends_on "cmake" => :build
depends_on "googletest" => :build
depends_on "pkg-config" => :build
depends_on "rust" => :build
depends_on "boost"
depends_on "fmt"
depends_on "folly"
depends_on "gflags"
depends_on "glog"
depends_on "libevent"
depends_on "openssl@1.1"
depends_on "pcre"
depends_on "python@3.10"
# Dependencies for Eden support. Enabling Eden support fails to build on Linux.
on_macos do
depends_on "cpptoml" => :build
depends_on "fb303"
end
on_linux do
depends_on "gcc"
end
fails_with gcc: "5"
def install
# Fix build failure on Linux. Borrowed from Fedora:
# https://src.fedoraproject.org/rpms/watchman/blob/rawhide/f/watchman.spec#_70
inreplace "CMakeLists.txt", /^t_test/, "#t_test" if OS.linux?
# NOTE: Setting `BUILD_SHARED_LIBS=ON` will generate DSOs for Eden libraries.
# These libraries are not part of any install targets and have the wrong
# RPATHs configured, so will need to be installed and relocated manually
# if they are built as shared libraries. They're not used by any other
# formulae, so let's link them statically instead. This is done by default.
system "cmake", "-S", ".", "-B", "build",
"-DENABLE_EDEN_SUPPORT=#{OS.mac?}",
"-DWATCHMAN_VERSION_OVERRIDE=#{version}",
"-DWATCHMAN_BUILDINFO_OVERRIDE=#{tap.user}",
"-DWATCHMAN_STATE_DIR=#{var}/run/watchman",
*std_cmake_args
# Workaround for `Process terminated due to timeout`
ENV.deparallelize { system "cmake", "--build", "build" }
system "cmake", "--install", "build"
path = Pathname.new(File.join(prefix, HOMEBREW_PREFIX))
bin.install Dir[path/"bin/*"]
lib.install Dir[path/"lib/*"]
path.rmtree
end
def post_install
(var/"run/watchman").mkpath
chmod 042777, var/"run/watchman"
end
test do
assert_equal(version.to_s, shell_output("#{bin}/watchman -v").chomp)
end
end