From 3adef2a7030ec26791b9dd30df8f982441cd12c5 Mon Sep 17 00:00:00 2001 From: Naman Ahuja Date: Wed, 29 May 2024 12:54:21 -0700 Subject: [PATCH 1/5] Update buckconfig Summary: Update necessary cells in ```.buckconfig``` to BUCK2 build Using https://buck2.build/docs/api/build/globals/#read_config to read ```oss_depends_on``` to decide how we want to change the paths in D57915321 Reviewed By: bigfootjon Differential Revision: D57914226 --- .buckconfig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.buckconfig b/.buckconfig index ba34444244a..f4ea0151973 100644 --- a/.buckconfig +++ b/.buckconfig @@ -8,9 +8,10 @@ none = none [cell_aliases] config = prelude ovr_config = prelude -fbcode = none -fbsource = none +fbcode = shim +fbsource = shim fbcode_macros = shim +bazel_skylib = shim buck = none [parser] @@ -18,3 +19,6 @@ target_platform_detector_spec = target:root//...->prelude//platforms:default [external_cells] prelude = bundled + +[oss_depends_on] +folly = True From e72c86a08369dbebe390fd6a49f2046e96b1b1f4 Mon Sep 17 00:00:00 2001 From: Naman Ahuja Date: Wed, 29 May 2024 12:54:21 -0700 Subject: [PATCH 2/5] Comment out meta only code from Github (#122) Summary: as title Reviewed By: bigfootjon Differential Revision: D57914800 --- fizz/BUCK | 2 +- fizz/crypto/aead/BUCK | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fizz/BUCK b/fizz/BUCK index 762de8a9f43..0b09533c0ba 100644 --- a/fizz/BUCK +++ b/fizz/BUCK @@ -6,6 +6,6 @@ cpp_library( name = "config", headers = select({ "DEFAULT": {"fizz-config.h": "facebook/fizz-config-fbcode.h"}, - "ovr_config//toolchain/fb:arista": {"fizz-config.h": "facebook/fizz-config-xplat.h"}, + # @fb-only: "ovr_config//toolchain/fb:arista": {"fizz-config.h": "facebook/fizz-config-xplat.h"}, }), ) diff --git a/fizz/crypto/aead/BUCK b/fizz/crypto/aead/BUCK index 2c8392fd31c..65bc7106a5b 100644 --- a/fizz/crypto/aead/BUCK +++ b/fizz/crypto/aead/BUCK @@ -55,7 +55,7 @@ cpp_library( "DEFAULT": [ "fbsource//third-party/libaegis:aegis", ], - "ovr_config//toolchain/fb:arista": [], + # @fb-only: "ovr_config//toolchain/fb:arista": [], }), exported_deps = [ ":aead", From 365861ebe39dcae364f65e46904cb15f46acfd51 Mon Sep 17 00:00:00 2001 From: Naman Ahuja Date: Wed, 29 May 2024 12:54:21 -0700 Subject: [PATCH 3/5] ][build+test] Bad targets for open source build Summary: I will work on these targets and see how to resolve them if possible. Reviewed By: bigfootjon Differential Revision: D57914985 --- bad_targets | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 bad_targets diff --git a/bad_targets b/bad_targets new file mode 100644 index 00000000000..10ce6171740 --- /dev/null +++ b/bad_targets @@ -0,0 +1,6 @@ +# This is a list of bad targets that do not build in OSS. Ideally this list goes away +# with time. +root//fizz/experimental/crypto/exchange:oqs_key_exchange +root//fizz/extensions/javacrypto:java_crypto +root//fizz/tool:fizz +root//fizz/backend:openssl From eddf3dcabfb2a31cc7be432fd1c74957788355a0 Mon Sep 17 00:00:00 2001 From: Naman Ahuja Date: Wed, 29 May 2024 12:54:21 -0700 Subject: [PATCH 4/5] Update deps paths Summary: X-link: https://github.com/facebook/ocamlrep/pull/81 Update the deps resolution path in BUCK depending on ```oss_depends_on``` in ```.buckconfig``` Reviewed By: bigfootjon Differential Revision: D57915321 --- shim/shims.bzl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shim/shims.bzl b/shim/shims.bzl index 6b893004eb3..97c57611eb7 100644 --- a/shim/shims.bzl +++ b/shim/shims.bzl @@ -135,6 +135,7 @@ def cpp_library( exported_linker_flags = None, headers = None, private_headers = None, + propagated_pp_flags = (), **kwargs): _unused = (undefined_symbols, arch_preprocessor_flags, modular_headers, arch_compiler_flags, tags) # @unused if os_deps: @@ -415,9 +416,14 @@ def _fix_dep(x: str) -> [ elif x.startswith("third-party//"): return "shim//third-party/" + x.removeprefix("third-party//") elif x.startswith("//folly"): + oss_depends_on_folly = read_config("oss_depends_on", "folly", False) + if oss_depends_on_folly: + return "root//folly/" + x.removeprefix("//") return "root//" + x.removeprefix("//") elif x.startswith("root//folly"): return x + elif x.startswith("//fizz"): + return "root//" + x.removeprefix("//") elif x.startswith("shim//"): return x else: From 8c662d06f4fc0d51e9d82ce0392805461037d7c7 Mon Sep 17 00:00:00 2001 From: Naman Ahuja Date: Wed, 29 May 2024 12:54:21 -0700 Subject: [PATCH 5/5] Add necessary third party libs Summary: These are necessary to buck build fizz Reviewed By: bigfootjon Differential Revision: D57915931 --- shim/third-party/brotli/BUCK | 22 ++++++++++++++++++++++ shim/third-party/jvm/BUCK | 15 +++++++++++++++ shim/third-party/libaegis/BUCK | 15 +++++++++++++++ shim/third-party/liboqs/BUCK | 15 +++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 shim/third-party/brotli/BUCK create mode 100644 shim/third-party/jvm/BUCK create mode 100644 shim/third-party/libaegis/BUCK create mode 100644 shim/third-party/liboqs/BUCK diff --git a/shim/third-party/brotli/BUCK b/shim/third-party/brotli/BUCK new file mode 100644 index 00000000000..95ebd06aa4b --- /dev/null +++ b/shim/third-party/brotli/BUCK @@ -0,0 +1,22 @@ +# 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("@shim//third-party:third_party.bzl", "third_party_library") + +oncall("open_source") + +third_party_library( + name = "brotlidec", + homebrew_package_name = "brotli", + pkgconfig_name = "libbrotlidec", +) + +third_party_library( + name = "brotlienc", + homebrew_package_name = "brotli", + pkgconfig_name = "libbrotlienc", +) diff --git a/shim/third-party/jvm/BUCK b/shim/third-party/jvm/BUCK new file mode 100644 index 00000000000..9de6e20cf29 --- /dev/null +++ b/shim/third-party/jvm/BUCK @@ -0,0 +1,15 @@ +# 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("@shim//third-party:third_party.bzl", "third_party_library") + +oncall("open_source") + +third_party_library( + name = "jvm", + homebrew_package_name = "openjdk", +) diff --git a/shim/third-party/libaegis/BUCK b/shim/third-party/libaegis/BUCK new file mode 100644 index 00000000000..8ac657a1717 --- /dev/null +++ b/shim/third-party/libaegis/BUCK @@ -0,0 +1,15 @@ +# 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("@shim//third-party:third_party.bzl", "third_party_library") + +oncall("open_source") + +third_party_library( + name = "aegis", + pkgconfig_name = "libaegis", +) diff --git a/shim/third-party/liboqs/BUCK b/shim/third-party/liboqs/BUCK new file mode 100644 index 00000000000..c56ee25129e --- /dev/null +++ b/shim/third-party/liboqs/BUCK @@ -0,0 +1,15 @@ +# 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("@shim//third-party:third_party.bzl", "third_party_library") + +oncall("open_source") + +third_party_library( + name = "oqs", + pkgconfig_name = "liboqs", +)