Skip to content

Commit

Permalink
chore(build): force brotli to statically link
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion committed Sep 11, 2024
1 parent 76b6cad commit 0034c19
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions build/openresty/BUILD.openresty.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make", "make")
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@kong//build/openresty/wasmx:rules.bzl", "wasm_runtime", "wasmx_configure_options", "wasmx_env")
load("@kong//build:build_system.bzl", "kong_cc_static_library")
load("@openresty_binding//:variables.bzl", "LUAJIT_VERSION")
load("@kong_bindings//:variables.bzl", "KONG_VAR")
load("@kong//build/openresty/wasmx/filters:variables.bzl", "WASM_FILTERS_TARGETS")
Expand Down Expand Up @@ -233,9 +234,6 @@ CONFIGURE_OPTIONS = [
}) + select({
"@kong//:brotli_flag": [
"--add-module=$$EXT_BUILD_ROOT$$/external/ngx_brotli",
# force static link; the order or following two entries matter
"--with-ld-opt=\"-l:libbrotlienc.a\"",
"--with-ld-opt=\"-l:libbrotlicommon.a\"",
],
"//conditions:default": [],
}) + wasmx_configure_options
Expand All @@ -260,6 +258,18 @@ wasm_runtime(
visibility = ["//visibility:public"],
)

kong_cc_static_library(
name = "brotlienc",
src = "@brotli//:brotlienc",
visibility = ["//visibility:public"],
)

kong_cc_static_library(
name = "brotlicommon",
src = "@brotli//:brotlicommon",
visibility = ["//visibility:public"],
)

configure_make(
name = "openresty",
configure_command = "configure",
Expand Down Expand Up @@ -309,7 +319,7 @@ configure_make(
"//conditions:default": "ln -srf openresty/nginx/sbin/nginx openresty/bin/openresty",
}),
targets = [
"-j" + KONG_VAR["NPROC"],
"-j " + KONG_VAR["NPROC"],
"install -j" + KONG_VAR["NPROC"],
],
visibility = ["//visibility:public"],
Expand All @@ -330,8 +340,8 @@ configure_make(
"//conditions:default": [],
}) + select({
"@kong//:brotli_flag": [
"@brotli//:brotlicommon",
"@brotli//:brotlienc",
":brotlicommon",
":brotlienc",
],
"//conditions:default": [],
}),
Expand Down

0 comments on commit 0034c19

Please sign in to comment.