homebrew-core/Formula/mcrypt.rb

84 lines
2.8 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-or-later"
bottle do
rebuild 4
sha256 cellar: :any, arm64_big_sur: "849ffa4e23dff9bff130c10d8ace02994034120b7d97ad36e9d7f6e8c048f97a"
sha256 cellar: :any, big_sur: "e3182ac2f12baccfab81146bb4c6944b05154259a65165d694ca64e43d1f03f7"
sha256 cellar: :any, catalina: "a52070083dfe080bbe0b8f71597a8a619c6b1421970c4670c6f40f5f2ba0fafe"
sha256 cellar: :any, mojave: "6a23409a37396e2b2256485737a8195b06dcdea3607583e509f1d87d6a75faec"
sha256 x86_64_linux: "33da6d2acf84ccd0db1ae1f9b82b0068a97bb6e8ba1de5dd310fc31c949ed432"
end
deprecate! date: "2022-10-27", because: "does not build from source from Monterey upwards"
# Added automake as a build dependency to update config files in libmcrypt.
# Please remove in future if there is a patch upstream which recognises aarch64 macos.
depends_on "automake" => :build
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
# Work around configure issues with Xcode 12
ENV.append "CFLAGS", "-Wno-implicit-function-declaration"
resource("libmcrypt").stage do
# Workaround for ancient config files not recognising aarch64 macos.
%w[config.guess config.sub].each do |fn|
cp "#{Formula["automake"].opt_prefix}/share/automake-#{Formula["automake"].version.major_minor}/#{fn}", fn
end
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"