Skip to content

Commit

Permalink
bazel: Use vendored tools from foreign_cc (#27211)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Northey <ryan@synca.io>
Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
  • Loading branch information
phlax and keith authored May 5, 2023
1 parent aa91f9b commit f76cc4d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 25 deletions.
17 changes: 1 addition & 16 deletions bazel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,8 @@ for how to update or override dependencies.
```console
sudo apt-get install \
autoconf \
automake \
cmake \
curl \
libtool \
make \
ninja-build \
patch \
python3-pip \
unzip \
Expand All @@ -92,13 +88,11 @@ for how to update or override dependencies.
```console
dnf install \
aspell-en \
cmake \
libatomic \
libstdc++ \
libstdc++-static \
libtool \
lld \
ninja-build \
patch \
python3-pip
```
Expand Down Expand Up @@ -128,7 +122,7 @@ for how to update or override dependencies.
### macOS
On macOS, you'll need to install several dependencies. This can be accomplished via [Homebrew](https://brew.sh/):
```console
brew install coreutils wget cmake libtool go bazel automake ninja clang-format autoconf aspell python@3.10
brew install coreutils wget libtool go bazel clang-format autoconf aspell
```
_notes_: `coreutils` is used for `realpath`, `gmd5sum` and `gsha256sum`

Expand Down Expand Up @@ -227,15 +221,6 @@ for how to update or override dependencies.

The Windows SDK contains header files and libraries you need when building Windows applications. Bazel always uses the latest, but you can specify a different version by setting the environment variable `BAZEL_WINSDK_FULL_VERSION`. See [bazel/windows](https://docs.bazel.build/versions/master/windows.html)

Ensure `CMake` and `ninja` binaries are on the PATH. The versions packaged with VC++ Build
Tools are sufficient in most cases, but are 32 bit binaries. These flavors will not run in
the project's GCP CI remote build environment, so 64 bit builds from the CMake and ninja
projects are used instead.
```cmd
set PATH=%USERPROFILE%\VSBT2019\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;%PATH%
set PATH=%USERPROFILE%\VSBT2019\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;%PATH%
```

[MSYS2 shell](https://msys2.github.io/): Install to a path with no spaces, e.g. C:\msys64.

Set the `BAZEL_SH` environment variable to the path of the installed MSYS2 `bash.exe`
Expand Down
3 changes: 1 addition & 2 deletions bazel/dependency_imports.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ JQ_VERSION = "1.6"
YQ_VERSION = "4.24.4"

def envoy_dependency_imports(go_version = GO_VERSION, jq_version = JQ_VERSION, yq_version = YQ_VERSION):
# TODO: allow building of tools for easier onboarding
rules_foreign_cc_dependencies(register_default_tools = False, register_built_tools = False)
rules_foreign_cc_dependencies()
go_rules_dependencies()
go_register_toolchains(go_version)
envoy_download_go_sdks(go_version)
Expand Down
6 changes: 3 additions & 3 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -870,11 +870,11 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "Rules for using foreign build systems in Bazel",
project_desc = "Rules for using foreign build systems in Bazel",
project_url = "https://github.com/bazelbuild/rules_foreign_cc",
version = "0.8.0",
sha256 = "6041f1374ff32ba711564374ad8e007aef77f71561a7ce784123b9b4b88614fc",
version = "0.9.0",
sha256 = "2a4d07cd64b0719b39a7c12218a3e507672b82a97b98c6a89d38565894cf7c51",
strip_prefix = "rules_foreign_cc-{version}",
urls = ["https://github.com/bazelbuild/rules_foreign_cc/archive/{version}.tar.gz"],
release_date = "2022-04-18",
release_date = "2022-08-02",
use_category = ["build", "dataplane_core", "controlplane"],
license = "Apache-2.0",
license_url = "https://github.com/bazelbuild/rules_foreign_cc/blob/{version}/LICENSE",
Expand Down
8 changes: 4 additions & 4 deletions bazel/setup_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ LLVM_TARGET="$(llvm-config --host-target)"
RT_LIBRARY_PATH="${LLVM_LIBDIR}/clang/${LLVM_VERSION}/lib/${LLVM_TARGET}"

echo "# Generated file, do not edit. If you want to disable clang, just delete this file.
build:clang --action_env='PATH=${PATH}'
build:clang --action_env=CC=clang
build:clang --action_env=CXX=clang++
build:clang --action_env='LLVM_CONFIG=${LLVM_PREFIX}/bin/llvm-config'
build:clang --action_env='PATH=${PATH}' --host_action_env='PATH=${PATH}'
build:clang --action_env=CC=clang --host_action_env=CC=clang
build:clang --action_env=CXX=clang++ --host_action_env=CXX=clang++
build:clang --action_env='LLVM_CONFIG=${LLVM_PREFIX}/bin/llvm-config' --host_action_env='LLVM_CONFIG=${LLVM_PREFIX}/bin/llvm-config'
build:clang --repo_env='LLVM_CONFIG=${LLVM_PREFIX}/bin/llvm-config'
build:clang --linkopt='-L$(llvm-config --libdir)'
build:clang --linkopt='-Wl,-rpath,$(llvm-config --libdir)'
Expand Down
2 changes: 2 additions & 0 deletions ci/run_envoy_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ else
&& usermod -a -G pcap envoybuild \
&& chown envoybuild:envoygroup /build \
&& chown envoybuild /proc/self/fd/2 \
&& rm -rf /usr/bin/cmake \
&& cmake &> /dev/null || echo 'No cmake here!' \
&& sudo -EHs -u envoybuild bash -c 'cd /source && $*'")
fi

Expand Down

0 comments on commit f76cc4d

Please sign in to comment.