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.05.16.00.tar.gz" sha256 "2d34f33333f51ddd66775c0efd4571d34c4b8e3de1707866a90830a51563ca2d" license "MIT" head "https://github.com/facebook/watchman.git", branch: "main" bottle do sha256 cellar: :any, arm64_monterey: "89ff7d145f58715c62231c95deaf339a2018e1fd4fe5647f80ce870b62c75f89" sha256 cellar: :any, arm64_big_sur: "b04d5bdda96556958acb8812fd8ad09cf8e27c57a9c1abb8470b5592472b64a8" sha256 cellar: :any, monterey: "45085292b5d29fa1fd93885ae6715b98d0274d57dca4a7de63a375a01c3f2074" sha256 cellar: :any, big_sur: "e307bbe55fb871e79ee2211a61e9a286c75553065c30c8d46d5b62bf5cd45515" sha256 cellar: :any, catalina: "43d25b1fac52edda629f3b73a4e7e700244c3dd84d9c3973987acee4de08e936" sha256 x86_64_linux: "ee3c3f2b71aef2360db32d1b364d3939ab6ff583927ed5fc29ad143f95c2c69a" 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