diff --git a/shim/third-party/binutils/BUCK b/shim/third-party/binutils/BUCK index 1beb6561db5..84bdf5e5f81 100644 --- a/shim/third-party/binutils/BUCK +++ b/shim/third-party/binutils/BUCK @@ -5,10 +5,14 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "system_library") oncall("open_source") -third_party_library( +system_library( name = "iberty", + packages = { + "//os:linux-fedora": ["binutils-devel"], + "//os:linux-ubuntu": ["libiberty-dev"], + }, ) diff --git a/shim/third-party/boost/BUCK b/shim/third-party/boost/BUCK index 85c2fd684ee..f9ab497e41f 100644 --- a/shim/third-party/boost/BUCK +++ b/shim/third-party/boost/BUCK @@ -5,27 +5,28 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party/boost:boost.bzl", "boost_header_only", "boost_libs") +load("@//third-party/boost:boost.bzl", "boost_libs") oncall("open_source") -boost_libs([ - "container", - "context", - "filesystem", - "program_options", - "random", - "regex", - "thread", -]) - -boost_header_only([ - "algorithm", - "interprocess", - "lexical_cast", - "multi_index", - "preprocessor", - "range", - "sort", - "variant", -]) +boost_libs( + header_only = [ + "algorithm", + "interprocess", + "lexical_cast", + "multi_index", + "preprocessor", + "range", + "sort", + "variant", + ], + libraries = [ + "container", + "context", + "filesystem", + "program_options", + "random", + "regex", + "thread", + ], +) diff --git a/shim/third-party/boost/boost.bzl b/shim/third-party/boost/boost.bzl index 30f880b3e45..5cfea253f03 100644 --- a/shim/third-party/boost/boost.bzl +++ b/shim/third-party/boost/boost.bzl @@ -5,35 +5,35 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "system_library") -def boost_libs(xs): - third_party_library( +HOMEBREW_BREW = "boost" + +def boost_libs(libraries, header_only): + system_library( name = "boost", - repo_package_names = { - "fedora": "boost-devel", - "homebrew": "boost", - "ubuntu": "libboost-all-dev", + packages = { + "//os:linux-fedora": ["boost-devel"], + "//os:linux-ubuntu": ["libboost-all-dev"], + "//os:macos-homebrew": ["boost"], }, ) - for x in xs: - third_party_library( - name = "boost_{}".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), - repo_package_names = { - "fedora": "boost-devel", - "homebrew": "boost", - "ubuntu": "libboost-all-dev", - }, - ) + for library in libraries: + boost_library(library, False) + + for library in header_only: + boost_library(library, True) + +def boost_library(library: str, header_only: bool): + linker_flags = [] if header_only else ["-lboost_{}".format(library)] + + system_library( + name = "boost_{}".format(library), + packages = { + "//os:linux-fedora": ["boost-devel"], + "//os:linux-ubuntu": ["libboost-{}-dev".format(library)], + "//os:macos-homebrew": ["boost"], + }, + linker_flags = [] if header_only else ["-lboost_{}".format(library)], + ) diff --git a/shim/third-party/brotli/BUCK b/shim/third-party/brotli/BUCK index 1eb22fa559d..fd7de2d707a 100644 --- a/shim/third-party/brotli/BUCK +++ b/shim/third-party/brotli/BUCK @@ -5,26 +5,24 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +PACKAGES = { + "//os:linux-fedora": ["brotli-devel"], + "//os:linux-ubuntu": ["libbrotli-dev"], + "//os:macos-homebrew": ["brotli"], +} + +pkgconfig_system_library( name = "brotli_decode", + packages = PACKAGES, pkgconfig_name = "libbrotlidec", - repo_package_names = { - "fedora": "brotli-devel", - "homebrew": "brotli", - "ubuntu": "libbrotli-dev", - }, ) -third_party_library( +pkgconfig_system_library( name = "brotli_encode", + packages = PACKAGES, pkgconfig_name = "libbrotlienc", - repo_package_names = { - "fedora": "brotli-devel", - "homebrew": "brotli", - "ubuntu": "libbrotli-dev", - }, ) diff --git a/shim/third-party/double_conversion/BUCK b/shim/third-party/double_conversion/BUCK index 9e4722e70d6..b56c445a0d7 100644 --- a/shim/third-party/double_conversion/BUCK +++ b/shim/third-party/double_conversion/BUCK @@ -5,16 +5,16 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "system_library") oncall("open_source") -third_party_library( +system_library( name = "double_conversion", linker_flags = ["-ldouble-conversion"], - repo_package_names = { - "fedora": "double-conversion-devel", - "homebrew": "double-conversion", - "ubuntu": "libdouble-conversion-dev", + packages = { + "//os:linux-fedora": ["double-conversion-devel"], + "//os:linux-ubuntu": ["libdouble-conversion-dev"], + "//os:macos-homebrew": ["double-conversion"], }, ) diff --git a/shim/third-party/fast_float/BUCK b/shim/third-party/fast_float/BUCK index 8b2afa85920..35ce9db1284 100644 --- a/shim/third-party/fast_float/BUCK +++ b/shim/third-party/fast_float/BUCK @@ -5,15 +5,15 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "system_library") oncall("open_source") -third_party_library( +system_library( name = "fast_float", - repo_package_names = { - "fedora": "fast_float-devel", - "homebrew": "fast_float", - "ubuntu": "libfast-float-dev", + packages = { + "//os:linux-fedora": ["fast_float-devel"], + "//os:linux-ubuntu": ["libfast-float-dev"], + "//os:macos-homebrew": ["fast_float"], }, ) diff --git a/shim/third-party/fmt/BUCK b/shim/third-party/fmt/BUCK index 167afa9ff77..024783475bc 100644 --- a/shim/third-party/fmt/BUCK +++ b/shim/third-party/fmt/BUCK @@ -5,16 +5,15 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "fmt", - pkgconfig_name = "fmt", - repo_package_names = { - "fedora": "fmt-devel", - "homebrew": "fmt", - "ubuntu": "libfmt-dev", + packages = { + "//os:linux-fedora": ["fmt-devel"], + "//os:linux-ubuntu": ["libfmt-dev"], + "//os:macos-homebrew": ["fmt"], }, ) diff --git a/shim/third-party/gflags/BUCK b/shim/third-party/gflags/BUCK index d8d5a6266c9..d6dac8a0d08 100644 --- a/shim/third-party/gflags/BUCK +++ b/shim/third-party/gflags/BUCK @@ -5,16 +5,15 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "gflags", - pkgconfig_name = "gflags", - repo_package_names = { - "fedora": "gflags-devel", - "homebrew": "gflags", - "ubuntu": "libgflags-dev", + packages = { + "//os:linux-fedora": ["gflags-devel"], + "//os:linux-ubuntu": ["libgflags-dev"], + "//os:macos-homebrew": ["gflags"], }, ) diff --git a/shim/third-party/glog/BUCK b/shim/third-party/glog/BUCK index ea0ba676ea7..830b1dd11ba 100644 --- a/shim/third-party/glog/BUCK +++ b/shim/third-party/glog/BUCK @@ -5,19 +5,19 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "glog", - pkgconfig_name = "libglog", - repo_package_names = { - "fedora": "glog-devel", - "homebrew": "glog", - "ubuntu": "libgoogle-glog-dev", + packages = { + "//os:linux-fedora": ["glog-devel"], + "//os:linux-ubuntu": ["libgoogle-glog-dev"], + "//os:macos-homebrew": ["glog"], }, - deps = [ - "shim//third-party/gflags:gflags", + pkgconfig_name = "libglog", + exported_deps = [ + "//third-party/gflags:gflags", ], ) diff --git a/shim/third-party/googletest/BUCK b/shim/third-party/googletest/BUCK index 56b02040cb8..89fed880abc 100644 --- a/shim/third-party/googletest/BUCK +++ b/shim/third-party/googletest/BUCK @@ -5,27 +5,25 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "gtest", - pkgconfig_name = "gtest", - repo_package_names = { - "fedora": "gtest-devel", - "homebrew": "googletest", - "ubuntu": "libgtest-dev", + packages = { + "//os:linux-fedora": ["gtest-devel"], + "//os:linux-ubuntu": ["libgtest-dev"], + "//os:macos-homebrew": ["googletest"], }, ) -third_party_library( +pkgconfig_system_library( name = "gmock", - pkgconfig_name = "gmock", - repo_package_names = { - "fedora": "gmock-devel", - "homebrew": "googletest", - "ubuntu": "libgmock-dev", + packages = { + "//os:linux-fedora": ["gmock-devel"], + "//os:linux-ubuntu": ["libgmock-dev"], + "//os:macos-homebrew": ["googletest"], }, ) diff --git a/shim/third-party/jemalloc/BUCK b/shim/third-party/jemalloc/BUCK index b4b040e0e3f..04cdb0c6c04 100644 --- a/shim/third-party/jemalloc/BUCK +++ b/shim/third-party/jemalloc/BUCK @@ -5,16 +5,16 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "headers", - pkgconfig_name = "jemalloc", - repo_package_names = { - "fedora": "jemalloc-devel", - "homebrew": "jemalloc", - "ubuntu": "libjemalloc-dev", + packages = { + "//os:linux-fedora": ["jemalloc-devel"], + "//os:linux-ubuntu": ["libjemalloc-dev"], + "//os:macos-homebrew": ["jemalloc"], }, + pkgconfig_name = "jemalloc", ) diff --git a/shim/third-party/jvm/BUCK b/shim/third-party/jvm/BUCK index 09c70401fd2..88188c51c7f 100644 --- a/shim/third-party/jvm/BUCK +++ b/shim/third-party/jvm/BUCK @@ -5,13 +5,13 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "system_library") oncall("open_source") -third_party_library( +system_library( name = "jvm", - repo_package_names = { - "homebrew": "openjdk", + packages = { + "//os:macos-homebrew": ["openjdk"], }, ) diff --git a/shim/third-party/libaio/BUCK b/shim/third-party/libaio/BUCK index 529313dd48f..477687d8243 100644 --- a/shim/third-party/libaio/BUCK +++ b/shim/third-party/libaio/BUCK @@ -5,16 +5,16 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "system_library") oncall("open_source") -third_party_library( +system_library( name = "aio", linker_flags = ["-laio"], - repo_package_names = { - "fedora": "libaio-devel", - "homebrew": "libaio", - "ubuntu": "libaio-dev", + packages = { + "//os:linux-fedora": ["libaio-devel"], + "//os:linux-ubuntu": ["libaio-dev"], + "//os:macos-homebrew": ["libaio"], }, ) diff --git a/shim/third-party/libevent/BUCK b/shim/third-party/libevent/BUCK index 6d9b5a5db60..b69201e42c0 100644 --- a/shim/third-party/libevent/BUCK +++ b/shim/third-party/libevent/BUCK @@ -5,15 +5,15 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "libevent", - pkgconfig_name = "libevent", - repo_package_names = { - "fedora": "libevent-devel", - "ubuntu": "libevent-dev", + packages = { + "//os:linux-fedora": ["libevent-devel"], + "//os:linux-ubuntu": ["libevent-dev"], + "//os:macos-homebrew": ["libevent"], }, ) diff --git a/shim/third-party/libgcc/BUCK b/shim/third-party/libgcc/BUCK index b4ab81b6da5..c95eb4209e6 100644 --- a/shim/third-party/libgcc/BUCK +++ b/shim/third-party/libgcc/BUCK @@ -5,13 +5,15 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "system_library") oncall("open_source") -third_party_library( +system_library( name = "stdc++fs", - repo_package_names = { - "homebrew": "gcc", + packages = { + "//os:linux-fedora": ["gcc"], + "//os:linux-ubuntu": ["gcc"], + "//os:macos-homebrew": ["gcc"], }, ) diff --git a/shim/third-party/liboqs/BUCK b/shim/third-party/liboqs/BUCK index e016f16b87a..74e4d23c70d 100644 --- a/shim/third-party/liboqs/BUCK +++ b/shim/third-party/liboqs/BUCK @@ -5,15 +5,26 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +prebuilt_cxx_library( + name = "pkgconfig_unsupported", + target_compatible_with = [ + "//os:linux-ubuntu", + ], + visibility = [], +) + +pkgconfig_system_library( name = "oqs", + packages = { + "//os:linux-fedora": ["liboqs-devel"], + "//os:macos-homebrew": ["liboqs"], + }, pkgconfig_name = "liboqs", - repo_package_names = { - "fedora": "liboqs-devel", - "homebrew": "liboqs", + unsupported = { + "//os:linux-ubuntu": [":pkgconfig_unsupported"], }, ) diff --git a/shim/third-party/libsodium/BUCK b/shim/third-party/libsodium/BUCK index 91e6fa30ccc..915fb8bc4c5 100644 --- a/shim/third-party/libsodium/BUCK +++ b/shim/third-party/libsodium/BUCK @@ -5,16 +5,16 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "sodium", - pkgconfig_name = "libsodium", - repo_package_names = { - "fedora": "libsodium-devel", - "homebrew": "libsodium", - "ubuntu": "libsodium-dev", + packages = { + "//os:linux-fedora": ["libsodium-devel"], + "//os:linux-ubuntu": ["libsodium"], + "//os:macos-homebrew": ["libsodium-dev"], }, + pkgconfig_name = "libsodium", ) diff --git a/shim/third-party/libunwind/BUCK b/shim/third-party/libunwind/BUCK index 100558f76b9..67375ea8bc1 100644 --- a/shim/third-party/libunwind/BUCK +++ b/shim/third-party/libunwind/BUCK @@ -5,16 +5,16 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "unwind", - pkgconfig_name = "libunwind", - repo_package_names = { - "fedora": "libunwind-devel", - "homebrew": "libunwind", - "ubuntu": "libunwind-dev", + packages = { + "//os:linux-fedora": ["libunwind-devel"], + "//os:linux-ubuntu": ["libunwind-dev"], + "//os:macos-homebrew": ["libunwind"], }, + pkgconfig_name = "libunwind", ) diff --git a/shim/third-party/liburing/BUCK b/shim/third-party/liburing/BUCK index 1fd68a7ba31..a2810945e1f 100644 --- a/shim/third-party/liburing/BUCK +++ b/shim/third-party/liburing/BUCK @@ -5,15 +5,16 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "uring", - pkgconfig_name = "liburing", - repo_package_names = { - "fedora": "liburing-devel", - "ubuntu": "liburing-dev", + packages = { + "//os:linux-fedora": ["liburing-devel"], + "//os:linux-ubuntu": ["liburing-dev"], + "//os:macos-homebrew": ["liburing"], }, + pkgconfig_name = "liburing", ) diff --git a/shim/third-party/lz4/BUCK b/shim/third-party/lz4/BUCK index a8cbc3cf134..553bbd086bf 100644 --- a/shim/third-party/lz4/BUCK +++ b/shim/third-party/lz4/BUCK @@ -5,16 +5,16 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "lz4", - pkgconfig_name = "liblz4", - repo_package_names = { - "fedora": "lz4-devel", - "homebrew": "lz4", - "ubuntu": "liblz4-dev", + packages = { + "//os:linux-fedora": ["lz4-devel"], + "//os:linux-ubuntu": ["liblz4-dev"], + "//os:macos-homebrew": ["lz4"], }, + pkgconfig_name = "liblz4", ) diff --git a/shim/third-party/openssl/BUCK b/shim/third-party/openssl/BUCK index 30ff1c6a2ca..beefbd19d2f 100644 --- a/shim/third-party/openssl/BUCK +++ b/shim/third-party/openssl/BUCK @@ -5,18 +5,18 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "ssl", - pkgconfig_name = "openssl", - repo_package_names = { - "fedora": "openssl-devel", - "homebrew": "openssl", - "ubuntu": "libssl-dev", + packages = { + "//os:linux-fedora": ["openssl-devel"], + "//os:linux-ubuntu": ["libssl-dev"], + "//os:macos-homebrew": ["openssl"], }, + pkgconfig_name = "openssl", ) alias( diff --git a/shim/third-party/python/BUCK b/shim/third-party/python/BUCK index bf80cd2eb72..d87d251b4f7 100644 --- a/shim/third-party/python/BUCK +++ b/shim/third-party/python/BUCK @@ -5,16 +5,16 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "python", - pkgconfig_name = "python3", - repo_package_names = { - "fedora": "python3-devel", - "homebrew": "python3", - "ubuntu": "python3-dev", + packages = { + "//os:linux-fedora": ["python3-devel"], + "//os:linux-ubuntu": ["python3-dev"], + "//os:macos-homebrew": ["python3"], }, + pkgconfig_name = "python3", ) diff --git a/shim/third-party/range-v3/BUCK b/shim/third-party/range-v3/BUCK index 1ad95ed9711..b81a4de31cc 100644 --- a/shim/third-party/range-v3/BUCK +++ b/shim/third-party/range-v3/BUCK @@ -5,15 +5,15 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "system_library") oncall("open_source") -third_party_library( +system_library( name = "range-v3", - repo_package_names = { - "fedora": "range-v3-devel", - "homebrew": "range-v3", - "ubuntu": "librange-v3-dev", + packages = { + "//os:linux-fedora": ["range-v3-devel"], + "//os:linux-ubuntu": ["librange-v3-dev"], + "//os:macos-homebrew": ["range-v3"], }, ) diff --git a/shim/third-party/rust/fixups/libsqlite3-sys/fixups.toml b/shim/third-party/rust/fixups/libsqlite3-sys/fixups.toml index 240a5c89c3f..b82bb848a22 100644 --- a/shim/third-party/rust/fixups/libsqlite3-sys/fixups.toml +++ b/shim/third-party/rust/fixups/libsqlite3-sys/fixups.toml @@ -2,7 +2,10 @@ # We can't easily import bindgen because of its libclang dependency, # so in the meantime we need to use pre-generated bindgen files. -env = { "OUT_DIR" = "$(location //third-party/rust/fixups/libsqlite3-sys:out_dir)" } +extra_mapped_srcs = {"sqlite3/bindgen_bundled_version.rs" = "src/bindgen.rs"} + +[env] +OUT_DIR = "." [[buildscript]] [buildscript.cxx_library] diff --git a/shim/third-party/snappy/BUCK b/shim/third-party/snappy/BUCK index ce83f2d54b2..295d5a6c2b7 100644 --- a/shim/third-party/snappy/BUCK +++ b/shim/third-party/snappy/BUCK @@ -5,16 +5,16 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "snappy", - pkgconfig_name = "snappy", - repo_package_names = { - "fedora": "snappy-devel", - "homebrew": "snappy", - "ubuntu": "libsnappy-dev", + packages = { + "//os:linux-fedora": ["snappy-devel"], + "//os:linux-ubuntu": ["libsnappy-dev"], + "//os:macos-homebrew": ["snappy"], }, + pkgconfig_name = "snappy", ) diff --git a/shim/third-party/third_party.bzl b/shim/third-party/third_party.bzl deleted file mode 100644 index 8f597f87e7c..00000000000 --- a/shim/third-party/third_party.bzl +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under both the MIT license found in the -# LICENSE-MIT file in the root directory of this source tree and the Apache -# License, Version 2.0 found in the LICENSE-APACHE file in the root directory -# of this source tree. - -load("@//third-party:defs.bzl", "pkgconfig_system_library", "system_library") - -REPO_TO_CONSTRAINT_MAP = { - "fedora": "//os:linux-fedora", - "homebrew": "//os:macos-homebrew", - "ubuntu": "//os:linux-ubuntu", -} - -def third_party_library( - name: str, - visibility = ["PUBLIC"], - deps = [], - pkgconfig_name = None, - repo_package_names = {}, - **kwargs): - packages = { - REPO_TO_CONSTRAINT_MAP[repo]: [pkg] - for repo, pkg in repo_package_names.items() - } - - if pkgconfig_name == None: - system_library( - name = name, - packages = packages, - visibility = visibility, - exported_deps = deps, - **kwargs - ) - else: - pkgconfig_system_library( - name = name, - pkgconfig_name = pkgconfig_name, - packages = packages, - visibility = visibility, - exported_deps = deps, - **kwargs - ) diff --git a/shim/third-party/xz/BUCK b/shim/third-party/xz/BUCK index 9bda970b704..5b427a97539 100644 --- a/shim/third-party/xz/BUCK +++ b/shim/third-party/xz/BUCK @@ -5,16 +5,16 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "lzma", - pkgconfig_name = "liblzma", - repo_package_names = { - "fedora": "xz-devel", - "homebrew": "liblzma", - "ubuntu": "liblz4-dev", + packages = { + "//os:linux-fedora": ["xz-devel"], + "//os:linux-ubuntu": ["liblz4-dev"], + "//os:macos-homebrew": ["liblzma"], }, + pkgconfig_name = "liblzma", ) diff --git a/shim/third-party/zlib/BUCK b/shim/third-party/zlib/BUCK index d1704bc453b..5d79750e8b2 100644 --- a/shim/third-party/zlib/BUCK +++ b/shim/third-party/zlib/BUCK @@ -5,16 +5,16 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "z", - pkgconfig_name = "zlib", - repo_package_names = { - "fedora": "zlib-devel", - "homebrew": "zlib", - "ubuntu": "zlib1g", + packages = { + "//os:linux-fedora": ["zlib-devel"], + "//os:linux-ubuntu": ["zlib1g"], + "//os:macos-homebrew": ["zlib"], }, + pkgconfig_name = "zlib", ) diff --git a/shim/third-party/zstd/BUCK b/shim/third-party/zstd/BUCK index 1ecce79a1ce..4bc3bbb5776 100644 --- a/shim/third-party/zstd/BUCK +++ b/shim/third-party/zstd/BUCK @@ -5,16 +5,16 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//third-party:third_party.bzl", "third_party_library") +load("@//third-party:defs.bzl", "pkgconfig_system_library") oncall("open_source") -third_party_library( +pkgconfig_system_library( name = "zstd", - pkgconfig_name = "libzstd", - repo_package_names = { - "fedora": "libzstd-devel", - "homebrew": "zstd", - "ubuntu": "libzstd-dev", + packages = { + "//os:linux-fedora": ["libzstd-devel"], + "//os:linux-ubuntu": ["libzstd-dev"], + "//os:macos-homebrew": ["zstd"], }, + pkgconfig_name = "libzstd", )