Skip to content

Commit

Permalink
Make third_party_library() rule more generic
Browse files Browse the repository at this point in the history
Summary:
Support beyond homebrew and ubuntu (fedora!) without needing to add
new params in the future.

Reviewed By: bigfootjon

Differential Revision: D62681699

fbshipit-source-id: e3c73391a9e5931ae55dd9541e5992f7fcdbd63d
  • Loading branch information
ckwalsh authored and facebook-github-bot committed Sep 16, 2024
1 parent cc01e31 commit db3a768
Show file tree
Hide file tree
Showing 27 changed files with 208 additions and 79 deletions.
21 changes: 16 additions & 5 deletions shim/third-party/boost/boost.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,30 @@ load("@shim//third-party:third_party.bzl", "third_party_library")
def boost_libs(xs):
third_party_library(
name = "boost",
ubuntu_package_name = "libboost-all-dev",
homebrew_package_name = "boost",
repo_package_names = {
"fedora": "boost-devel",
"homebrew": "boost",
"ubuntu": "libboost-all-dev",
},
)
for x in xs:
third_party_library(
name = "boost_{}".format(x),
homebrew_package_name = "boost",
homebrew_linker_flags = ["-lboost_{}".format(x)],
repo_package_names = {
"fedora": "boost-devel",
"homebrew": "boost",
"ubuntu": "libboost-all-dev",
},
linker_flags = ["-lboost_{}".format(x)],
)

def boost_header_only(xs):
for x in xs:
third_party_library(
name = "boost_{}".format(x),
homebrew_package_name = "boost",
repo_package_names = {
"fedora": "boost-devel",
"homebrew": "boost",
"ubuntu": "libboost-all-dev",
},
)
10 changes: 8 additions & 2 deletions shim/third-party/brotli/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ oncall("open_source")

third_party_library(
name = "brotli_decode",
homebrew_package_name = "brotli",
pkgconfig_name = "libbrotlidec",
repo_package_names = {
"fedora": "brotli-devel",
"homebrew": "brotli",
},
)

third_party_library(
name = "brotli_encode",
homebrew_package_name = "brotli",
pkgconfig_name = "libbrotlienc",
repo_package_names = {
"fedora": "brotli-devel",
"homebrew": "brotli",
},
)
6 changes: 5 additions & 1 deletion shim/third-party/bzip2/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ oncall("open_source")

third_party_library(
name = "bz2",
homebrew_package_name = "bzip2",
pkgconfig_name = "bzip2",
repo_package_names = {
"fedora": "bzip2-devel",
"homebrew": "bzip2",
},
)
7 changes: 5 additions & 2 deletions shim/third-party/double_conversion/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ oncall("open_source")

third_party_library(
name = "double_conversion",
homebrew_linker_flags = ["-ldouble-conversion"],
homebrew_package_name = "double-conversion",
linker_flags = ["-ldouble-conversion"],
repo_package_names = {
"fedora": "double-conversion-devel",
"homebrew": "double-conversion",
},
)
4 changes: 4 additions & 0 deletions shim/third-party/fast_float/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ oncall("open_source")

third_party_library(
name = "fast_float",
repo_package_names = {
"fedora": "fast_float-devel",
"homebrew": "fast_float",
},
)
5 changes: 4 additions & 1 deletion shim/third-party/fmt/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ oncall("open_source")

third_party_library(
name = "fmt",
homebrew_package_name = "fmt",
pkgconfig_name = "fmt",
repo_package_names = {
"fedora": "fmt-devel",
"homebrew": "fmt",
},
)
5 changes: 4 additions & 1 deletion shim/third-party/gflags/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ oncall("open_source")

third_party_library(
name = "gflags",
homebrew_package_name = "gflags",
pkgconfig_name = "gflags",
repo_package_names = {
"fedora": "gflags-devel",
"homebrew": "glags",
},
)
11 changes: 8 additions & 3 deletions shim/third-party/glog/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ oncall("open_source")

third_party_library(
name = "glog",
homebrew_package_name = "glog",
pkgconfig_name = "libglog",
ubuntu_package_name = "libgoogle-glog-dev",
deps = ["shim//third-party/gflags:gflags"],
repo_package_names = {
"fedora": "glog-devel",
"homebrew": "glog",
"ubuntu": "libgoogle-glog-dev",
},
deps = [
"shim//third-party/gflags:gflags",
],
)
10 changes: 8 additions & 2 deletions shim/third-party/googletest/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ oncall("open_source")

third_party_library(
name = "gtest",
homebrew_package_name = "googletest",
pkgconfig_name = "gtest",
repo_package_names = {
"fedora": "gtest-devel",
"homebrew": "googletest",
},
)

third_party_library(
name = "gmock",
homebrew_package_name = "googletest",
pkgconfig_name = "gmock",
repo_package_names = {
"fedora": "gmock-devel",
"homebrew": "googletest",
},
)

cxx_library(
Expand Down
5 changes: 4 additions & 1 deletion shim/third-party/jemalloc/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ oncall("open_source")

third_party_library(
name = "headers",
homebrew_package_name = "jemalloc",
pkgconfig_name = "jemalloc",
repo_package_names = {
"fedora": "jemalloc-devel",
"homebrew": "jemalloc",
},
)
4 changes: 3 additions & 1 deletion shim/third-party/jvm/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ oncall("open_source")

third_party_library(
name = "jvm",
homebrew_package_name = "openjdk",
repo_package_names = {
"homebrew": "openjdk",
},
)
5 changes: 5 additions & 0 deletions shim/third-party/libaio/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ oncall("open_source")

third_party_library(
name = "aio",
linker_flags = ["-laio"],
repo_package_names = {
"fedora": "libaio-devel",
"homebrew": "libaio",
},
)
5 changes: 4 additions & 1 deletion shim/third-party/libdwarf/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ oncall("open_source")

third_party_library(
name = "dwarf",
homebrew_package_name = "libdwarf",
pkgconfig_name = "libdwarf",
repo_package_names = {
"fedora": "libdwarf-devel",
"homebrew": "libdwarf",
},
)
5 changes: 4 additions & 1 deletion shim/third-party/libevent/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ oncall("open_source")
third_party_library(
name = "libevent",
pkgconfig_name = "libevent",
ubuntu_package_name = "libevent-dev",
repo_package_names = {
"fedora": "libevent-devel",
"ubuntu": "libevent-dev",
},
)
4 changes: 3 additions & 1 deletion shim/third-party/libgcc/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ oncall("open_source")

third_party_library(
name = "stdc++fs",
homebrew_package_name = "gcc",
repo_package_names = {
"homebrew": "gcc",
},
)
5 changes: 4 additions & 1 deletion shim/third-party/liboqs/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ oncall("open_source")

third_party_library(
name = "oqs",
homebrew_package_name = "liboqs",
pkgconfig_name = "liboqs",
repo_package_names = {
"fedora": "liboqs-devel",
"homebrew": "liboqs",
},
)
7 changes: 5 additions & 2 deletions shim/third-party/libsodium/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ oncall("open_source")

third_party_library(
name = "sodium",
homebrew_package_name = "libsodium",
pkgconfig_name = "libsodium",
ubuntu_package_name = "libsodium-dev",
repo_package_names = {
"fedora": "libsodium-devel",
"homebrew": "libsodium",
"ubuntu": "libsodium-dev",
},
)
6 changes: 5 additions & 1 deletion shim/third-party/libunwind/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ oncall("open_source")
third_party_library(
name = "unwind",
pkgconfig_name = "libunwind",
ubuntu_package_name = "libunwind-dev",
repo_package_names = {
"fedora": "libunwind-devel",
"homebrew": "libunwind",
"ubuntu": "libunwind-dev",
},
)
4 changes: 4 additions & 0 deletions shim/third-party/lz4/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ oncall("open_source")
third_party_library(
name = "lz4",
pkgconfig_name = "liblz4",
repo_package_names = {
"fedora": "lz4-devel",
"homebrew": "lz4",
},
)
5 changes: 4 additions & 1 deletion shim/third-party/openssl/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ oncall("open_source")

third_party_library(
name = "ssl",
homebrew_package_name = "openssl",
pkgconfig_name = "openssl",
repo_package_names = {
"fedora": "openssl-devel",
"homebrew": "openssl",
},
)

alias(
Expand Down
5 changes: 4 additions & 1 deletion shim/third-party/python/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ oncall("open_source")
third_party_library(
name = "python",
homebrew_header_path = "Frameworks/Python.framework/Headers",
homebrew_package_name = "python3",
pkgconfig_name = "python3",
repo_package_names = {
"fedora": "python3-devel",
"homebrew": "python3",
},
)
8 changes: 7 additions & 1 deletion shim/third-party/range-v3/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ load("@shim//third-party:third_party.bzl", "third_party_library")

oncall("open_source")

third_party_library(name = "range-v3")
third_party_library(
name = "range-v3",
repo_package_names = {
"fedora": "range-v3-devel",
"homebrew": "range-v3",
},
)
9 changes: 8 additions & 1 deletion shim/third-party/snappy/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@ load("@shim//third-party:third_party.bzl", "third_party_library")

oncall("open_source")

third_party_library(name = "snappy")
third_party_library(
name = "snappy",
pkgconfig_name = "snappy",
repo_package_names = {
"fedora": "snappy-devel",
"homebrew": "snappy",
},
)
Loading

0 comments on commit db3a768

Please sign in to comment.