forked from paulirish/homebrew-versions-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gnutls34.rb
86 lines (72 loc) · 2.46 KB
/
gnutls34.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# This formula tracks GnuTLS stable-next.
class Gnutls34 < Formula
desc "GNU Transport Layer Security (TLS) Library"
homepage "http://gnutls.org"
url "ftp://ftp.gnutls.org/gcrypt/gnutls/v3.4/gnutls-3.4.8.tar.xz"
mirror "https://gnupg.org/ftp/gcrypt/gnutls/v3.4/gnutls-3.4.8.tar.xz"
mirror "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnutls/v3.4/gnutls-3.4.8.tar.xz"
sha256 "e07c05dea525c6bf0dd8017fc5b89d886954f04fedf457ecd1ce488ac3b86ab7"
bottle do
cellar :any
sha256 "79c1c8dfd99d464515b07500408ebbc7350f3f06547a762b6cc5bc23f3e132ab" => :el_capitan
sha256 "834dd7372a004b274a3546c636644edfea7653d06ac4d994c7c8384edcb02720" => :yosemite
sha256 "18108d9274c25c8ffaa3ae2829a07f6940ccddba9af5e5b7bf1d689c19314f8e" => :mavericks
end
depends_on "pkg-config" => :build
depends_on "autogen"
depends_on "libtasn1"
depends_on "gmp"
depends_on "nettle3"
depends_on "guile" => :optional
depends_on "unbound" => :optional
depends_on "libidn" => :optional
keg_only "Conflicts with GnuTLS in main repository."
fails_with :llvm do
build 2326
cause "Undefined symbols when linking"
end
def install
args = %W[
--disable-dependency-tracking
--disable-silent-rules
--disable-static
--prefix=#{prefix}
--sysconfdir=#{etc}/gnutls34
--with-default-trust-store-file=#{etc}/openssl/cert.pem
--disable-heartbeat-support
--without-p11-kit
]
if build.with? "guile"
args << "--enable-guile"
args << "--with-guile-site-dir=no"
end
system "./configure", *args
system "make", "install"
# certtool shadows the OS X certtool utility
mv bin/"certtool", bin/"gnutls-certtool"
mv man1/"certtool.1", man1/"gnutls-certtool.1"
end
def post_install
keychains = %w[
/Library/Keychains/System.keychain
/System/Library/Keychains/SystemRootCertificates.keychain
]
certs_list = `security find-certificate -a -p #{keychains.join(" ")}`
certs = certs_list.scan(
/-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/m
)
valid_certs = certs.select do |cert|
IO.popen("openssl x509 -inform pem -checkend 0 -noout", "w") do |openssl_io|
openssl_io.write(cert)
openssl_io.close_write
end
$?.success?
end
openssldir = etc/"openssl"
openssldir.mkpath
(openssldir/"cert.pem").atomic_write(valid_certs.join("\n"))
end
test do
system bin/"gnutls-cli", "--version"
end
end