homebrew-fuse/Formula/cryfs-mac.rb

74 lines
2.6 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"
2021-12-31 23:20:06 +08:00
url "https://github.com/cryfs/cryfs/releases/download/0.11.1/cryfs-0.11.1.tar.xz"
sha256 "55f139b07b9737851cc0d6e26c425a7debc2fabd2a62aa43ba56e5a33ca93ece"
2021-07-27 14:03:33 +08:00
license "LGPL-3.0-only"
bottle do
2021-12-31 23:20:06 +08:00
root_url "https://github.com/gromgit/homebrew-fuse/releases/download/cryfs-mac-0.11.1"
2021-12-31 23:39:31 +08:00
sha256 cellar: :any, monterey: "3591a302c8d6951748db9841ba015b3a4ee5b31c7e1fef5aa4965e1155a5c2f5"
sha256 cellar: :any, big_sur: "a573385e28448c307cafe1d68bea18f78787167389eb7ce0e83aa49d2f386ea6"
2021-12-31 23:58:23 +08:00
sha256 cellar: :any, catalina: "83695fe6cb732222e690245c4bacd2a1283c133f6c6d69e264ab7ae7ba642dfb"
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
2021-07-27 14:03:33 +08:00
configure_args = [
"-GNinja",
"-DBUILD_TESTING=off",
]
if build.head?
libomp = Formula["libomp"]
configure_args.concat(
[
"-DOpenMP_CXX_FLAGS='-Xpreprocessor -fopenmp -I#{libomp.include}'",
"-DOpenMP_CXX_LIB_NAMES=omp",
"-DOpenMP_omp_LIBRARY=#{libomp.lib}/libomp.dylib",
],
)
end
# 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