diff --git a/bazel/foreign_cc/BUILD b/bazel/foreign_cc/BUILD index d7dd5eff2661e..6d7fd1b2045eb 100644 --- a/bazel/foreign_cc/BUILD +++ b/bazel/foreign_cc/BUILD @@ -114,11 +114,37 @@ configure_make( tags = ["skip_on_windows"], ) +configure_make( + name = "colm", + autogen = True, + configure_in_place = True, + configure_options = [ + "AUTOMAKE=automake", + "ACLOCAL=aclocal", + "--disable-shared", + "--enable-static", + ], + # Workaround for the issue with statically linked libstdc++ + # using -l:libstdc++.a. + env = { + "CXXFLAGS": "-lstdc++ -Wno-unused-command-line-argument", + }, + lib_source = "@net_colm_open_source_colm//:all", + out_binaries = ["colm"], + tags = ["skip_on_windows"], +) + configure_make( name = "ragel", + autogen = True, + configure_in_place = True, configure_options = [ "AUTOMAKE=automake", "ACLOCAL=aclocal", + "--disable-manual", + "--disable-shared", + "--enable-static", + "--with-colm=$EXT_BUILD_DEPS/colm", ], # Workaround for the issue with statically linked libstdc++ # using -l:libstdc++.a. @@ -128,6 +154,7 @@ configure_make( lib_source = "@net_colm_open_source_ragel//:all", out_binaries = ["ragel"], tags = ["skip_on_windows"], + deps = [":colm"], ) # ICU used by the language detection filter (i18n). diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 63a8f5e38fa5d..bb31661899cad 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -206,6 +206,7 @@ def envoy_dependencies(skip_targets = []): _com_googlesource_googleurl() _io_hyperscan() _io_opentracing_cpp() + _net_colm_open_source_colm() _net_colm_open_source_ragel() _net_zlib() _intel_dlb() @@ -426,6 +427,16 @@ def _com_github_libevent_libevent(): actual = "@envoy//bazel/foreign_cc:event", ) +def _net_colm_open_source_colm(): + external_http_archive( + name = "net_colm_open_source_colm", + build_file_content = BUILD_ALL_CONTENT, + ) + native.bind( + name = "colm", + actual = "@envoy//bazel/foreign_cc:colm", + ) + def _net_colm_open_source_ragel(): external_http_archive( name = "net_colm_open_source_ragel", diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index dae0506ad3a5c..0542f513d39db 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -510,20 +510,47 @@ REPOSITORY_LOCATIONS_SPEC = dict( release_date = "2020-07-28", cpe = "cpe:2.3:a:libevent_project:libevent:*", ), + net_colm_open_source_colm = dict( + project_name = "Colm", + project_desc = "The Colm Programming Language", + project_url = "https://www.colm.net/open-source/colm/", + # The latest release version v0.14.7 prevents building statically (see + # https://github.com/adrian-thurston/colm/issues/146). The latest SHA includes the fix (see + # https://github.com/adrian-thurston/colm/commit/fc61ecb3a22b89864916ec538eaf04840e7dd6b5). + # TODO(zhxie): Update to the next release version when it is released. + version = "2d8ba76ddaf6634f285d0a81ee42d5ee77d084cf", + sha256 = "0399e9bef7603a8f3d94acd0b0af6b5944cc3103e586734719379d3ec09620c0", + strip_prefix = "colm-{version}", + urls = ["https://github.com/adrian-thurston/colm/archive/{version}.tar.gz"], + use_category = ["dataplane_ext"], + extensions = [ + "envoy.matching.input_matchers.hyperscan", + "envoy.regex_engines.hyperscan", + ], + release_date = "2021-12-28", + cpe = "N/A", + ), net_colm_open_source_ragel = dict( project_name = "Ragel", project_desc = "Ragel State Machine Compiler", project_url = "https://www.colm.net/open-source/ragel/", - version = "6.10", - sha256 = "5f156edb65d20b856d638dd9ee2dfb43285914d9aa2b6ec779dac0270cd56c3f", + # We used the stable release Ragel 6.10 previously and it is under GPLv2 license (see + # http://www.colm.net/open-source/ragel). Envoy uses its binary only as a tool for + # compiling contrib extension Hyperscan. For copyright consideration, we update Ragel to + # its development release which is under MIT license. + # The latest release version v7.0.4 is not compatible with its dependency Colm we use. The + # latest SHA includes fix for compatibility. + # TODO(zhxie): Update to the next release version when it is released. + version = "d4577c924451b331c73c8ed0af04f6efd35ac0b4", + sha256 = "fa3474d50da9c870b79b51ad43f8d11cdf05268f5ec05a602ecd5b1b5f5febb0", strip_prefix = "ragel-{version}", - urls = ["https://www.colm.net/files/ragel/ragel-{version}.tar.gz"], + urls = ["https://github.com/adrian-thurston/ragel/archive/{version}.tar.gz"], use_category = ["dataplane_ext"], extensions = [ "envoy.matching.input_matchers.hyperscan", "envoy.regex_engines.hyperscan", ], - release_date = "2017-03-24", + release_date = "2021-12-28", cpe = "N/A", ), # This should be removed, see https://github.com/envoyproxy/envoy/issues/13261.