Skip to content
Snippets Groups Projects
Commit af1d81a6 authored by Eleni Mathioulaki's avatar Eleni Mathioulaki
Browse files

bazel patches from upstream

parent 0edcdd45
No related branches found
No related tags found
3 merge requests!442update rc,!438create new experimental release (first with Spack v0.20.0),!437update to Spack v0.20.0
Pipeline #24855 canceled with stage
in 8 minutes and 25 seconds
Showing
with 315 additions and 0 deletions
--- a/third_party/zlib/gzguts.h 1980-01-01 00:00:00
+++ b/third_party/zlib/gzguts.h 2023-04-03 12:23:10
@@ -3,6 +3,10 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
+#ifndef _WIN32
+ #include <unistd.h>
+#endif
+
#ifdef _LARGEFILE64_SOURCE
# ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE 1
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java
@@ -150,6 +150,13 @@
builder.put("PATH", null);
builder.put("LD_LIBRARY_PATH", null);
}
+
+ Map<String, String> spackEnv = System.getenv();
+ for (String envName : spackEnv.keySet()) {
+ if (envName.startsWith("SPACK_")) {
+ builder.put(envName, spackEnv.get(envName));
+ }
+ }
}
private static PathFragment determineShellExecutable(OS os, PathFragment fromOption) {
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
@@ -168,6 +168,13 @@ public class BazelRuleClassProvider {
env.put("PATH", null);
}
+ Map<String, String> spackEnv = System.getenv();
+ for (String envName : spackEnv.keySet()) {
+ if (envName.startsWith("SPACK_")) {
+ env.put(envName, spackEnv.get(envName));
+ }
+ }
+
// Shell environment variables specified via options take precedence over the
// ones inherited from the fragments. In the long run, these fragments will
// be replaced by appropriate default rc files anyway.
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
@@ -181,6 +181,13 @@ public class BazelRuleClassProvider {
env.put("PATH", null);
}
+ Map<String, String> spackEnv = System.getenv();
+ for (String envName : spackEnv.keySet()) {
+ if (envName.startsWith("SPACK_")) {
+ env.put(envName, spackEnv.get(envName));
+ }
+ }
+
// Shell environment variables specified via options take precedence over the
// ones inherited from the fragments. In the long run, these fragments will
// be replaced by appropriate default rc files anyway.
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
@@ -185,7 +185,7 @@ public class BazelRuleClassProvider {
Map<String, String> spackEnv = System.getenv();
for (String envName : spackEnv.keySet()) {
- if (envName.startsWith("SPACK_")) {
+ if ((envName.startsWith("SPACK_")) || (envName.equals("fcc_ENV")) || (envName.equals("FCC_ENV"))) {
env.put(envName, spackEnv.get(envName));
}
}
diff -Naur a/src/main/cpp/blaze_util_posix.cc b/src/main/cpp/blaze_util_posix.cc
--- a/src/main/cpp/blaze_util_posix.cc 1980-01-01 00:00:00.000000000 -0800
+++ b/src/main/cpp/blaze_util_posix.cc 2022-06-30 23:34:08.000000000 -0700
@@ -600,7 +600,7 @@
// Prefer OFD locks if available. POSIX locks can be lost "accidentally"
// due to any close() on the lock file, and are not reliably preserved
// across execve() on Linux, which we need for --batch mode.
- if (fcntl(fd, F_OFD_SETLK, lock) == 0) return 0;
+ if (fcntl(fd, F_SETLK, lock) == 0) return 0;
if (errno != EINVAL) {
if (errno != EACCES && errno != EAGAIN) {
BAZEL_DIE(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR)
From 9c9d27561780bc56d9f0867e325c7421a94ee1cb Mon Sep 17 00:00:00 2001
From: Harsh Bhatia <bhatia4@llnl.gov>
Date: Tue, 15 Dec 2020 15:56:10 -0800
Subject: [PATCH] https://github.com/bazelbuild/bazel/commit/ab62a6e097590dac5ec946ad7a796ea0e8593ae0
---
src/conditions/BUILD | 6 ++++++
third_party/BUILD | 8 ++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/conditions/BUILD b/src/conditions/BUILD
index 2b28e28057..faa41a439d 100644
--- a/src/conditions/BUILD
+++ b/src/conditions/BUILD
@@ -10,6 +10,12 @@ filegroup(
visibility = ["//src:__pkg__"],
)
+config_setting(
+ name = "linux_ppc",
+ values = {"cpu": "ppc"},
+ visibility = ["//visibility:public"],
+)
+
config_setting(
name = "linux_x86_64",
values = {"cpu": "k8"},
diff --git a/third_party/BUILD b/third_party/BUILD
index 159006d741..4fcae54c00 100644
--- a/third_party/BUILD
+++ b/third_party/BUILD
@@ -523,12 +523,13 @@ UNNECESSARY_DYNAMIC_LIBRARIES = select({
"//src/conditions:darwin": "*.so *.dll",
"//src/conditions:darwin_x86_64": "*.so *.dll",
"//src/conditions:linux_x86_64": "*.jnilib *.dll",
+ "//src/conditions:linux_ppc": "*.so *.jnilib *.dll",
# The .so file is an x86 one, so we can just remove it if the CPU is not x86
"//src/conditions:arm": "*.so *.jnilib *.dll",
"//src/conditions:linux_aarch64": "*.so *.jnilib *.dll",
# Play it safe -- better have a big binary than a slow binary
# zip -d does require an argument. Supply something bogus.
- "//conditions:default": "*.bogusextension",
+ "//conditions:default": "",
})
# Remove native libraries that are for a platform different from the one we are
@@ -537,7 +538,10 @@ genrule(
name = "filter_netty_dynamic_libs",
srcs = ["netty_tcnative/netty-tcnative-boringssl-static-2.0.24.Final.jar"],
outs = ["netty_tcnative/netty-tcnative-filtered.jar"],
- cmd = "cp $< $@ && zip -qd $@ " + UNNECESSARY_DYNAMIC_LIBRARIES,
+ cmd = "cp $< $@ && " +
+ # End successfully if there is nothing to be deleted from the archive
+ "if [ -n '" + UNNECESSARY_DYNAMIC_LIBRARIES + "' ]; then " +
+ "zip -qd $@ " + UNNECESSARY_DYNAMIC_LIBRARIES + "; fi",
)
java_import(
--
2.21.0 (Apple Git-122.2)
--- a/tools/cpp/cc_configure.bzl
+++ b/tools/cpp/cc_configure.bzl
@@ -173,8 +173,19 @@
else:
inc_dirs = result.stderr[index1 + 1:index2].strip()
- return [repository_ctx.path(_cxx_inc_convert(p))
- for p in inc_dirs.split("\n")]
+ default_inc_directories = [
+ repository_ctx.path(_cxx_inc_convert(p))
+ for p in inc_dirs.split("\n")
+ ]
+
+ env = repository_ctx.os.environ
+ if "SPACK_INCLUDE_DIRS" in env:
+ for path in env["SPACK_INCLUDE_DIRS"].split(":"):
+ default_inc_directories.append(
+ repository_ctx.path(_cxx_inc_convert(path))
+ )
+
+ return default_inc_directories
def _add_option_if_supported(repository_ctx, cc, option):
"""Checks that `option` is supported by the C compiler."""
--- a/tools/cpp/cc_configure.bzl
+++ b/tools/cpp/cc_configure.bzl
@@ -200,8 +200,19 @@
else:
inc_dirs = result.stderr[index1 + 1:index2].strip()
- return [_escape_string(repository_ctx.path(_cxx_inc_convert(p)))
- for p in inc_dirs.split("\n")]
+ default_inc_directories = [
+ _escape_string(repository_ctx.path(_cxx_inc_convert(p)))
+ for p in inc_dirs.split("\n")
+ ]
+
+ env = repository_ctx.os.environ
+ if "SPACK_INCLUDE_DIRS" in env:
+ for path in env["SPACK_INCLUDE_DIRS"].split(":"):
+ default_inc_directories.append(
+ repository_ctx.path(_cxx_inc_convert(path))
+ )
+
+ return default_inc_directories
def _add_option_if_supported(repository_ctx, cc, option):
--- a/compile.sh
+++ b/compile.sh
@@ -92,7 +92,7 @@
log "Building output/bazel"
# We set host and target platform directly since the defaults in @bazel_tools
# have not yet been generated.
-bazel_build "src:bazel${EXE_EXT}" \
+CC=$SPACK_CC CXX=$SPACK_CXX bazel_build "src:bazel${EXE_EXT}" \
--host_platform=@bazel_tools//platforms:host_platform \
--platforms=@bazel_tools//platforms:target_platform \
|| fail "Could not build Bazel"
--- a/compile.sh
+++ b/compile.sh
@@ -92,7 +92,7 @@ display "."
log "Building output/bazel"
# We set host and target platform directly since the defaults in @bazel_tools
# have not yet been generated.
-bazel_build "src:bazel_nojdk${EXE_EXT}" \
+CC=$SPACK_CC CXX=$SPACK_CXX bazel_build "src:bazel_nojdk${EXE_EXT}" \
--host_platform=@bazel_tools//platforms:host_platform \
--platforms=@bazel_tools//platforms:target_platform \
|| fail "Could not build Bazel"
--- a/compile.sh
+++ b/compile.sh
@@ -92,7 +92,7 @@ display "."
log "Building output/bazel"
# We set host and target platform directly since the defaults in @bazel_tools
# have not yet been generated.
-bazel_build "src:bazel_nojdk${EXE_EXT}" \
+CC=$SPACK_CC CXX=$SPACK_CXX bazel_build "src:bazel_nojdk${EXE_EXT}" \
--action_env=PATH \
--host_platform=@bazel_tools//platforms:host_platform \
--platforms=@bazel_tools//platforms:target_platform \
--- a/compile.sh
+++ b/compile.sh
@@ -63,7 +63,7 @@
log "Building output/bazel"
# We set host and target platform directly because we are building for the local
# host.
-bazel_build "src:bazel_nojdk${EXE_EXT}" \
+CC=$SPACK_CC CXX=$SPACK_CXX bazel_build "src:bazel_nojdk${EXE_EXT}" \
--action_env=PATH \
--host_platform=@local_config_platform//:host \
--platforms=@local_config_platform//:host \
--- a/compile.sh
+++ b/compile.sh
@@ -99,7 +99,7 @@
new_step 'Building Bazel with Bazel'
display "."
log "Building output/bazel"
- bazel_build "src:bazel${EXE_EXT}"
+ CC=$SPACK_CC CXX=$SPACK_CXX bazel_build "src:bazel${EXE_EXT}"
cp -f "bazel-bin/src/bazel${EXE_EXT}" "output/bazel${EXE_EXT}"
chmod 0755 "output/bazel${EXE_EXT}"
BAZEL="$(pwd)/output/bazel${EXE_EXT}"
--- a/compile.sh
+++ b/compile.sh
@@ -124,7 +124,7 @@
new_step 'Building Bazel with Bazel'
display "."
log "Building output/bazel"
- bazel_build "src:bazel${EXE_EXT}" \
+ CC=$SPACK_CC CXX=$SPACK_CXX bazel_build "src:bazel${EXE_EXT}" \
|| fail "Could not build Bazel"
bazel_bin_path="$(get_bazel_bin_path)/src/bazel${EXE_EXT}"
[ -e "$bazel_bin_path" ] \
--- a/compile.sh
+++ b/compile.sh
@@ -85,7 +85,7 @@
log "Building output/bazel"
# We set host and target platform directly since the defaults in @bazel_tools
# have not yet been generated.
-bazel_build "src:bazel${EXE_EXT}" \
+CC=$SPACK_CC CXX=$SPACK_CXX bazel_build "src:bazel${EXE_EXT}" \
--experimental_host_platform=//tools/platforms:host_platform \
--experimental_platforms=//tools/platforms:target_platform \
|| fail "Could not build Bazel"
--- a/compile.sh
+++ b/compile.sh
@@ -92,7 +92,7 @@
log "Building output/bazel"
# We set host and target platform directly since the defaults in @bazel_tools
# have not yet been generated.
-bazel_build "src:bazel${EXE_EXT}" \
+CC=$SPACK_CC CXX=$SPACK_CXX bazel_build "src:bazel${EXE_EXT}" \
--host_platform=//tools/platforms:host_platform \
--platforms=//tools/platforms:target_platform \
|| fail "Could not build Bazel"
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java.orig 2020-06-08 13:42:14.035342560 -0400
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java 2020-06-08 13:42:25.149375458 -0400
@@ -963,7 +963,7 @@
// are, it's probably due to a non-hermetic #include, & we should stop
// the build with an error.
if (execPath.startsWith(execRoot)) {
- execPathFragment = execPath.relativeTo(execRoot); // funky but tolerable path
+ // execPathFragment = execPath.relativeTo(execRoot); // funky but tolerable path
} else {
problems.add(execPathFragment.getPathString());
continue;
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java.orig 2020-03-25 08:54:37.914186251 -0400
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java 2020-03-25 08:55:01.356250657 -0400
@@ -148,7 +148,7 @@
if (execPath.startsWith(execRoot)) {
execPathFragment = execPath.relativeTo(execRoot); // funky but tolerable path
} else {
- problems.add(execPathFragment.getPathString());
+ // problems.add(execPathFragment.getPathString());
continue;
}
}
diff --git a/third_party/ijar/zlib_client.h b/third_party/ijar/zlib_client.h
index ed6616362fcc..c4b051e0100c 100644
--- a/third_party/ijar/zlib_client.h
+++ b/third_party/ijar/zlib_client.h
@@ -16,6 +16,7 @@
#define THIRD_PARTY_IJAR_ZLIB_CLIENT_H_
#include <limits.h>
+#include <limits>
#include "third_party/ijar/common.h"
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment