Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bazel_6, bazel_5, bazel_4: add cpp darwin bash set -e workaround #267670

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ stdenv.mkDerivation rec {
inherit src;
inherit sourceRoot;
patches = [
# Fix "set -e" handling of some bash versions on darwin cpp targets
../bazel_cpp_darwin_bash_set_e.patch

# On Darwin, the last argument to gcc is coming up as an empty string. i.e: ''
# This is breaking the build of any C target. This patch removes the last
# argument if it's found to be an empty string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ stdenv.mkDerivation rec {
inherit src;
inherit sourceRoot;
patches = [
# Fix "set -e" handling of some bash versions on darwin cpp targets
../bazel_cpp_darwin_bash_set_e.patch

# On Darwin, the last argument to gcc is coming up as an empty string. i.e: ''
# This is breaking the build of any C target. This patch removes the last
# argument if it's found to be an empty string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ stdenv.mkDerivation rec {
inherit src;
inherit sourceRoot;
patches = [
# Fix "set -e" handling of some bash versions on darwin cpp targets
../bazel_cpp_darwin_bash_set_e.patch

# Force usage of the _non_ prebuilt java toolchain.
# the prebuilt one does not work in nix world.
./java_toolchain.patch
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/tools/cpp/osx_cc_wrapper.sh.tpl b/tools/cpp/osx_cc_wrapper.sh.tpl
index 8264090c29..6e38c9df50 100644
--- a/tools/cpp/osx_cc_wrapper.sh.tpl
+++ b/tools/cpp/osx_cc_wrapper.sh.tpl
@@ -80,10 +80,10 @@ function get_library_path() {
# and multi-level symlinks.
function get_realpath() {
local previous="$1"
- local next=$(readlink "${previous}")
+ local next=$(readlink "${previous}" || true)
while [ -n "${next}" ]; do
previous="${next}"
- next=$(readlink "${previous}")
+ next=$(readlink "${previous}" || true)
done
echo "${previous}"
}