92 lines
3.7 KiB
Ruby
92 lines
3.7 KiB
Ruby
class Envoy < Formula
|
|
desc "Cloud-native high-performance edge/middle/service proxy"
|
|
homepage "https://www.envoyproxy.io/index.html"
|
|
# Switch to a tarball when the following issue is resolved:
|
|
# https://github.com/envoyproxy/envoy/issues/2181
|
|
url "https://github.com/envoyproxy/envoy.git",
|
|
tag: "v1.21.0",
|
|
revision: "a9d72603c68da3a10a1c0d021d01c7877e6f2a30"
|
|
license "Apache-2.0"
|
|
head "https://github.com/envoyproxy/envoy.git", branch: "main"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_monterey: "bf22e01df08c56e453469d1b9057bc4735bbbcb15edb6e81a557a10e103897a0"
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "82a538bffdfe021e54774e9713351c8555bbb7b2766c6f9b96998918fdcaaa11"
|
|
sha256 cellar: :any_skip_relocation, monterey: "da08bf14e846b5f09e0f2e17866e55ccaf5412b726b62f2c17d0836fc660126d"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "327d71692facbe6dcaf66e07ddb718653d4f8d0dcc2bf0121cd6af4f0a874e19"
|
|
sha256 cellar: :any_skip_relocation, catalina: "89cd16d7a6a786bbaaf9acb65617c4783dc71a2f222d0a73141e1a9c8bc65985"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "9d0b57f5e87b1e480267adbb5e49a1d96d967323ea97f283c9255c4d3e1f490d"
|
|
end
|
|
|
|
depends_on "automake" => :build
|
|
depends_on "bazelisk" => :build
|
|
depends_on "cmake" => :build
|
|
depends_on "coreutils" => :build
|
|
depends_on "libtool" => :build
|
|
depends_on "ninja" => :build
|
|
# Starting with 1.21, envoy requires a full Xcode installation, not just
|
|
# command-line tools. See envoyproxy/envoy#16482
|
|
depends_on xcode: :build
|
|
depends_on macos: :catalina
|
|
|
|
on_linux do
|
|
# GCC added as a test dependency to work around Homebrew issue. Otherwise `brew test` fails.
|
|
# CompilerSelectionError: envoy cannot be built with any available compilers.
|
|
depends_on "gcc@9" => [:build, :test]
|
|
depends_on "python@3.10" => :build
|
|
end
|
|
|
|
# https://github.com/envoyproxy/envoy/tree/main/bazel#supported-compiler-versions
|
|
fails_with gcc: "5"
|
|
fails_with gcc: "6"
|
|
# GCC 10 build fails at external/com_google_absl/absl/container/internal/inlined_vector.h:469:5:
|
|
# error: '<anonymous>.absl::inlined_vector_internal::Storage<char, 128, std::allocator<char> >::data_'
|
|
# is used uninitialized in this function [-Werror=uninitialized]
|
|
fails_with gcc: "10"
|
|
# GCC 11 build fails at external/boringssl/src/crypto/curve25519/curve25519.c:503:57:
|
|
# error: argument 2 of type 'const uint8_t[32]' with mismatched bound [-Werror=array-parameter=]
|
|
fails_with gcc: "11"
|
|
|
|
def install
|
|
env_path = if OS.mac?
|
|
"#{HOMEBREW_PREFIX}/bin:/usr/bin:/bin"
|
|
else
|
|
"#{Formula["python@3.10"].opt_bin}:#{HOMEBREW_PREFIX}/bin:/usr/bin:/bin"
|
|
end
|
|
args = %W[
|
|
--compilation_mode=opt
|
|
--curses=no
|
|
--show_task_finish
|
|
--verbose_failures
|
|
--action_env=PATH=#{env_path}
|
|
--host_action_env=PATH=#{env_path}
|
|
]
|
|
|
|
if OS.linux?
|
|
# Disable extension `tcp_stats` which requires Linux headers >= 4.6
|
|
# It's a directive with absolute path `#include </usr/include/linux/tcp.h>`
|
|
args << "--//source/extensions/transport_sockets/tcp_stats:enabled=false"
|
|
end
|
|
|
|
system Formula["bazelisk"].opt_bin/"bazelisk", "build", *args, "//source/exe:envoy-static"
|
|
bin.install "bazel-bin/source/exe/envoy-static" => "envoy"
|
|
pkgshare.install "configs", "examples"
|
|
end
|
|
|
|
test do
|
|
port = free_port
|
|
|
|
cp pkgshare/"configs/envoyproxy_io_proxy.yaml", testpath/"envoy.yaml"
|
|
inreplace "envoy.yaml" do |s|
|
|
s.gsub! "port_value: 9901", "port_value: #{port}"
|
|
s.gsub! "port_value: 10000", "port_value: #{free_port}"
|
|
end
|
|
|
|
fork do
|
|
exec bin/"envoy", "-c", "envoy.yaml"
|
|
end
|
|
sleep 10
|
|
assert_match "HEALTHY", shell_output("curl -s 127.0.0.1:#{port}/clusters?format=json")
|
|
end
|
|
end
|