-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcurl-without-ipv6.rb
100 lines (84 loc) · 3.12 KB
/
curl-without-ipv6.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# The formula is a copy of homebrew/core/curl with disabled IPv6 support.
class CurlWithoutIpv6 < Formula
desc "Get a file from an HTTP, HTTPS or FTP server"
homepage "https://curl.se"
url "https://curl.se/download/curl-8.11.1.tar.bz2"
sha256 "e9773ad1dfa21aedbfe8e1ef24c9478fa780b1b3d4f763c98dd04629b5e43485"
license "curl"
livecheck do
url "https://curl.se/download/"
regex(/href=.*?curl[._-]v?(.*?)\.t/i)
end
bottle do
root_url "https://ghcr.io/v2/bayandin/tap"
sha256 cellar: :any, arm64_sequoia: "91e08007809ad7b9e25f6b0b3103f8d53cc5383176389209b4463a837fb4e669"
sha256 cellar: :any, arm64_sonoma: "0436b3521ba01f06d8e372273d5faf7c2ca139fcf860581673f0bf3bc16533a4"
sha256 cellar: :any, ventura: "217504fa98c4808f56245360c7433bb0b1ff0de9adf625ec17e66844225ed405"
sha256 cellar: :any_skip_relocation, x86_64_linux: "208adc00ced159648d9a202ad79da3b1e05b18ba88f167350d1f520902e8c197"
end
head do
url "https://github.com/curl/curl.git", branch: "master"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
keg_only "it shouldn't be used as a general-purpose curl replacement"
depends_on "pkg-config" => :build
depends_on "brotli"
depends_on "libidn2"
depends_on "libnghttp2"
depends_on "libssh2"
depends_on "openldap"
depends_on "openssl@3"
depends_on "rtmpdump"
depends_on "zstd"
uses_from_macos "krb5"
uses_from_macos "zlib"
def install
system "./buildconf" if build.head?
args = %W[
--disable-debug
--disable-dependency-tracking
--disable-silent-rules
--prefix=#{prefix}
--with-ssl=#{Formula["openssl@3"].opt_prefix}
--without-ca-bundle
--without-ca-path
--with-ca-fallback
--with-secure-transport
--with-default-ssl-backend=openssl
--with-libidn2
--with-librtmp
--with-libssh2
--without-libpsl
]
# Since macOS 14.2, if Postgres has a library in `shared_preload_libraries`
# that's linked with curl it fails with the error:
# FATAL: postmaster became multithreaded during startup
#
# Disabling IPv6 support in curl a possible workaround for the issue
#
# Ref https://www.postgresql.org/message-id/flat/CYMBV0OT7216.JNRUO6R6GH86%40neon.tech
args << "--disable-ipv6"
args << if OS.mac?
"--with-gssapi"
else
"--with-gssapi=#{Formula["krb5"].opt_prefix}"
end
system "./configure", *args
system "make", "install"
system "make", "install", "-C", "scripts"
libexec.install "scripts/mk-ca-bundle.pl"
end
test do
# Fetch the curl tarball and see that the checksum matches.
# This requires a network connection, but so does Homebrew in general.
filename = (testpath/"test.tar.gz")
system "#{bin}/curl", "-L", stable.url, "-o", filename
filename.verify_checksum stable.checksum
system libexec/"mk-ca-bundle.pl", "test.pem"
assert_predicate testpath/"test.pem", :exist?
assert_predicate testpath/"certdata.txt", :exist?
refute_includes shell_output("#{bin}/curl -V"), "IPv6"
end
end