From e265ffce84a379a7cf6ea5270d1c7d59f2984259 Mon Sep 17 00:00:00 2001 From: Andrew Goessling Date: Sun, 7 May 2023 10:44:39 -0700 Subject: [PATCH] Setup script cleanup and run. --- README.md | 8 +++- setup_toolchains.py | 12 ++--- test/test_cpp.cc | 2 +- test_build_all.sh | 2 + .../2022.08-1/x86-64-linux-gnu-2022.08-1-ar | 2 + .../2022.08-1/x86-64-linux-gnu-2022.08-1-cpp | 2 + .../2022.08-1/x86-64-linux-gnu-2022.08-1-gcc | 2 + .../2022.08-1/x86-64-linux-gnu-2022.08-1-gcov | 2 + .../2022.08-1/x86-64-linux-gnu-2022.08-1-ld | 2 + .../2022.08-1/x86-64-linux-gnu-2022.08-1-nm | 2 + .../x86-64-linux-gnu-2022.08-1-objdump | 2 + .../x86-64-linux-gnu-2022.08-1-strip | 2 + toolchains/toolchain_info.bzl | 44 +------------------ 13 files changed, 35 insertions(+), 49 deletions(-) mode change 100644 => 100755 test_build_all.sh create mode 100755 toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-ar create mode 100755 toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-cpp create mode 100755 toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-gcc create mode 100755 toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-gcov create mode 100755 toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-ld create mode 100755 toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-nm create mode 100755 toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-objdump create mode 100755 toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-strip diff --git a/README.md b/README.md index d31fda5..b4b4d52 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ toolchains: | Architecture | Buildroot Version | | --- | --- | -| `x86-64` | `2021.11-5` | +| `x86-64` | `2022.08-1`, `2021.11-5` | | `x86-64-core-i7` | `2020.08-1` | | `aarch64` | `2021.11-1`, `2020.08-1` | | `armv7-eabihf` | `2020.08-1` | @@ -59,6 +59,12 @@ toolchains: This list is easily expanded. If a toolchain of interest isn't available feel free to submit and [issue](https://github.com/agoessling/bazel_bootlin/issues), or alternatively take a look at `_AVAILABLE_TOOLCHAINS` in [`setup_toolchains.py`](setup_toolchains.py) and create a pull request. +Don't forget to actually run `setup_toolchains.py` after adding a toolchain and before submitting a +PR: + +```Shell +bazel run //:setup_toolchains +``` ### Platforms diff --git a/setup_toolchains.py b/setup_toolchains.py index 73e0263..bce2042 100644 --- a/setup_toolchains.py +++ b/setup_toolchains.py @@ -100,8 +100,8 @@ def create_wrappers(wrapper_dir): def write_toolchain_info(filename): with open(filename, 'w') as f: - f.write('AVAILABLE_TOOLCHAINS = {}\n'.format(str(_AVAILABLE_TOOLCHAINS).replace('\'', '"'))) - f.write('ALL_TOOLS = {}\n'.format(str(list(_ALL_TOOLS)).replace('\'', '"'))) + f.write(f'AVAILABLE_TOOLCHAINS = {_AVAILABLE_TOOLCHAINS}\n') + f.write(f'ALL_TOOLS = {list(_ALL_TOOLS)}\n') def write_test_script(filename): @@ -112,9 +112,11 @@ def write_test_script(filename): for arch, buildroot_versions in _AVAILABLE_TOOLCHAINS.items(): for version in buildroot_versions: - platform = '@bazel_bootlin//platforms:{}-linux-gnu-{}'.format(arch, version) - f.write('bazel build --verbose_failures --platforms={} //test:test_cpp\n'.format(platform)) - f.write('bazel build --verbose_failures --platforms={} //test:test_c\n'.format(platform)) + platform = f'@bazel_bootlin//platforms:{arch}-linux-gnu-{version}' + f.write(f'bazel build --verbose_failures --platforms={platform} //test:test_cpp\n') + f.write(f'bazel build --verbose_failures --platforms={platform} //test:test_c\n') + + os.chmod(filename, 0o777) def main(): diff --git a/test/test_cpp.cc b/test/test_cpp.cc index 9c5374e..8233d71 100644 --- a/test/test_cpp.cc +++ b/test/test_cpp.cc @@ -1,4 +1,4 @@ -#include +#include int main() { std::cout << "This CPP test passed." << std::endl; diff --git a/test_build_all.sh b/test_build_all.sh old mode 100644 new mode 100755 index 5064e77..3533bc0 --- a/test_build_all.sh +++ b/test_build_all.sh @@ -4,6 +4,8 @@ set -o xtrace bazel build --verbose_failures --platforms=@bazel_bootlin//platforms:x86-64-linux-gnu-2021.11-5 //test:test_cpp bazel build --verbose_failures --platforms=@bazel_bootlin//platforms:x86-64-linux-gnu-2021.11-5 //test:test_c +bazel build --verbose_failures --platforms=@bazel_bootlin//platforms:x86-64-linux-gnu-2022.08-1 //test:test_cpp +bazel build --verbose_failures --platforms=@bazel_bootlin//platforms:x86-64-linux-gnu-2022.08-1 //test:test_c bazel build --verbose_failures --platforms=@bazel_bootlin//platforms:x86-64-core-i7-linux-gnu-2020.08-1 //test:test_cpp bazel build --verbose_failures --platforms=@bazel_bootlin//platforms:x86-64-core-i7-linux-gnu-2020.08-1 //test:test_c bazel build --verbose_failures --platforms=@bazel_bootlin//platforms:aarch64-linux-gnu-2021.11-1 //test:test_cpp diff --git a/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-ar b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-ar new file mode 100755 index 0000000..7687344 --- /dev/null +++ b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-ar @@ -0,0 +1,2 @@ +#!/bin/bash +exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-ar $@ diff --git a/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-cpp b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-cpp new file mode 100755 index 0000000..937a921 --- /dev/null +++ b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-cpp @@ -0,0 +1,2 @@ +#!/bin/bash +exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-cpp.br_real $@ diff --git a/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-gcc b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-gcc new file mode 100755 index 0000000..ff92070 --- /dev/null +++ b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-gcc @@ -0,0 +1,2 @@ +#!/bin/bash +exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-gcc.br_real $@ diff --git a/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-gcov b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-gcov new file mode 100755 index 0000000..baac9f2 --- /dev/null +++ b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-gcov @@ -0,0 +1,2 @@ +#!/bin/bash +exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-gcov $@ diff --git a/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-ld b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-ld new file mode 100755 index 0000000..10b36df --- /dev/null +++ b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-ld @@ -0,0 +1,2 @@ +#!/bin/bash +exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-ld $@ diff --git a/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-nm b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-nm new file mode 100755 index 0000000..d1377eb --- /dev/null +++ b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-nm @@ -0,0 +1,2 @@ +#!/bin/bash +exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-nm $@ diff --git a/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-objdump b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-objdump new file mode 100755 index 0000000..11b4321 --- /dev/null +++ b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-objdump @@ -0,0 +1,2 @@ +#!/bin/bash +exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-objdump $@ diff --git a/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-strip b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-strip new file mode 100755 index 0000000..6686437 --- /dev/null +++ b/toolchains/tool_wrappers/x86-64/2022.08-1/x86-64-linux-gnu-2022.08-1-strip @@ -0,0 +1,2 @@ +#!/bin/bash +exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-strip $@ diff --git a/toolchains/toolchain_info.bzl b/toolchains/toolchain_info.bzl index c9942c7..8275888 100644 --- a/toolchains/toolchain_info.bzl +++ b/toolchains/toolchain_info.bzl @@ -1,42 +1,2 @@ -AVAILABLE_TOOLCHAINS = { - "x86-64": { - "2021.11-5": { - "sha256": "6fe812add925493ea0841365f1fb7ca17fd9224bab61a731063f7f12f3a621b0", - "platform_arch": "x86_64", - "tool_prefix": "x86_64-buildroot-linux-gnu", - }, - "2022.08-1": { - "sha256": "861c1e8ad0a66e4c28e7a1f8319d68080ab0ff8d16a765e65540f1957203a190", - "platform_arch": "x86_64", - "tool_prefix": "x86_64-buildroot-linux-gnu", - }, - }, - "x86-64-core-i7": { - "2020.08-1": { - "sha256": "3dd408e857f5c8e579748995477f2783fcf5ad0aac89719ea3c5c75446dfa63c", - "platform_arch": "x86_64", - "tool_prefix": "x86_64-buildroot-linux-gnu", - }, - }, - "aarch64": { - "2021.11-1": { - "sha256": "dec070196608124fa14c3f192364c5b5b057d7f34651ad58ebb8fc87959c97f7", - "platform_arch": "aarch64", - "tool_prefix": "aarch64-buildroot-linux-gnu", - }, - "2020.08-1": { - "sha256": "8ab7a2f17cb96621b048ab0a872650dd62faa54cd74c961b9902b8c04bff7dd1", - "platform_arch": "aarch64", - "tool_prefix": "aarch64-buildroot-linux-gnu", - }, - }, - "armv7-eabihf": { - "2020.08-1": { - "sha256": "7b6682603af9a9b5c0e46fd57165723483bb68295e827d14d238e63f33a147a8", - "platform_arch": "armv7", - "tool_prefix": "arm-buildroot-linux-gnueabihf", - }, - }, -} - -ALL_TOOLS = ["ar", "cpp", "gcc", "gcov", "ld", "nm", "objdump", "strip"] +AVAILABLE_TOOLCHAINS = {'x86-64': {'2021.11-5': {'sha256': '6fe812add925493ea0841365f1fb7ca17fd9224bab61a731063f7f12f3a621b0', 'platform_arch': 'x86_64', 'tool_prefix': 'x86_64-buildroot-linux-gnu'}, '2022.08-1': {'sha256': '861c1e8ad0a66e4c28e7a1f8319d68080ab0ff8d16a765e65540f1957203a190', 'platform_arch': 'x86_64', 'tool_prefix': 'x86_64-buildroot-linux-gnu'}}, 'x86-64-core-i7': {'2020.08-1': {'sha256': '3dd408e857f5c8e579748995477f2783fcf5ad0aac89719ea3c5c75446dfa63c', 'platform_arch': 'x86_64', 'tool_prefix': 'x86_64-buildroot-linux-gnu'}}, 'aarch64': {'2021.11-1': {'sha256': 'dec070196608124fa14c3f192364c5b5b057d7f34651ad58ebb8fc87959c97f7', 'platform_arch': 'aarch64', 'tool_prefix': 'aarch64-buildroot-linux-gnu'}, '2020.08-1': {'sha256': '8ab7a2f17cb96621b048ab0a872650dd62faa54cd74c961b9902b8c04bff7dd1', 'platform_arch': 'aarch64', 'tool_prefix': 'aarch64-buildroot-linux-gnu'}}, 'armv7-eabihf': {'2020.08-1': {'sha256': '7b6682603af9a9b5c0e46fd57165723483bb68295e827d14d238e63f33a147a8', 'platform_arch': 'armv7', 'tool_prefix': 'arm-buildroot-linux-gnueabihf'}}} +ALL_TOOLS = ['ar', 'cpp', 'gcc', 'gcov', 'ld', 'nm', 'objdump', 'strip']