84 lines
3.2 KiB
Ruby
84 lines
3.2 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.20.1",
|
|
revision: "ea23f47b27464794980c05ab290a3b73d801405e"
|
|
license "Apache-2.0"
|
|
head "https://github.com/envoyproxy/envoy.git", branch: "main"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, monterey: "ea4ba641eacee0a0772b1defb5d405470acb21835957007962d6ee170b63e33e"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "092ddc72b6b2c2bf7ec681b15fe5667ab19a0a24c52c5f49be736c11e66822fd"
|
|
sha256 cellar: :any_skip_relocation, catalina: "c4775dde9f78b2196cad23e09194658cdb7481567a17b2788c9becef8a7d7ce2"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "70f79f2525f22050cbd7fb97f23fcd8521df0dc0d16148b78379f5993cba92a8"
|
|
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.9" => :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.9"].opt_libexec}/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}
|
|
]
|
|
|
|
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
|