Skip to content

Commit

Permalink
curl-without-ipv6 8.5.0 (new formula)
Browse files Browse the repository at this point in the history
  • Loading branch information
bayandin committed Dec 22, 2023
1 parent db6e4e3 commit ca8a1ff
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions Formula/curl-without-ipv6.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# 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"
# Don't forget to update both instances of the version in the GitHub mirror URL.
url "https://curl.se/download/curl-8.5.0.tar.bz2"
mirror "https://github.com/curl/curl/releases/download/curl-8_5_0/curl-8.5.0.tar.bz2"
mirror "http://fresh-center.net/linux/www/curl-8.5.0.tar.bz2"
sha256 "ce4b6a6655431147624aaf582632a36fe1ade262d5fab385c60f78942dd8d87b"
license "curl"

livecheck do
url "https://curl.se/download/"
regex(/href=.*?curl[._-]v?(.*?)\.t/i)
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
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
tag_name = "curl-#{version.to_s.tr(".", "_")}"
assert_match tag_name, stable.mirrors.grep(/github\.com/).first,
"Tag name #{tag_name} is not found in the GitHub mirror " \
"URL! Please make sure the URL is correct"

# 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

0 comments on commit ca8a1ff

Please sign in to comment.