Skip to content

Commit

Permalink
libressl: upstream tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
DomT4 authored and MikeMcQuaid committed Aug 9, 2015
1 parent 6563396 commit 7cf4924
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Formula/libressl.rb
Expand Up @@ -27,18 +27,13 @@ def install
--prefix=#{prefix}
--with-openssldir=#{etc}/libressl
--sysconfdir=#{etc}/libressl
--with-enginesdir=#{lib}/engines
]

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.
(etc/"libressl/certs").mkpath
(etc/"libressl").install "apps/openssl.cnf"
end

def post_install
Expand All @@ -61,6 +56,8 @@ def post_install
$?.success?
end

# LibreSSL install a default pem - We prefer to use OS X for consistency.
rm_f etc/"libressl/cert.pem"
(etc/"libressl/cert.pem").atomic_write(valid_certs.join("\n"))
end

Expand All @@ -75,9 +72,14 @@ def caveats; <<-EOS.undent
end

test do
# Make sure the necessary .cnf file exists, otherwise LibreSSL gets moody.
assert (HOMEBREW_PREFIX/"etc/libressl/openssl.cnf").exist?,
"LibreSSL requires the .cnf file for some functionality"

# Check LibreSSL itself functions as expected.
(testpath/"testfile.txt").write("This is a test file")
expected_checksum = "91b7b0b1e27bfbf7bc646946f35fa972c47c2d32"
system bin/"openssl", "dgst", "-sha1", "-out", "checksum.txt", "testfile.txt"
expected_checksum = "e2d0fe1585a63ec6009c8016ff8dda8b17719a637405a4e23c0ff81339148249"
system "#{bin}/openssl", "dgst", "-sha256", "-out", "checksum.txt", "testfile.txt"
open("checksum.txt") do |f|
checksum = f.read(100).split("=").last.strip
assert_equal checksum, expected_checksum
Expand Down

0 comments on commit 7cf4924

Please sign in to comment.