Skip to content

Commit 8d1c723

Browse files
authored
Bazel: new versions, patches, conflicts, and java version contraints (spack#31402)
1 parent 8037c91 commit 8d1c723

10 files changed

+107
-47
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff -Naur a/src/main/cpp/blaze_util_posix.cc b/src/main/cpp/blaze_util_posix.cc
2+
--- a/src/main/cpp/blaze_util_posix.cc 1980-01-01 00:00:00.000000000 -0800
3+
+++ b/src/main/cpp/blaze_util_posix.cc 2022-06-30 23:34:08.000000000 -0700
4+
@@ -600,7 +600,7 @@
5+
// Prefer OFD locks if available. POSIX locks can be lost "accidentally"
6+
// due to any close() on the lock file, and are not reliably preserved
7+
// across execve() on Linux, which we need for --batch mode.
8+
- if (fcntl(fd, F_OFD_SETLK, lock) == 0) return 0;
9+
+ if (fcntl(fd, F_SETLK, lock) == 0) return 0;
10+
if (errno != EINVAL) {
11+
if (errno != EACCES && errno != EAGAIN) {
12+
BAZEL_DIE(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR)

var/spack/repos/builtin/packages/bazel/package.py

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ class Bazel(Package):
2020

2121
tags = ['build-tools']
2222

23+
version('5.2.0', sha256='820a94dbb14071ed6d8c266cf0c080ecb265a5eea65307579489c4662c2d582a')
24+
version('5.1.1', sha256='7f5d3bc1d344692b2400f3765fd4b5c0b636eb4e7a8a7b17923095c7b56a4f78')
25+
version('5.1.0', sha256='4de301f509fc6d0cbc697b2017384ecdc94df8f36245bbcbedc7ea6780acc9f5')
26+
version('5.0.0', sha256='072dd62d237dbc11e0bac02e118d8c2db4d0ba3ba09f1a0eb1e2a460fb8419db')
27+
version('4.2.2', sha256='9981d0d53a356c4e87962847750a97c9e8054e460854748006c80f0d7e2b2d33')
28+
version('4.2.1', sha256='12ea7aa11e2bdb12de1dceb9939a22e96f5a480437cb17c123379d8e0fdf5e82')
29+
version('4.2.0', sha256='74814b63920aaee47dbbbee7082e5c4317e4eebaf07e03c5fb5626e1716f1034')
30+
version('4.1.0', sha256='f377d755c96a50f6bd2f423562598d822f43356783330a0b780ad442864d6eeb')
2331
version('4.0.0', sha256='d350f80e70654932db252db380d2ec0144a00e86f8d9f2b4c799ffdb48e9cdd1')
2432
version('3.7.2', sha256='de255bb42163a915312df9f4b86e5b874b46d9e8d4b72604b5123c3a845ed9b1')
2533
version('3.7.1', sha256='c9244e5905df6b0190113e26082c72d58b56b1b0dec66d076f083ce4089b0307')
@@ -113,14 +121,13 @@ class Bazel(Package):
113121
variant('nodepfail', default=True, description='Disable failing dependency checks due to injected absolute paths - required for most builds using bazel with spack')
114122

115123
depends_on('java', type=('build', 'run'))
124+
depends_on('java@11', when='@5.3:', type=('build', 'run'))
125+
depends_on('java@8,11', when='@3.3:5.2', type=('build', 'run'))
126+
depends_on('java@8', when='@0.6:3.2', type=('build', 'run'))
127+
depends_on('java@7:8', when='@:0.5', type=('build', 'run'))
116128
depends_on('python+pythoncmd', type=('build', 'run'))
117129
depends_on('zip', when='platform=linux', type=('build', 'run'))
118130

119-
# make work on power9 (2x commits)
120-
# https://github.com/bazelbuild/bazel/commit/5cff4f1edf8b95bf0612791632255852332f72b5
121-
# https://github.com/bazelbuild/bazel/commit/ab62a6e097590dac5ec946ad7a796ea0e8593ae0
122-
patch('linux_ppc-0.29.1.patch', when='@0.29.1')
123-
124131
# Pass Spack environment variables to the build
125132
patch('bazelruleclassprovider-0.25.patch', when='@0.25:')
126133
patch('bazelruleclassprovider-0.14.patch', when='@0.14:0.24')
@@ -144,18 +151,30 @@ class Bazel(Package):
144151
patch('compile-0.4.patch', when='@0.4:0.5')
145152
patch('compile-0.3.patch', when='@:0.3')
146153

147-
# for fcc
148-
patch('patch_for_fcc.patch', when='@0.29.1:%fj')
149-
patch('patch_for_fcc2.patch', when='@0.25:%fj')
154+
# Disable dependency search
155+
patch('cppcompileaction-0.3.2.patch', when='@0.3.2:+nodepfail')
156+
patch('cppcompileaction-0.3.0.patch', when='@0.3.0:0.3.1+nodepfail')
157+
158+
# Fix build on power9 (2x commits)
159+
# https://github.com/bazelbuild/bazel/commit/5cff4f1edf8b95bf0612791632255852332f72b5
160+
# https://github.com/bazelbuild/bazel/commit/ab62a6e097590dac5ec946ad7a796ea0e8593ae0
161+
patch('build-0.29.1.patch', when='@0.29.1')
162+
163+
# Fix build with Fujitsu compiler
164+
patch('blaze_util_posix-0.29.1.patch', when='@0.29.1:%fj')
165+
patch('unix_cc_configure_fj-5.2.patch', when='@5.2:%fj')
166+
patch('unix_cc_configure_fj-5.0.patch', when='@5.0:5.1%fj')
167+
patch('unix_cc_configure_fj-0.29.1.patch', when='@0.29.1:4%fj')
168+
patch('bazelruleclassprovider_fj-0.25.patch', when='@0.25:%fj')
150169
conflicts(
151170
'%fj',
152171
when='@:0.24.1',
153172
msg='Fujitsu Compiler cannot build 0.24.1 or less, '
154173
'please use a newer release.'
155174
)
156175

157-
patch('disabledepcheck.patch', when='@0.3.2:+nodepfail')
158-
patch('disabledepcheck_old.patch', when='@0.3.0:0.3.1+nodepfail')
176+
# https://blog.bazel.build/2021/05/21/bazel-4-1.html
177+
conflicts('platform=darwin target=aarch64:', when='@:4.0')
159178

160179
executables = ['^bazel$']
161180

var/spack/repos/builtin/packages/bazel/patch_for_fcc.patch

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff -Naur a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
2+
--- a/tools/cpp/unix_cc_configure.bzl 1980-01-01 00:00:00.000000000 -0800
3+
+++ b/tools/cpp/unix_cc_configure.bzl 2022-06-30 23:53:17.000000000 -0700
4+
@@ -379,7 +379,7 @@
5+
"",
6+
False,
7+
), ":")
8+
- gold_linker_path = _find_gold_linker_path(repository_ctx, cc)
9+
+ gold_linker_path = None
10+
cc_path = repository_ctx.path(cc)
11+
if not str(cc_path).startswith(str(repository_ctx.path(".")) + "/"):
12+
# cc is outside the repository, set -B
13+
@@ -468,7 +468,6 @@
14+
# Security hardening requires optimization.
15+
# We need to undef it as some distributions now have it enabled by default.
16+
"-U_FORTIFY_SOURCE",
17+
- "-fstack-protector",
18+
# All warnings are enabled. Maybe enable -Werror as well?
19+
"-Wall",
20+
# Enable a few more warnings that aren't part of -Wall.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
diff -Naur a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
2+
--- a/tools/cpp/unix_cc_configure.bzl 1980-01-01 00:00:00.000000000 -0800
3+
+++ b/tools/cpp/unix_cc_configure.bzl 2022-06-30 23:35:14.000000000 -0700
4+
@@ -417,10 +417,7 @@
5+
bazel_linklibs,
6+
False,
7+
), ":")
8+
- gold_or_lld_linker_path = (
9+
- _find_linker_path(repository_ctx, cc, "lld", is_clang) or
10+
- _find_linker_path(repository_ctx, cc, "gold", is_clang)
11+
- )
12+
+ gold_or_lld_linker_path = None
13+
cc_path = repository_ctx.path(cc)
14+
if not str(cc_path).startswith(str(repository_ctx.path(".")) + "/"):
15+
# cc is outside the repository, set -B
16+
@@ -531,7 +528,6 @@
17+
# Security hardening requires optimization.
18+
# We need to undef it as some distributions now have it enabled by default.
19+
"-U_FORTIFY_SOURCE",
20+
- "-fstack-protector",
21+
# All warnings are enabled. Maybe enable -Werror as well?
22+
"-Wall",
23+
# Enable a few more warnings that aren't part of -Wall.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
diff -Naur a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
2+
--- a/tools/cpp/unix_cc_configure.bzl 1980-01-01 00:00:00.000000000 -0800
3+
+++ b/tools/cpp/unix_cc_configure.bzl 2022-06-30 23:58:26.945067883 -0700
4+
@@ -419,10 +419,7 @@
5+
bazel_linklibs,
6+
False,
7+
), ":")
8+
- gold_or_lld_linker_path = (
9+
- _find_linker_path(repository_ctx, cc, "lld", is_clang) or
10+
- _find_linker_path(repository_ctx, cc, "gold", is_clang)
11+
- )
12+
+ gold_or_lld_linker_path = None
13+
cc_path = repository_ctx.path(cc)
14+
if not str(cc_path).startswith(str(repository_ctx.path(".")) + "/"):
15+
# cc is outside the repository, set -B
16+
@@ -530,7 +527,6 @@
17+
"%{cxx_builtin_include_directories}": get_starlark_list(builtin_include_directories),
18+
"%{compile_flags}": get_starlark_list(
19+
[
20+
- "-fstack-protector",
21+
# All warnings are enabled. Maybe enable -Werror as well?
22+
"-Wall",
23+
# Enable a few more warnings that aren't part of -Wall.

0 commit comments

Comments
 (0)