Skip to content

Commit

Permalink
Setup script cleanup and run.
Browse files Browse the repository at this point in the history
  • Loading branch information
agoessling committed May 7, 2023
1 parent b65607a commit e265ffc
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 49 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,20 @@ 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` |

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

Expand Down
12 changes: 7 additions & 5 deletions setup_toolchains.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion test/test_cpp.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include<iostream>
#include <iostream>

int main() {
std::cout << "This CPP test passed." << std::endl;
Expand Down
2 changes: 2 additions & 0 deletions test_build_all.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-ar $@
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-cpp.br_real $@
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-gcc.br_real $@
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-gcov $@
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-ld $@
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-nm $@
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-objdump $@
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
exec external/x86-64-linux-gnu-2022.08-1/bin/x86_64-buildroot-linux-gnu-strip $@
44 changes: 2 additions & 42 deletions toolchains/toolchain_info.bzl
Original file line number Diff line number Diff line change
@@ -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']

0 comments on commit e265ffc

Please sign in to comment.