homebrew-core/Formula/mcrypt.rb

74 lines
2.0 KiB
Ruby

class Mcrypt < Formula
desc "Replacement for the old crypt package and crypt(1) command"
homepage "https://mcrypt.sourceforge.io"
url "https://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz"
sha256 "5145aa844e54cca89ddab6fb7dd9e5952811d8d787c4f4bf27eb261e6c182098"
license "GPL-3.0"
livecheck do
url :stable
end
bottle do
cellar :any
rebuild 2
sha256 "c9d3313218375e8bca6e22b00fcb47f11550c386ae64422bb59869af161cf6eb" => :catalina
sha256 "b79e4ba583c523e382d1cc08430c96252c8e048cc1661ab3a9bed90468c8b06c" => :mojave
sha256 "e11c2a7a1caf26c2a1d3d171d3291888e065ba0328f6934882cffcaec72475cd" => :high_sierra
end
depends_on "mhash"
uses_from_macos "zlib"
resource "libmcrypt" do
url "https://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz"
sha256 "e4eb6c074bbab168ac47b947c195ff8cef9d51a211cdd18ca9c9ef34d27a373e"
end
# Patch to correct inclusion of malloc function on OSX.
# Upstream: https://sourceforge.net/p/mcrypt/patches/14/
patch :DATA
def install
resource("libmcrypt").stage do
system "./configure", "--prefix=#{prefix}",
"--mandir=#{man}"
system "make", "install"
end
system "./configure", "--prefix=#{prefix}",
"--with-libmcrypt-prefix=#{prefix}",
"--mandir=#{man}"
system "make", "install"
end
test do
(testpath/"test.txt").write <<~EOS
Hello, world!
EOS
system bin/"mcrypt", "--key", "TestPassword", "--force", "test.txt"
rm "test.txt"
system bin/"mcrypt", "--key", "TestPassword", "--decrypt", "test.txt.nc"
end
end
__END__
diff --git a/src/rfc2440.c b/src/rfc2440.c
index 5a1f296..aeb501c 100644
--- a/src/rfc2440.c
+++ b/src/rfc2440.c
@@ -23,7 +23,12 @@
#include <zlib.h>
#endif
#include <stdio.h>
+
+#ifdef __APPLE__
+#include <malloc/malloc.h>
+#else
#include <malloc.h>
+#endif
#include "xmalloc.h"
#include "keys.h"