homebrew-fuse/Formula/cryfs-mac.rb

66 lines
2.4 KiB
Ruby
Raw Normal View History

2021-07-27 14:03:33 +08:00
require_relative "../require/macfuse"
class CryfsMac < Formula
desc "Encrypts your files so you can safely store them in Dropbox, iCloud, etc."
homepage "https://www.cryfs.org"
2022-02-22 22:51:23 +08:00
url "https://github.com/cryfs/cryfs/releases/download/0.11.2/cryfs-0.11.2.tar.xz"
sha256 "951ef565d37521df5586b00ed898f1cb76188739c27b9db866cc91ca14fdf1bd"
2021-07-27 14:03:33 +08:00
license "LGPL-3.0-only"
bottle do
2022-02-22 22:51:23 +08:00
root_url "https://github.com/gromgit/homebrew-fuse/releases/download/cryfs-mac-0.11.2"
sha256 cellar: :any, arm64_monterey: "f4b9f8c635f85b06dc55ef6f1bf44c2b30d2d6635fa43834df73b973399b2032"
2022-02-22 23:07:48 +08:00
sha256 cellar: :any, mojave: "1d9df6d37cfe7f8c36ef942bcc093a3e8a50318ace2ebc5a7500af9120a589b2"
2021-07-27 14:03:33 +08:00
end
head do
url "https://github.com/cryfs/cryfs.git", branch: "develop", shallow: false
end
depends_on "cmake" => :build
depends_on "conan" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
2021-11-13 11:34:00 +08:00
depends_on "curl"
2021-07-27 14:03:33 +08:00
depends_on "libomp"
depends_on MacfuseRequirement
depends_on :macos
depends_on "openssl@1.1"
def install
setup_fuse
2021-11-13 11:34:00 +08:00
2022-02-22 22:51:23 +08:00
libomp = Formula["libomp"]
2021-07-27 14:03:33 +08:00
configure_args = [
"-GNinja",
"-DBUILD_TESTING=off",
2022-02-22 22:51:23 +08:00
"-DOpenMP_CXX_FLAGS='-Xpreprocessor -fopenmp -I#{libomp.include}'",
"-DOpenMP_CXX_LIB_NAMES=omp",
"-DOpenMP_omp_LIBRARY=#{libomp.lib}/libomp.dylib",
2021-07-27 14:03:33 +08:00
]
# macFUSE puts pkg-config into /usr/local/lib/pkgconfig, which is not included in
# homebrew's default PKG_CONFIG_PATH. We need to tell pkg-config about this path for our build
ENV.prepend_path "PKG_CONFIG_PATH", "#{HOMEBREW_PREFIX}/lib/pkgconfig"
system "cmake", ".", *configure_args, *std_cmake_args
system "ninja", "install"
end
test do
ENV["CRYFS_FRONTEND"] = "noninteractive"
# Test showing help page
assert_match "CryFS", shell_output("#{bin}/cryfs 2>&1", 10)
# Test mounting a filesystem. This command will ultimately fail because homebrew tests
# don't have the required permissions to mount fuse filesystems, but before that
# it should display "Mounting filesystem". If that doesn't happen, there's something
# wrong. For example there was an ABI incompatibility issue between the crypto++ version
# the cryfs bottle was compiled with and the crypto++ library installed by homebrew to.
mkdir "basedir"
mkdir "mountdir"
assert_match "Operation not permitted", pipe_output("#{bin}/cryfs -f basedir mountdir 2>&1", "password")
end
end