2010-02-16 07:19:53 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Openssl < Formula
|
2012-04-23 08:09:56 +00:00
|
|
|
homepage 'http://openssl.org'
|
2014-01-13 02:41:16 +00:00
|
|
|
url 'https://www.openssl.org/source/openssl-1.0.1f.tar.gz'
|
2014-01-08 01:42:51 +00:00
|
|
|
mirror 'http://mirrors.ibiblio.org/openssl/source/openssl-1.0.1f.tar.gz'
|
|
|
|
sha256 '6cc2a80b17d64de6b7bac985745fdaba971d54ffd7d38d3556f998d7c0c9cb5a'
|
2010-02-16 07:19:53 +00:00
|
|
|
|
2014-01-21 03:32:52 +00:00
|
|
|
bottle do
|
|
|
|
sha1 "2687c0abb5e23d765bbd0024a010e36b05a8939e" => :mavericks
|
|
|
|
sha1 "dcaee2f1e51e8d0da7614e6dab4fc334f736d0de" => :mountain_lion
|
|
|
|
sha1 "4fabb39f5db46e8e62bf0b05e0133cd7e717860a" => :lion
|
|
|
|
end
|
|
|
|
|
2014-03-12 16:43:37 +00:00
|
|
|
depends_on "makedepend" => :build if MacOS.prefer_64_bit?
|
|
|
|
|
2011-03-16 05:01:31 +00:00
|
|
|
keg_only :provided_by_osx,
|
2012-04-17 09:08:58 +00:00
|
|
|
"The OpenSSL provided by OS X is too old for some software."
|
2010-10-17 15:52:14 +00:00
|
|
|
|
2010-02-16 07:19:53 +00:00
|
|
|
def install
|
2012-04-18 17:00:17 +00:00
|
|
|
args = %W[./Configure
|
|
|
|
--prefix=#{prefix}
|
2013-07-14 00:16:31 +00:00
|
|
|
--openssldir=#{openssldir}
|
2012-04-18 17:00:17 +00:00
|
|
|
zlib-dynamic
|
|
|
|
shared
|
2014-02-06 14:24:18 +00:00
|
|
|
enable-cms
|
2012-04-18 17:00:17 +00:00
|
|
|
]
|
2012-04-17 08:34:14 +00:00
|
|
|
|
2013-04-08 22:04:11 +00:00
|
|
|
if MacOS.prefer_64_bit?
|
|
|
|
args << "darwin64-x86_64-cc" << "enable-ec_nistp_64_gcc_128"
|
2013-08-20 17:11:59 +00:00
|
|
|
|
|
|
|
# -O3 is used under stdenv, which results in test failures when using clang
|
|
|
|
inreplace 'Configure',
|
|
|
|
%{"darwin64-x86_64-cc","cc:-arch x86_64 -O3},
|
|
|
|
%{"darwin64-x86_64-cc","cc:-arch x86_64 -Os}
|
2013-04-08 22:04:11 +00:00
|
|
|
else
|
|
|
|
args << "darwin-i386-cc"
|
|
|
|
end
|
2012-04-17 08:34:14 +00:00
|
|
|
|
|
|
|
system "perl", *args
|
2011-07-22 00:09:26 +00:00
|
|
|
|
2013-08-20 17:11:58 +00:00
|
|
|
ENV.deparallelize
|
2013-08-23 17:36:25 +00:00
|
|
|
system "make", "depend" if MacOS.prefer_64_bit?
|
2010-02-16 07:19:53 +00:00
|
|
|
system "make"
|
2012-04-17 09:08:58 +00:00
|
|
|
system "make", "test"
|
|
|
|
system "make", "install", "MANDIR=#{man}", "MANSUFFIX=ssl"
|
2010-02-16 07:19:53 +00:00
|
|
|
end
|
2013-02-17 18:29:09 +00:00
|
|
|
|
2013-07-14 00:16:31 +00:00
|
|
|
def openssldir
|
|
|
|
etc/"openssl"
|
|
|
|
end
|
|
|
|
|
|
|
|
def cert_pem
|
|
|
|
openssldir/"cert.pem"
|
|
|
|
end
|
|
|
|
|
|
|
|
def osx_cert_pem
|
|
|
|
openssldir/"osx_cert.pem"
|
|
|
|
end
|
2013-02-17 18:29:09 +00:00
|
|
|
|
2013-07-14 00:16:31 +00:00
|
|
|
def write_pem_file
|
|
|
|
system "security find-certificate -a -p /Library/Keychains/System.keychain > '#{osx_cert_pem}.tmp'"
|
|
|
|
system "security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> '#{osx_cert_pem}.tmp'"
|
|
|
|
system "mv", "-f", "#{osx_cert_pem}.tmp", osx_cert_pem
|
|
|
|
end
|
|
|
|
|
|
|
|
def post_install
|
|
|
|
openssldir.mkpath
|
|
|
|
|
|
|
|
if cert_pem.exist?
|
|
|
|
write_pem_file
|
|
|
|
else
|
|
|
|
cert_pem.unlink if cert_pem.symlink?
|
|
|
|
write_pem_file
|
|
|
|
openssldir.install_symlink 'osx_cert.pem' => 'cert.pem'
|
|
|
|
end
|
2013-02-17 18:29:09 +00:00
|
|
|
end
|
2014-01-15 04:05:39 +00:00
|
|
|
|
|
|
|
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
|
2010-02-16 07:19:53 +00:00
|
|
|
end
|