homebrew-core/Formula/libressl.rb
2015-01-22 17:13:20 +01:00

73 lines
2.3 KiB
Ruby

class Libressl < Formula
homepage "http://www.libressl.org/"
url "http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.1.3.tar.gz"
mirror "https://raw.githubusercontent.com/DomT4/LibreMirror/master/LibreSSL/libressl-2.1.3.tar.gz"
sha256 "eb2f370971408fb10af6453e556465c8eee728ac333bf1eb47ec1a5112304f7c"
option "without-libtls", "Build without libtls"
bottle do
sha1 "a27d907fe3d72f735b2c546fb470b5794dadb731" => :yosemite
sha1 "880ef498373994ac459e026d7e2e48d3145653a8" => :mavericks
sha1 "8ebe481e3399d1e833e293caf90bf6936a286145" => :mountain_lion
end
head do
url "https://github.com/libressl-portable/portable.git"
depends_on "automake" => :build
depends_on "autoconf" => :build
depends_on "libtool" => :build
end
keg_only "LibreSSL is not linked to prevent conflict with the system OpenSSL."
def install
args = %W[
--disable-dependency-tracking
--disable-silent-rules
--prefix=#{prefix}
--with-openssldir=#{etc}/libressl
--sysconfdir=#{etc}/libressl
--with-enginesdir=#{lib}/engines
]
args << "--enable-libtls" if build.with? "libtls"
system "./autogen.sh" if build.head?
system "./configure", *args
system "make"
system "make", "check"
system "make", "install"
# Install the dummy openssl.cnf file to stop runtime warnings.
mkdir_p "#{etc}/libressl"
cp "apps/openssl.cnf", "#{etc}/libressl"
end
def post_install
keychains = %w[
/Library/Keychains/System.keychain
/System/Library/Keychains/SystemRootCertificates.keychain
]
# Bootstrap CAs from the system keychain.
(etc/"libressl/cert.pem").atomic_write `security find-certificate -a -p #{keychains.join(" ")}`
end
def caveats; <<-EOS.undent
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
#{etc}/libressl
EOS
end
test do
(testpath/"testfile.txt").write("This is a test file")
expected_checksum = "91b7b0b1e27bfbf7bc646946f35fa972c47c2d32"
system "#{bin}/openssl", "dgst", "-sha1", "-out", "checksum.txt", "testfile.txt"
open("checksum.txt") do |f|
checksum = f.read(100).split("=").last.strip
assert_equal checksum, expected_checksum
end
end
end