Skip to content

Commit

Permalink
fix(build): snappy to always use cc_shared_library
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion committed May 15, 2024
1 parent 57adeb4 commit c014a33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion build/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
Expand Down
17 changes: 4 additions & 13 deletions build/openresty/snappy/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ cc_library(
)

cc_library(
name = "snappy",
name = "snappy-lib",
srcs = [
"snappy.cc",
"snappy-c.cc",
Expand All @@ -77,26 +77,17 @@ cc_library(
"-Wno-sign-compare",
],
}),
linkstatic = True,
deps = [
":config",
":snappy-stubs-internal",
":snappy-stubs-public",
],
)

# 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(
Expand Down

0 comments on commit c014a33

Please sign in to comment.