homebrew-fuse/Formula/dwarfs-fuse-mac.rb
Adrian Ho 9c677b9e40
Some checks failed
brew test-bot / test-bot (macos-13) (push) Has been cancelled
brew test-bot / test-bot (macos-14) (push) Has been cancelled
brew test-bot / test-bot (macos-15) (push) Has been cancelled
dwarfs-fuse-mac: update 0.14.1 bottle.
2025-10-29 01:15:56 +00:00

147 lines
4.3 KiB
Ruby

require_relative "../require/macfuse"
class DwarfsFuseMac < Formula
desc "Fast high compression read-only file system (macFUSE driver)"
homepage "https://github.com/mhx/dwarfs"
url "https://github.com/mhx/dwarfs/releases/download/v0.14.1/dwarfs-0.14.1.tar.xz"
sha256 "620cf27f2e142a5f8fc05552a70704c3bf4df23c3279c6026b3f37954d0529c5"
license "GPL-3.0-or-later"
livecheck do
url :stable
regex(/^(?:release[._-])?v?(\d+(?:\.\d+)+)$/i)
strategy :github_latest
end
bottle do
root_url "https://ghcr.io/v2/gromgit/fuse"
sha256 arm64_sequoia: "435146a6369cafb5e9bacfb9470c14c8812b75e68d518041ad3e0125b43c7e43"
sha256 arm64_sonoma: "6bdf459cae00709de615e2df120218898a223d95304abc32e393c47f600adfb2"
end
depends_on "cmake" => :build
depends_on "googletest" => :build
depends_on "pkgconf" => :build
depends_on "boost"
depends_on "brotli"
depends_on "double-conversion"
depends_on "flac"
depends_on "fmt"
depends_on "gflags"
depends_on "glog"
depends_on "howard-hinnant-date"
depends_on "libarchive"
depends_on "libevent"
depends_on "libsodium"
depends_on "llvm" if DevelopmentTools.clang_build_version <= 1500
depends_on "lz4"
depends_on MacfuseRequirement
depends_on :macos
depends_on "nlohmann-json"
depends_on "openssl@3"
depends_on "parallel-hashmap"
depends_on "range-v3"
depends_on "utf8cpp"
depends_on "xxhash"
depends_on "xz"
depends_on "zstd"
conflicts_with "dwarfs", because: "both install the same binaries"
fails_with :clang do
build 1500
cause "Not all required C++20 features are supported"
end
# Workaround for Boost 1.89.0 until upstream Folly fix.
# Issue ref: https://github.com/facebook/folly/issues/2489
# Fix to Undefined symbols for architecture x86_64: "_XXH3_64bits"
patch :DATA
def install
args = %W[
-DBUILD_SHARED_LIBS=ON
-DCMAKE_INSTALL_RPATH=#{rpath}
-DWITH_LIBDWARFS=ON
-DWITH_TOOLS=ON
-DWITH_FUSE_DRIVER=ON
-DWITH_TESTS=ON
-DWITH_MAN_PAGES=ON
-DENABLE_PERFMON=ON
-DTRY_ENABLE_FLAC=ON
-DENABLE_RICEPP=ON
-DENABLE_STACKTRACE=OFF
-DDISABLE_CCACHE=ON
-DDISABLE_MOLD=ON
-DPREFER_SYSTEM_GTEST=ON
]
if DevelopmentTools.clang_build_version <= 1500
# No ASAN for folly
ENV.append "CXXFLAGS", "-D_LIBCPP_HAS_NO_ASAN"
ENV.llvm_clang
# Needed in order to find the C++ standard library
# See: https://github.com/Homebrew/homebrew-core/issues/178435
ENV.prepend "LDFLAGS", "-L#{Formula["llvm"].opt_lib}/unwind -lunwind"
ENV.prepend_path "HOMEBREW_LIBRARY_PATHS", Formula["llvm"].opt_lib/"c++"
end
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
system "cmake", "--build", "build", "--parallel"
system "cmake", "--install", "build"
end
test do
# produce a dwarfs image
system bin/"mkdwarfs", "-i", prefix, "-o", "test.dwarfs", "-l4"
# check the image
system bin/"dwarfsck", "test.dwarfs"
# get JSON info about the image
info = JSON.parse(shell_output("#{bin}/dwarfsck test.dwarfs -j"))
assert_equal info["created_by"], "libdwarfs v#{version}"
assert info["inode_count"] >= 10
# extract the image
system bin/"dwarfsextract", "-i", "test.dwarfs"
assert_path_exists "bin/mkdwarfs"
assert_path_exists "share/man/man1/mkdwarfs.1"
assert compare_file bin/"mkdwarfs", "bin/mkdwarfs"
(testpath/"test.cpp").write <<~CPP
#include <iostream>
#include <dwarfs/version.h>
int main(int argc, char **argv) {
int v = dwarfs::get_dwarfs_library_version();
int major = v / 10000;
int minor = (v % 10000) / 100;
int patch = v % 100;
std::cout << major << "." << minor << "." << patch << std::endl;
return 0;
}
CPP
# ENV.llvm_clang doesn't work in the test block
ENV["CXX"] = Formula["llvm"].opt_bin/"clang++" if OS.mac? && DevelopmentTools.clang_build_version <= 1500
system ENV.cxx, "-std=c++20", "test.cpp", "-I#{include}", "-L#{lib}", "-o", "test", "-ldwarfs_common"
assert_equal version.to_s, shell_output("./test").chomp
end
end
__END__
--- a/folly/CMake/folly-config.cmake.in
+++ b/folly/CMake/folly-config.cmake.in
@@ -38,7 +38,6 @@ find_dependency(Boost 1.51.0 MODULE
filesystem
program_options
regex
- system
thread
REQUIRED
)