Skip to content

Commit

Permalink
Support fallback config when .pc file isn't available
Browse files Browse the repository at this point in the history
Summary:
Not all distros (namely ubuntu) publish .pc files for their header packages.
This means that `pkg-config --libs <name>` fails, even though the headers are
avilable.

With this change, if `pkg-config` doesn't recognize the name, it can
potentially fallback to a hardcoded value. It isn't perfect, but gets ubuntu
builds to parity with fedora.

Reviewed By: bigfootjon

Differential Revision: D62789099

fbshipit-source-id: 815ef0f978516c1b5079cf75fad71fdf03f34de2
  • Loading branch information
ckwalsh authored and facebook-github-bot committed Sep 17, 2024
1 parent 89534f2 commit 8c8e3cd
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 2 deletions.
2 changes: 2 additions & 0 deletions shim/third-party/brotli/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ third_party_library(
repo_package_names = {
"fedora": "brotli-devel",
"homebrew": "brotli",
"ubuntu": "libbrotli-dev",
},
)

Expand All @@ -24,5 +25,6 @@ third_party_library(
repo_package_names = {
"fedora": "brotli-devel",
"homebrew": "brotli",
"ubuntu": "libbrotli-dev",
},
)
4 changes: 4 additions & 0 deletions shim/third-party/bzip2/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ oncall("open_source")

third_party_library(
name = "bz2",
pkgconfig_fallback = struct(
linker_flags = ["-lbz2"],
),
pkgconfig_name = "bzip2",
repo_package_names = {
"fedora": "bzip2-devel",
"homebrew": "bzip2",
"ubuntu": "libbz2-dev",
},
)
1 change: 1 addition & 0 deletions shim/third-party/double_conversion/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ third_party_library(
repo_package_names = {
"fedora": "double-conversion-devel",
"homebrew": "double-conversion",
"ubuntu": "libdouble-conversion-dev",
},
)
1 change: 1 addition & 0 deletions shim/third-party/fast_float/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ third_party_library(
repo_package_names = {
"fedora": "fast_float-devel",
"homebrew": "fast_float",
"ubuntu": "libfast-float-dev",
},
)
1 change: 1 addition & 0 deletions shim/third-party/fmt/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ third_party_library(
repo_package_names = {
"fedora": "fmt-devel",
"homebrew": "fmt",
"ubuntu": "libfmt-dev",
},
)
3 changes: 2 additions & 1 deletion shim/third-party/gflags/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ third_party_library(
pkgconfig_name = "gflags",
repo_package_names = {
"fedora": "gflags-devel",
"homebrew": "glags",
"homebrew": "gflags",
"ubuntu": "libgflags-dev",
},
)
2 changes: 2 additions & 0 deletions shim/third-party/googletest/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ third_party_library(
repo_package_names = {
"fedora": "gtest-devel",
"homebrew": "googletest",
"ubuntu": "libgtest-dev",
},
)

Expand All @@ -24,6 +25,7 @@ third_party_library(
repo_package_names = {
"fedora": "gmock-devel",
"homebrew": "googletest",
"ubuntu": "libgmock-dev",
},
)

Expand Down
1 change: 1 addition & 0 deletions shim/third-party/jemalloc/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ third_party_library(
repo_package_names = {
"fedora": "jemalloc-devel",
"homebrew": "jemalloc",
"ubuntu": "libjemalloc-dev",
},
)
1 change: 1 addition & 0 deletions shim/third-party/libaio/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ third_party_library(
repo_package_names = {
"fedora": "libaio-devel",
"homebrew": "libaio",
"ubuntu": "libaio-dev",
},
)
4 changes: 4 additions & 0 deletions shim/third-party/libdwarf/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ oncall("open_source")

third_party_library(
name = "dwarf",
pkgconfig_fallback = struct(
preprocessor_flags = ["-I/usr/include/libdwarf"],
),
pkgconfig_name = "libdwarf",
repo_package_names = {
"fedora": "libdwarf-devel",
"homebrew": "libdwarf",
"ubuntu": "libdwarf-dev",
},
)
1 change: 1 addition & 0 deletions shim/third-party/liburing/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ third_party_library(
pkgconfig_name = "liburing",
repo_package_names = {
"fedora": "liburing-devel",
"ubuntu": "liburing-dev",
},
)
1 change: 1 addition & 0 deletions shim/third-party/lz4/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ third_party_library(
repo_package_names = {
"fedora": "lz4-devel",
"homebrew": "lz4",
"ubuntu": "liblz4-dev",
},
)
1 change: 1 addition & 0 deletions shim/third-party/openssl/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ third_party_library(
repo_package_names = {
"fedora": "openssl-devel",
"homebrew": "openssl",
"ubuntu": "libssl-dev",
},
)

Expand Down
1 change: 1 addition & 0 deletions shim/third-party/python/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ third_party_library(
repo_package_names = {
"fedora": "python3-devel",
"homebrew": "python3",
"ubuntu": "python3-dev",
},
)
1 change: 1 addition & 0 deletions shim/third-party/range-v3/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ third_party_library(
repo_package_names = {
"fedora": "range-v3-devel",
"homebrew": "range-v3",
"ubuntu": "librange-v3-dev",
},
)
1 change: 1 addition & 0 deletions shim/third-party/snappy/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ third_party_library(
repo_package_names = {
"fedora": "snappy-devel",
"homebrew": "snappy",
"ubuntu": "libsnappy-dev",
},
)
4 changes: 3 additions & 1 deletion shim/third-party/third_party.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def third_party_library(
pkgconfig_name = None,
repo_package_names = {},
linker_flags = None,
homebrew_header_path = None):
homebrew_header_path = None,
pkgconfig_fallback = None):
# Labels defined here are used to extract third-party libs so they can be installed
labels = []
for repo, package_name in repo_package_names.items():
Expand All @@ -31,6 +32,7 @@ def third_party_library(
visibility = visibility if name == pkgconfig_name else [],
labels = labels,
deps = deps,
fallback = pkgconfig_fallback,
)
if name != pkgconfig_name:
native.alias(
Expand Down
1 change: 1 addition & 0 deletions shim/third-party/xz/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ third_party_library(
repo_package_names = {
"fedora": "xz-devel",
"homebrew": "liblzma",
"ubuntu": "liblz4-dev",
},
)
1 change: 1 addition & 0 deletions shim/third-party/zlib/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ third_party_library(
repo_package_names = {
"fedora": "zlib-devel",
"homebrew": "zlib",
"ubuntu": "zlib1g",
},
)
1 change: 1 addition & 0 deletions shim/third-party/zstd/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ third_party_library(
repo_package_names = {
"fedora": "libzstd-devel",
"homebrew": "zstd",
"ubuntu": "libzstd-dev",
},
)

0 comments on commit 8c8e3cd

Please sign in to comment.