diff --git a/.bazelrc b/.bazelrc index 11c2d33dfbb5..7a1625ac970f 100644 --- a/.bazelrc +++ b/.bazelrc @@ -14,7 +14,7 @@ common --color=yes common --curses=auto build --experimental_ui_max_stdouterr_bytes=10485760 -# required to build shared library on macOS +# TODO: remove after bump to bazel >= 7 build --experimental_cc_shared_library build --show_progress_rate_limit=0 diff --git a/build/BUILD.bazel b/build/BUILD.bazel index 17a65fa46092..ef2718d6ee44 100644 --- a/build/BUILD.bazel +++ b/build/BUILD.bazel @@ -19,7 +19,8 @@ clib_deps = [ kong_install( name = "install-%s" % get_workspace_name(k), src = k, - prefix = "kong/lib" if k == "@passwdqc" else "kong", + prefix = "kong/lib" if k in ("@passwdqc", "@snappy") else "kong", + strip_path = "snappy" if k == "@snappy" else "", ) for k in clib_deps ] diff --git a/build/openresty/snappy/BUILD.bazel b/build/openresty/snappy/BUILD.bazel index 3f534e9b52ed..499e4fb293aa 100644 --- a/build/openresty/snappy/BUILD.bazel +++ b/build/openresty/snappy/BUILD.bazel @@ -59,7 +59,7 @@ cc_library( ) cc_library( - name = "snappy", + name = "snappy-lib", srcs = [ "snappy.cc", "snappy-c.cc", @@ -77,6 +77,7 @@ cc_library( "-Wno-sign-compare", ], }), + linkstatic = True, deps = [ ":config", ":snappy-stubs-internal", @@ -84,19 +85,9 @@ cc_library( ], ) -# workaround for apple_cc_toolchain doesn't support dynamic linker feature cc_shared_library( - name = "snappy-macos-lib", - shared_lib_name = "libsnappy.dylib", - deps = [":snappy"], -) - -alias( - name = "snappy-lib", - actual = select({ - "@platforms//os:osx": ":snappy-macos-lib", - "//conditions:default": ":snappy", - }), + name = "snappy", + deps = [":snappy-lib"], ) filegroup(