Skip to content

Commit 5658876

Browse files
committed
[email protected]: update 1.1.1w bottle.
1 parent 4bf8e48 commit 5658876

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed

Formula/o/[email protected]

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
class OpensslAT11 < Formula
2+
desc "Cryptography and SSL/TLS Toolkit"
3+
homepage "https://openssl.org/"
4+
url "https://www.openssl.org/source/openssl-1.1.1w.tar.gz"
5+
mirror "https://www.mirrorservice.org/sites/ftp.openssl.org/source/openssl-1.1.1w.tar.gz"
6+
mirror "http://www.mirrorservice.org/sites/ftp.openssl.org/source/openssl-1.1.1w.tar.gz"
7+
mirror "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1w.tar.gz"
8+
mirror "https://www.mirrorservice.org/sites/ftp.openssl.org/source/old/1.1.1/openssl-1.1.1w.tar.gz"
9+
mirror "http://www.mirrorservice.org/sites/ftp.openssl.org/source/old/1.1.1/openssl-1.1.1w.tar.gz"
10+
sha256 "cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8"
11+
license "OpenSSL"
12+
version_scheme 1
13+
14+
bottle do
15+
root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/[email protected]"
16+
sha256 cellar: :any_skip_relocation, aarch64_linux: "cebceeba43796d38e73d1cd6f1e6b9e230bb0f50da0b5a88a8428b02b07e053c"
17+
end
18+
19+
keg_only :versioned_formula
20+
21+
# See: https://www.openssl.org/policies/releasestrat.html
22+
deprecate! date: "2023-10-24", because: :unsupported
23+
24+
depends_on "ca-certificates"
25+
26+
on_linux do
27+
resource "Test::Harness" do
28+
url "https://cpan.metacpan.org/authors/id/L/LE/LEONT/Test-Harness-3.44.tar.gz"
29+
mirror "http://cpan.metacpan.org/authors/id/L/LE/LEONT/Test-Harness-3.44.tar.gz"
30+
sha256 "7eb591ea6b499ece6745ff3e80e60cee669f0037f9ccbc4e4511425f593e5297"
31+
end
32+
33+
resource "Test::More" do
34+
url "https://cpan.metacpan.org/authors/id/E/EX/EXODIST/Test-Simple-1.302195.tar.gz"
35+
mirror "http://cpan.metacpan.org/authors/id/E/EX/EXODIST/Test-Simple-1.302195.tar.gz"
36+
sha256 "b390bb23592e0b946c95adbb3c30b11bc634a286b2847be611ad929c57e39a6c"
37+
end
38+
39+
resource "ExtUtils::MakeMaker" do
40+
url "https://cpan.metacpan.org/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.70.tar.gz"
41+
mirror "http://cpan.metacpan.org/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.70.tar.gz"
42+
sha256 "f108bd46420d2f00d242825f865b0f68851084924924f92261d684c49e3e7a74"
43+
end
44+
end
45+
46+
# SSLv2 died with 1.1.0, so no-ssl2 no longer required.
47+
# SSLv3 & zlib are off by default with 1.1.0 but this may not
48+
# be obvious to everyone, so explicitly state it for now to
49+
# help debug inevitable breakage.
50+
def configure_args
51+
args = %W[
52+
--prefix=#{prefix}
53+
--openssldir=#{openssldir}
54+
no-ssl3
55+
no-ssl3-method
56+
no-zlib
57+
]
58+
on_linux do
59+
args += (ENV.cflags || "").split
60+
args += (ENV.cppflags || "").split
61+
args += (ENV.ldflags || "").split
62+
args << "enable-md2"
63+
end
64+
args
65+
end
66+
67+
def install
68+
if OS.linux?
69+
ENV.prepend_create_path "PERL5LIB", buildpath/"lib/perl5"
70+
ENV.prepend_path "PATH", buildpath/"bin"
71+
72+
%w[ExtUtils::MakeMaker Test::Harness Test::More].each do |r|
73+
resource(r).stage do
74+
system "perl", "Makefile.PL", "INSTALL_BASE=#{buildpath}"
75+
system "make", "PERL5LIB=#{ENV["PERL5LIB"]}", "CC=#{ENV.cc}"
76+
system "make", "install"
77+
end
78+
end
79+
end
80+
81+
# This could interfere with how we expect OpenSSL to build.
82+
ENV.delete("OPENSSL_LOCAL_CONFIG_DIR")
83+
84+
# This ensures where Homebrew's Perl is needed the Cellar path isn't
85+
# hardcoded into OpenSSL's scripts, causing them to break every Perl update.
86+
# Whilst our env points to opt_bin, by default OpenSSL resolves the symlink.
87+
ENV["PERL"] = Formula["perl"].opt_bin/"perl" if which("perl") == Formula["perl"].opt_bin/"perl"
88+
89+
arch_args = []
90+
if OS.mac?
91+
arch_args += %W[darwin64-#{Hardware::CPU.arch}-cc enable-ec_nistp_64_gcc_128]
92+
elsif Hardware::CPU.intel?
93+
arch_args << (Hardware::CPU.is_64_bit? ? "linux-x86_64" : "linux-elf")
94+
elsif Hardware::CPU.arm?
95+
arch_args << (Hardware::CPU.is_64_bit? ? "linux-aarch64" : "linux-armv4")
96+
end
97+
98+
system "perl", "./Configure", *(configure_args + arch_args)
99+
system "make"
100+
system "make", "install", "MANDIR=#{man}", "MANSUFFIX=ssl"
101+
system "make", "test"
102+
103+
# Prevent `brew` from pruning the `certs` and `private` directories.
104+
touch %w[certs private].map { |subdir| openssldir/subdir/".keepme" }
105+
end
106+
107+
def openssldir
108+
109+
end
110+
111+
def post_install
112+
rm(openssldir/"cert.pem") if (openssldir/"cert.pem").exist?
113+
openssldir.install_symlink Formula["ca-certificates"].pkgetc/"cert.pem"
114+
end
115+
116+
def caveats
117+
<<~EOS
118+
A CA file has been bootstrapped using certificates from the system
119+
keychain. To add additional certificates, place .pem files in
120+
#{openssldir}/certs
121+
122+
and run
123+
#{opt_bin}/c_rehash
124+
EOS
125+
end
126+
127+
test do
128+
# Make sure the necessary .cnf file exists, otherwise OpenSSL gets moody.
129+
assert_predicate pkgetc/"openssl.cnf", :exist?,
130+
"OpenSSL requires the .cnf file for some functionality"
131+
132+
# Check OpenSSL itself functions as expected.
133+
(testpath/"testfile.txt").write("This is a test file")
134+
expected_checksum = "e2d0fe1585a63ec6009c8016ff8dda8b17719a637405a4e23c0ff81339148249"
135+
system bin/"openssl", "dgst", "-sha256", "-out", "checksum.txt", "testfile.txt"
136+
open("checksum.txt") do |f|
137+
checksum = f.read(100).split("=").last.strip
138+
assert_equal checksum, expected_checksum
139+
end
140+
end
141+
end

0 commit comments

Comments
 (0)