From 5b11bac591f4a9c09c4d620ce27964e11344c1d7 Mon Sep 17 00:00:00 2001 From: Leonardo Romor Date: Thu, 16 Jan 2025 18:45:42 +0100 Subject: [PATCH] shebang: changed scripts shebang to better support systems like bsd and nixos --- cc/private/toolchain/build_interface_so | 2 +- cc/private/toolchain/gcc_deps_scanner_wrapper.sh.tpl | 2 +- cc/private/toolchain/generate_system_module_map.sh | 2 +- cc/private/toolchain/grep-includes.sh | 2 +- cc/private/toolchain/link_dynamic_library.sh | 2 +- cc/private/toolchain/linux_cc_wrapper.sh.tpl | 2 +- cc/private/toolchain/osx_cc_wrapper.sh.tpl | 2 +- cc/system_library.bzl | 2 +- examples/custom_toolchain/sample_compiler | 2 +- examples/custom_toolchain/sample_linker | 2 +- tests/rule_based_toolchain/testdata/bin | 2 +- tests/rule_based_toolchain/testdata/bin_wrapper.sh | 2 +- tests/system_library/unittest.bash | 4 ++-- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cc/private/toolchain/build_interface_so b/cc/private/toolchain/build_interface_so index 626e707c..56f21ade 100644 --- a/cc/private/toolchain/build_interface_so +++ b/cc/private/toolchain/build_interface_so @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [[ $# != 2 ]]; then echo "Usage: $0 " 1>&2 diff --git a/cc/private/toolchain/gcc_deps_scanner_wrapper.sh.tpl b/cc/private/toolchain/gcc_deps_scanner_wrapper.sh.tpl index 94364932..2c94f01f 100644 --- a/cc/private/toolchain/gcc_deps_scanner_wrapper.sh.tpl +++ b/cc/private/toolchain/gcc_deps_scanner_wrapper.sh.tpl @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Ship the environment to the C++ action # diff --git a/cc/private/toolchain/generate_system_module_map.sh b/cc/private/toolchain/generate_system_module_map.sh index deb52c2f..6bcbd856 100755 --- a/cc/private/toolchain/generate_system_module_map.sh +++ b/cc/private/toolchain/generate_system_module_map.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2020 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/cc/private/toolchain/grep-includes.sh b/cc/private/toolchain/grep-includes.sh index ee51361c..c6a5383f 100755 --- a/cc/private/toolchain/grep-includes.sh +++ b/cc/private/toolchain/grep-includes.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright 2018 The Bazel Authors. All rights reserved. # diff --git a/cc/private/toolchain/link_dynamic_library.sh b/cc/private/toolchain/link_dynamic_library.sh index c71d4983..d03e300b 100755 --- a/cc/private/toolchain/link_dynamic_library.sh +++ b/cc/private/toolchain/link_dynamic_library.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright 2016 The Bazel Authors. All rights reserved. # diff --git a/cc/private/toolchain/linux_cc_wrapper.sh.tpl b/cc/private/toolchain/linux_cc_wrapper.sh.tpl index 629741e5..1d030d4a 100644 --- a/cc/private/toolchain/linux_cc_wrapper.sh.tpl +++ b/cc/private/toolchain/linux_cc_wrapper.sh.tpl @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright 2015 The Bazel Authors. All rights reserved. # diff --git a/cc/private/toolchain/osx_cc_wrapper.sh.tpl b/cc/private/toolchain/osx_cc_wrapper.sh.tpl index 4fbd546c..0a2d5689 100644 --- a/cc/private/toolchain/osx_cc_wrapper.sh.tpl +++ b/cc/private/toolchain/osx_cc_wrapper.sh.tpl @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright 2015 The Bazel Authors. All rights reserved. # diff --git a/cc/system_library.bzl b/cc/system_library.bzl index 1b44027f..ca8d4602 100644 --- a/cc/system_library.bzl +++ b/cc/system_library.bzl @@ -39,7 +39,7 @@ def _get_list_from_env_var(repo_ctx, var_name, key): return _split_env_var(repo_ctx, var_name).get(key, default = []) def _execute_bash(repo_ctx, cmd): - return repo_ctx.execute(["/bin/bash", "-c", cmd]).stdout.strip("\n") + return repo_ctx.execute(["/usr/bin/env bash", "-c", cmd]).stdout.strip("\n") def _find_linker(repo_ctx): ld = _execute_bash(repo_ctx, "which ld") diff --git a/examples/custom_toolchain/sample_compiler b/examples/custom_toolchain/sample_compiler index a1a14583..1ef4bd6d 100755 --- a/examples/custom_toolchain/sample_compiler +++ b/examples/custom_toolchain/sample_compiler @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Sample script demonstrating custom C++ toolchain selection: handles # the command that translates a cc_library's .cc (source file) into .o (object diff --git a/examples/custom_toolchain/sample_linker b/examples/custom_toolchain/sample_linker index 69ef2044..e00d41f7 100755 --- a/examples/custom_toolchain/sample_linker +++ b/examples/custom_toolchain/sample_linker @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Sample script demonstrating custom C++ toolchain selection: handles # the command that translates a cc_library's .o (object file) into diff --git a/tests/rule_based_toolchain/testdata/bin b/tests/rule_based_toolchain/testdata/bin index ff29c83f..8f962833 100755 --- a/tests/rule_based_toolchain/testdata/bin +++ b/tests/rule_based_toolchain/testdata/bin @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash echo "Running unwrapped tool" diff --git a/tests/rule_based_toolchain/testdata/bin_wrapper.sh b/tests/rule_based_toolchain/testdata/bin_wrapper.sh index ce615a2e..4a3ea908 100755 --- a/tests/rule_based_toolchain/testdata/bin_wrapper.sh +++ b/tests/rule_based_toolchain/testdata/bin_wrapper.sh @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash echo "Running tool wrapper" diff --git a/tests/system_library/unittest.bash b/tests/system_library/unittest.bash index 3bd07c7b..a43678d2 100644 --- a/tests/system_library/unittest.bash +++ b/tests/system_library/unittest.bash @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright 2015 The Bazel Authors. All rights reserved. # @@ -21,7 +21,7 @@ # A typical test suite looks like so: # # ------------------------------------------------------------------------ -# #!/bin/bash +# #!/usr/bin/env bash # # source path/to/unittest.bash || exit 1 #