homebrew-core/Formula/mbedtls.rb
2018-08-20 09:48:06 +02:00

45 lines
1.9 KiB
Ruby

class Mbedtls < Formula
desc "Cryptographic & SSL/TLS library"
homepage "https://tls.mbed.org/"
url "https://tls.mbed.org/download/mbedtls-2.12.0-apache.tgz"
sha256 "a2bed048f41a19ec7b4dd2e96649145bbd68a6955c3b51aeb7ccbf8908c3ce97"
head "https://github.com/ARMmbed/mbedtls.git", :branch => "development"
bottle do
cellar :any
sha256 "44da886a1f06da812d55da26601fda0dedc176878acfc9b0971e85b3ea0be418" => :mojave
sha256 "83c83b029f1ce10ae3f51cd90c100564e3996cbcf733c86af8c87cc894d2daab" => :high_sierra
sha256 "ba6e822cb042d5d2deaf67272a3abb0742fa40cad7bb2d384f59e8eb356cbc38" => :sierra
sha256 "3bb3d07ad8bb5341d54ded21b3497b95a253b1f4a9613a682984d01c76940210" => :el_capitan
end
depends_on "cmake" => :build
def install
inreplace "include/mbedtls/config.h" do |s|
# enable pthread mutexes
s.gsub! "//#define MBEDTLS_THREADING_PTHREAD", "#define MBEDTLS_THREADING_PTHREAD"
# allow use of mutexes within mbed TLS
s.gsub! "//#define MBEDTLS_THREADING_C", "#define MBEDTLS_THREADING_C"
end
system "cmake", "-DUSE_SHARED_MBEDTLS_LIBRARY=On", *std_cmake_args
system "make"
system "make", "install"
# Why does Mbedtls ship with a "Hello World" executable. Let's remove that.
rm_f bin/"hello"
# Rename benchmark & selftest, which are awfully generic names.
mv bin/"benchmark", bin/"mbedtls-benchmark"
mv bin/"selftest", bin/"mbedtls-selftest"
# Demonstration files shouldn't be in the main bin
libexec.install bin/"mpi_demo"
end
test do
(testpath/"testfile.txt").write("This is a test file")
# Don't remove the space between the checksum and filename. It will break.
expected_checksum = "e2d0fe1585a63ec6009c8016ff8dda8b17719a637405a4e23c0ff81339148249 testfile.txt"
assert_equal expected_checksum, shell_output("#{bin}/generic_sum SHA256 testfile.txt").strip
end
end