From 0dc2c177e71a7199d6767f4e1b0e77fa9bb1652b Mon Sep 17 00:00:00 2001 From: Adrian Ho Date: Thu, 5 Sep 2024 01:05:59 +0800 Subject: [PATCH] libxcrypt: update 4.4.36 bottle. --- Formula/lib/libxcrypt.rb | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Formula/lib/libxcrypt.rb diff --git a/Formula/lib/libxcrypt.rb b/Formula/lib/libxcrypt.rb new file mode 100644 index 00000000000..6d7e5b44a47 --- /dev/null +++ b/Formula/lib/libxcrypt.rb @@ -0,0 +1,63 @@ +class Libxcrypt < Formula + desc "Extended crypt library for descrypt, md5crypt, bcrypt, and others" + homepage "https://github.com/besser82/libxcrypt" + url "https://github.com/besser82/libxcrypt/releases/download/v4.4.36/libxcrypt-4.4.36.tar.xz" + sha256 "e5e1f4caee0a01de2aee26e3138807d6d3ca2b8e67287966d1fefd65e1fd8943" + license "LGPL-2.1-or-later" + + livecheck do + url :stable + strategy :github_latest + end + + bottle do + root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/libxcrypt-4.4.36" + sha256 cellar: :any_skip_relocation, aarch64_linux: "555a7fa3314db9771803f4e46f1fc231fd48b9b180f10a503c12ec786d322378" + end + + keg_only :provided_by_macos + + link_overwrite "include/crypt.h" + link_overwrite "lib/libcrypt.so" + + def install + system "./configure", *std_configure_args, + "--disable-static", + "--disable-obsolete-api", + "--disable-xcrypt-compat-files", + "--disable-failure-tokens", + "--disable-valgrind" + system "make", "install" + end + + test do + (testpath/"test.c").write <<~EOS + #include + #include + #include + #include + + int main() + { + char *hash = crypt("abc", "$2b$05$abcdefghijklmnopqrstuu"); + + if (errno) { + fprintf(stderr, "Received error: %s", strerror(errno)); + return errno; + } + if (hash == NULL) { + fprintf(stderr, "Hash is NULL"); + return -1; + } + if (strcmp(hash, "$2b$05$abcdefghijklmnopqrstuuRWUgMyyCUnsDr8evYotXg5ZXVF/HhzS")) { + fprintf(stderr, "Unexpected hash output"); + return -1; + } + + return 0; + } + EOS + system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lcrypt", "-o", "test" + system "./test" + end +end