Add latest version of bazel (#13813)

* use bazel commit in #13112, and add version 0.24.1, and corresponding cc_env patch

* undo preferred java version by dodo47

* patch for v0.26

* Update install steps

* Add patches for more versions

* Add unit tests

* Update patches for new Spack env vars

* env is already defined, use spackEnv
This commit is contained in:
Sinan 2019-11-25 10:59:12 -07:00 committed by Adam J. Stewart
parent 289aa6ad8a
commit 448e09e5b2
23 changed files with 311 additions and 747 deletions

View File

@ -0,0 +1,16 @@
--- 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) {

View File

@ -0,0 +1,16 @@
--- 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.

View File

@ -0,0 +1,16 @@
--- 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.

View File

@ -1,6 +1,6 @@
--- bazel-0.3.1/tools/cpp/cc_configure.bzl 2016-10-13 14:00:32.118358387 +0200
+++ bazel-0.3.1/tools/cpp/cc_configure.bzl 2016-10-13 13:52:45.342610147 +0200
@@ -173,8 +173,23 @@
--- 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()
@ -12,12 +12,8 @@
+ ]
+
+ env = repository_ctx.os.environ
+ if "SPACK_DEPENDENCIES" in env:
+ for dep in env["SPACK_DEPENDENCIES"].split(":"):
+ path = dep + "/include"
+ # path = repository_ctx.os.path.join(dep, "include")
+ # if not repository_ctx.os.path.exists(path):
+ # continue
+ 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))
+ )

View File

@ -0,0 +1,24 @@
--- 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):

View File

@ -0,0 +1,11 @@
--- 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"

View File

@ -0,0 +1,11 @@
--- 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"

View File

@ -0,0 +1,11 @@
--- 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 \

View File

@ -0,0 +1,11 @@
--- 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 \

View File

@ -0,0 +1,11 @@
--- 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}"

View File

@ -0,0 +1,11 @@
--- 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" ] \

View File

@ -0,0 +1,11 @@
--- 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"

View File

@ -0,0 +1,11 @@
--- 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"

View File

@ -1,129 +0,0 @@
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java.orig 2018-05-23 12:11:29.319402761 +0200
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java 2018-05-23 12:35:21.817904301 +0200
@@ -150,6 +150,126 @@
builder.put("PATH", null);
builder.put("LD_LIBRARY_PATH", null);
}
+
+ String spack_prefix = System.getenv("SPACK_PREFIX");
+ if (spack_prefix != null) {
+ builder.put("SPACK_PREFIX", spack_prefix);
+ }
+
+ String spack_env_path = System.getenv("SPACK_ENV_PATH");
+ if (spack_env_path != null) {
+ builder.put("SPACK_ENV_PATH", spack_env_path);
+ }
+
+ String spack_debug_log_id = System.getenv("SPACK_DEBUG_LOG_ID");
+ if (spack_debug_log_id != null) {
+ builder.put("SPACK_DEBUG_LOG_ID", spack_debug_log_id);
+ }
+
+ String spack_debug_log_dir = System.getenv("SPACK_DEBUG_LOG_DIR");
+ if (spack_debug_log_dir != null) {
+ builder.put("SPACK_DEBUG_LOG_DIR", spack_debug_log_dir);
+ }
+
+ String spack_compiler_spec = System.getenv("SPACK_COMPILER_SPEC");
+ if (spack_compiler_spec != null) {
+ builder.put("SPACK_COMPILER_SPEC", spack_compiler_spec);
+ }
+
+ String spack_cc_rpath_arg = System.getenv("SPACK_CC_RPATH_ARG");
+ if (spack_cc_rpath_arg != null) {
+ builder.put("SPACK_CC_RPATH_ARG", spack_cc_rpath_arg);
+ }
+
+ String spack_cxx_rpath_arg = System.getenv("SPACK_CXX_RPATH_ARG");
+ if (spack_cxx_rpath_arg != null) {
+ builder.put("SPACK_CXX_RPATH_ARG", spack_cxx_rpath_arg);
+ }
+
+ String spack_f77_rpath_arg = System.getenv("SPACK_F77_RPATH_ARG");
+ if (spack_f77_rpath_arg != null) {
+ builder.put("SPACK_F77_RPATH_ARG", spack_f77_rpath_arg);
+ }
+
+ String spack_fc_rpath_arg = System.getenv("SPACK_FC_RPATH_ARG");
+ if (spack_fc_rpath_arg != null) {
+ builder.put("SPACK_FC_RPATH_ARG", spack_fc_rpath_arg);
+ }
+
+ String spack_short_spec = System.getenv("SPACK_SHORT_SPEC");
+ if (spack_short_spec != null) {
+ builder.put("SPACK_SHORT_SPEC", spack_short_spec);
+ }
+
+ String spack_system_dirs = System.getenv("SPACK_SYSTEM_DIRS");
+ if (spack_system_dirs != null) {
+ builder.put("SPACK_SYSTEM_DIRS", spack_system_dirs);
+ }
+
+ String spack_cc = System.getenv("SPACK_CC");
+ if (spack_cc != null) {
+ builder.put("SPACK_CC", spack_cc);
+ }
+
+ String spack_cxx = System.getenv("SPACK_CXX");
+ if (spack_cxx != null) {
+ builder.put("SPACK_CXX", spack_cxx);
+ }
+
+ String spack_f77 = System.getenv("SPACK_F77");
+ if (spack_f77 != null) {
+ builder.put("SPACK_F77", spack_f77);
+ }
+
+ String spack_fc = System.getenv("SPACK_FC");
+ if (spack_fc != null) {
+ builder.put("SPACK_FC", spack_fc);
+ }
+
+ String spack_cflags = System.getenv("SPACK_CFLAGS");
+ if (spack_cflags != null) {
+ builder.put("SPACK_CFLAGS", spack_cflags);
+ }
+
+ String spack_cxxflags = System.getenv("SPACK_CXXFLAGS");
+ if (spack_cxxflags != null) {
+ builder.put("SPACK_CXXFLAGS", spack_cxxflags);
+ }
+
+ String spack_fcflags = System.getenv("SPACK_FCFLAGS");
+ if (spack_fcflags != null) {
+ builder.put("SPACK_FCFLAGS", spack_fcflags);
+ }
+
+ String spack_fflags = System.getenv("SPACK_FFLAGS");
+ if (spack_fflags != null) {
+ builder.put("SPACK_FFLAGS", spack_fflags);
+ }
+
+ String spack_ldflags = System.getenv("SPACK_LDFLAGS");
+ if (spack_ldflags != null) {
+ builder.put("SPACK_LDFLAGS", spack_ldflags);
+ }
+
+ String spack_ldlibs = System.getenv("SPACK_LDLIBS");
+ if (spack_ldlibs != null) {
+ builder.put("SPACK_LDLIBS", spack_ldlibs);
+ }
+
+ String spack_debug = System.getenv("SPACK_DEBUG");
+ if (spack_debug != null) {
+ builder.put("SPACK_DEBUG", spack_debug);
+ }
+
+ String spack_test_command = System.getenv("SPACK_TEST_COMMAND");
+ if (spack_test_command != null) {
+ builder.put("SPACK_TEST_COMMAND", spack_test_command);
+ }
+
+ String spack_dependencies = System.getenv("SPACK_DEPENDENCIES");
+ if (spack_dependencies != null) {
+ builder.put("SPACK_DEPENDENCIES", spack_dependencies);
+ }
}
private static PathFragment determineShellExecutable(OS os, PathFragment fromOption) {

View File

@ -1,131 +0,0 @@
diff --git 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
index 72c40ac..2e73530 100755
--- 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,126 @@ public class BazelRuleClassProvider {
env.put("PATH", null);
}
+ String spack_prefix = System.getenv("SPACK_PREFIX");
+ if (spack_prefix != null) {
+ env.put("SPACK_PREFIX", spack_prefix);
+ }
+
+ String spack_env_path = System.getenv("SPACK_ENV_PATH");
+ if (spack_env_path != null) {
+ env.put("SPACK_ENV_PATH", spack_env_path);
+ }
+
+ String spack_debug_log_id = System.getenv("SPACK_DEBUG_LOG_ID");
+ if (spack_debug_log_id != null) {
+ env.put("SPACK_DEBUG_LOG_ID", spack_debug_log_id);
+ }
+
+ String spack_debug_log_dir = System.getenv("SPACK_DEBUG_LOG_DIR");
+ if (spack_debug_log_dir != null) {
+ env.put("SPACK_DEBUG_LOG_DIR", spack_debug_log_dir);
+ }
+
+ String spack_compiler_spec = System.getenv("SPACK_COMPILER_SPEC");
+ if (spack_compiler_spec != null) {
+ env.put("SPACK_COMPILER_SPEC", spack_compiler_spec);
+ }
+
+ String spack_cc_rpath_arg = System.getenv("SPACK_CC_RPATH_ARG");
+ if (spack_cc_rpath_arg != null) {
+ env.put("SPACK_CC_RPATH_ARG", spack_cc_rpath_arg);
+ }
+
+ String spack_cxx_rpath_arg = System.getenv("SPACK_CXX_RPATH_ARG");
+ if (spack_cxx_rpath_arg != null) {
+ env.put("SPACK_CXX_RPATH_ARG", spack_cxx_rpath_arg);
+ }
+
+ String spack_f77_rpath_arg = System.getenv("SPACK_F77_RPATH_ARG");
+ if (spack_f77_rpath_arg != null) {
+ env.put("SPACK_F77_RPATH_ARG", spack_f77_rpath_arg);
+ }
+
+ String spack_fc_rpath_arg = System.getenv("SPACK_FC_RPATH_ARG");
+ if (spack_fc_rpath_arg != null) {
+ env.put("SPACK_FC_RPATH_ARG", spack_fc_rpath_arg);
+ }
+
+ String spack_short_spec = System.getenv("SPACK_SHORT_SPEC");
+ if (spack_short_spec != null) {
+ env.put("SPACK_SHORT_SPEC", spack_short_spec);
+ }
+
+ String spack_system_dirs = System.getenv("SPACK_SYSTEM_DIRS");
+ if (spack_system_dirs != null) {
+ env.put("SPACK_SYSTEM_DIRS", spack_system_dirs);
+ }
+
+ String spack_cc = System.getenv("SPACK_CC");
+ if (spack_cc != null) {
+ env.put("SPACK_CC", spack_cc);
+ }
+
+ String spack_cxx = System.getenv("SPACK_CXX");
+ if (spack_cxx != null) {
+ env.put("SPACK_CXX", spack_cxx);
+ }
+
+ String spack_f77 = System.getenv("SPACK_F77");
+ if (spack_f77 != null) {
+ env.put("SPACK_F77", spack_f77);
+ }
+
+ String spack_fc = System.getenv("SPACK_FC");
+ if (spack_fc != null) {
+ env.put("SPACK_FC", spack_fc);
+ }
+
+ String spack_cflags = System.getenv("SPACK_CFLAGS");
+ if (spack_cflags != null) {
+ env.put("SPACK_CFLAGS", spack_cflags);
+ }
+
+ String spack_cxxflags = System.getenv("SPACK_CXXFLAGS");
+ if (spack_cxxflags != null) {
+ env.put("SPACK_CXXFLAGS", spack_cxxflags);
+ }
+
+ String spack_fcflags = System.getenv("SPACK_FCFLAGS");
+ if (spack_fcflags != null) {
+ env.put("SPACK_FCFLAGS", spack_fcflags);
+ }
+
+ String spack_fflags = System.getenv("SPACK_FFLAGS");
+ if (spack_fflags != null) {
+ env.put("SPACK_FFLAGS", spack_fflags);
+ }
+
+ String spack_ldflags = System.getenv("SPACK_LDFLAGS");
+ if (spack_ldflags != null) {
+ env.put("SPACK_LDFLAGS", spack_ldflags);
+ }
+
+ String spack_ldlibs = System.getenv("SPACK_LDLIBS");
+ if (spack_ldlibs != null) {
+ env.put("SPACK_LDLIBS", spack_ldlibs);
+ }
+
+ String spack_debug = System.getenv("SPACK_DEBUG");
+ if (spack_debug != null) {
+ env.put("SPACK_DEBUG", spack_debug);
+ }
+
+ String spack_test_command = System.getenv("SPACK_TEST_COMMAND");
+ if (spack_test_command != null) {
+ env.put("SPACK_TEST_COMMAND", spack_test_command);
+ }
+
+ String spack_dependencies = System.getenv("SPACK_DEPENDENCIES");
+ if (spack_dependencies != null) {
+ env.put("SPACK_DEPENDENCIES", spack_dependencies);
+ }
+
// 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.

View File

@ -1,126 +0,0 @@
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java.orig b/home/jtang/spack/var/spack/stage/bazel-0.9.0-xcsfcyrpdn3df755cwpk4sxtfwjdv4ub/spack-expanded-archive/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java
index f1a7a1f..32cd181 100755
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java.orig
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java
@@ -154,6 +154,121 @@ public class BazelConfiguration extends Fragment {
if (tmpdir != null) {
builder.put("TMPDIR", tmpdir);
}
+
+ String spack_prefix = System.getenv("SPACK_PREFIX");
+ if (spack_prefix != null) {
+ builder.put("SPACK_PREFIX", spack_prefix);
+ }
+
+ String spack_env_path = System.getenv("SPACK_ENV_PATH");
+ if (spack_env_path != null) {
+ builder.put("SPACK_ENV_PATH", spack_env_path);
+ }
+
+ String spack_debug_log_id = System.getenv("SPACK_DEBUG_LOG_ID");
+ if (spack_debug_log_id != null) {
+ builder.put("SPACK_DEBUG_LOG_ID", spack_debug_log_id);
+ }
+
+ String spack_debug_log_dir = System.getenv("SPACK_DEBUG_LOG_DIR");
+ if (spack_debug_log_dir != null) {
+ builder.put("SPACK_DEBUG_LOG_DIR", spack_debug_log_dir);
+ }
+
+ String spack_compiler_spec = System.getenv("SPACK_COMPILER_SPEC");
+ if (spack_compiler_spec != null) {
+ builder.put("SPACK_COMPILER_SPEC", spack_compiler_spec);
+ }
+
+ String spack_cc_rpath_arg = System.getenv("SPACK_CC_RPATH_ARG");
+ if (spack_cc_rpath_arg != null) {
+ builder.put("SPACK_CC_RPATH_ARG", spack_cc_rpath_arg);
+ }
+
+ String spack_cxx_rpath_arg = System.getenv("SPACK_CXX_RPATH_ARG");
+ if (spack_cxx_rpath_arg != null) {
+ builder.put("SPACK_CXX_RPATH_ARG", spack_cxx_rpath_arg);
+ }
+
+ String spack_f77_rpath_arg = System.getenv("SPACK_F77_RPATH_ARG");
+ if (spack_f77_rpath_arg != null) {
+ builder.put("SPACK_F77_RPATH_ARG", spack_f77_rpath_arg);
+ }
+
+ String spack_fc_rpath_arg = System.getenv("SPACK_FC_RPATH_ARG");
+ if (spack_fc_rpath_arg != null) {
+ builder.put("SPACK_FC_RPATH_ARG", spack_fc_rpath_arg);
+ }
+
+ String spack_short_spec = System.getenv("SPACK_SHORT_SPEC");
+ if (spack_short_spec != null) {
+ builder.put("SPACK_SHORT_SPEC", spack_short_spec);
+ }
+
+ String spack_cc = System.getenv("SPACK_CC");
+ if (spack_cc != null) {
+ builder.put("SPACK_CC", spack_cc);
+ }
+
+ String spack_cxx = System.getenv("SPACK_CXX");
+ if (spack_cxx != null) {
+ builder.put("SPACK_CXX", spack_cxx);
+ }
+
+ String spack_f77 = System.getenv("SPACK_F77");
+ if (spack_f77 != null) {
+ builder.put("SPACK_F77", spack_f77);
+ }
+
+ String spack_fc = System.getenv("SPACK_FC");
+ if (spack_fc != null) {
+ builder.put("SPACK_FC", spack_fc);
+ }
+
+ String spack_cflags = System.getenv("SPACK_CFLAGS");
+ if (spack_cflags != null) {
+ builder.put("SPACK_CFLAGS", spack_cflags);
+ }
+
+ String spack_cxxflags = System.getenv("SPACK_CXXFLAGS");
+ if (spack_cxxflags != null) {
+ builder.put("SPACK_CXXFLAGS", spack_cxxflags);
+ }
+
+ String spack_fcflags = System.getenv("SPACK_FCFLAGS");
+ if (spack_fcflags != null) {
+ builder.put("SPACK_FCFLAGS", spack_fcflags);
+ }
+
+ String spack_fflags = System.getenv("SPACK_FFLAGS");
+ if (spack_fflags != null) {
+ builder.put("SPACK_FFLAGS", spack_fflags);
+ }
+
+ String spack_ldflags = System.getenv("SPACK_LDFLAGS");
+ if (spack_ldflags != null) {
+ builder.put("SPACK_LDFLAGS", spack_ldflags);
+ }
+
+ String spack_ldlibs = System.getenv("SPACK_LDLIBS");
+ if (spack_ldlibs != null) {
+ builder.put("SPACK_LDLIBS", spack_ldlibs);
+ }
+
+ String spack_debug = System.getenv("SPACK_DEBUG");
+ if (spack_debug != null) {
+ builder.put("SPACK_DEBUG", spack_debug);
+ }
+
+ String spack_test_command = System.getenv("SPACK_TEST_COMMAND");
+ if (spack_test_command != null) {
+ builder.put("SPACK_TEST_COMMAND", spack_test_command);
+ }
+
+ String spack_dependencies = System.getenv("SPACK_DEPENDENCIES");
+ if (spack_dependencies != null) {
+ builder.put("SPACK_DEPENDENCIES", spack_dependencies);
+ }
}
}

View File

@ -1,124 +0,0 @@
diff -pu bazel-0.3.1/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java bazel-0.3.1/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java
--- bazel-0.3.1/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java 2016-09-14 11:56:01.565756979 +0200
+++ bazel-0.3.1/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java 2016-09-14 12:04:13.292839801 +0200
@@ -92,5 +92,120 @@ public class BazelConfiguration extends
if (tmpdir != null) {
builder.put("TMPDIR", tmpdir);
}
+
+ String spack_prefix = System.getenv("SPACK_PREFIX");
+ if (spack_prefix != null) {
+ builder.put("SPACK_PREFIX", spack_prefix);
+ }
+
+ String spack_env_path = System.getenv("SPACK_ENV_PATH");
+ if (spack_env_path != null) {
+ builder.put("SPACK_ENV_PATH", spack_env_path);
+ }
+
+ String spack_debug_log_id = System.getenv("SPACK_DEBUG_LOG_ID");
+ if (spack_debug_log_id != null) {
+ builder.put("SPACK_DEBUG_LOG_ID", spack_debug_log_id);
+ }
+
+ String spack_debug_log_dir = System.getenv("SPACK_DEBUG_LOG_DIR");
+ if (spack_debug_log_dir != null) {
+ builder.put("SPACK_DEBUG_LOG_DIR", spack_debug_log_dir);
+ }
+
+ String spack_compiler_spec = System.getenv("SPACK_COMPILER_SPEC");
+ if (spack_compiler_spec != null) {
+ builder.put("SPACK_COMPILER_SPEC", spack_compiler_spec);
+ }
+
+ String spack_cc_rpath_arg = System.getenv("SPACK_CC_RPATH_ARG");
+ if (spack_cc_rpath_arg != null) {
+ builder.put("SPACK_CC_RPATH_ARG", spack_cc_rpath_arg);
+ }
+
+ String spack_cxx_rpath_arg = System.getenv("SPACK_CXX_RPATH_ARG");
+ if (spack_cxx_rpath_arg != null) {
+ builder.put("SPACK_CXX_RPATH_ARG", spack_cxx_rpath_arg);
+ }
+
+ String spack_f77_rpath_arg = System.getenv("SPACK_F77_RPATH_ARG");
+ if (spack_f77_rpath_arg != null) {
+ builder.put("SPACK_F77_RPATH_ARG", spack_f77_rpath_arg);
+ }
+
+ String spack_fc_rpath_arg = System.getenv("SPACK_FC_RPATH_ARG");
+ if (spack_fc_rpath_arg != null) {
+ builder.put("SPACK_FC_RPATH_ARG", spack_fc_rpath_arg);
+ }
+
+ String spack_short_spec = System.getenv("SPACK_SHORT_SPEC");
+ if (spack_short_spec != null) {
+ builder.put("SPACK_SHORT_SPEC", spack_short_spec);
+ }
+
+ String spack_cc = System.getenv("SPACK_CC");
+ if (spack_cc != null) {
+ builder.put("SPACK_CC", spack_cc);
+ }
+
+ String spack_cxx = System.getenv("SPACK_CXX");
+ if (spack_cxx != null) {
+ builder.put("SPACK_CXX", spack_cxx);
+ }
+
+ String spack_f77 = System.getenv("SPACK_F77");
+ if (spack_f77 != null) {
+ builder.put("SPACK_F77", spack_f77);
+ }
+
+ String spack_fc = System.getenv("SPACK_FC");
+ if (spack_fc != null) {
+ builder.put("SPACK_FC", spack_fc);
+ }
+
+ String spack_cflags = System.getenv("SPACK_CFLAGS");
+ if (spack_cflags != null) {
+ builder.put("SPACK_CFLAGS", spack_cflags);
+ }
+
+ String spack_cxxflags = System.getenv("SPACK_CXXFLAGS");
+ if (spack_cxxflags != null) {
+ builder.put("SPACK_CXXFLAGS", spack_cxxflags);
+ }
+
+ String spack_fcflags = System.getenv("SPACK_FCFLAGS");
+ if (spack_fcflags != null) {
+ builder.put("SPACK_FCFLAGS", spack_fcflags);
+ }
+
+ String spack_fflags = System.getenv("SPACK_FFLAGS");
+ if (spack_fflags != null) {
+ builder.put("SPACK_FFLAGS", spack_fflags);
+ }
+
+ String spack_ldflags = System.getenv("SPACK_LDFLAGS");
+ if (spack_ldflags != null) {
+ builder.put("SPACK_LDFLAGS", spack_ldflags);
+ }
+
+ String spack_ldlibs = System.getenv("SPACK_LDLIBS");
+ if (spack_ldlibs != null) {
+ builder.put("SPACK_LDLIBS", spack_ldlibs);
+ }
+
+ String spack_debug = System.getenv("SPACK_DEBUG");
+ if (spack_debug != null) {
+ builder.put("SPACK_DEBUG", spack_debug);
+ }
+
+ String spack_test_command = System.getenv("SPACK_TEST_COMMAND");
+ if (spack_test_command != null) {
+ builder.put("SPACK_TEST_COMMAND", spack_test_command);
+ }
+
+ String spack_dependencies = System.getenv("SPACK_DEPENDENCIES");
+ if (spack_dependencies != null) {
+ builder.put("SPACK_DEPENDENCIES", spack_dependencies);
+ }
}
}

View File

@ -1,138 +0,0 @@
--- bazel-0.3.1/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java 2016-07-29 10:22:16.000000000 +0200
+++ bazel-0.3.1/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java 2016-10-13 15:21:35.036617890 +0200
@@ -214,6 +214,135 @@
.getParentDirectory()
.getPathString());
}
+
+ String path = System.getenv("PATH");
+ result.put("PATH", path == null ? "/bin:/usr/bin" : path);
+
+ String ldLibraryPath = System.getenv("LD_LIBRARY_PATH");
+ if (ldLibraryPath != null) {
+ result.put("LD_LIBRARY_PATH", ldLibraryPath);
+ }
+
+ String tmpdir = System.getenv("TMPDIR");
+ if (tmpdir != null) {
+ result.put("TMPDIR", tmpdir);
+ }
+
+ String spack_prefix = System.getenv("SPACK_PREFIX");
+ if (spack_prefix != null) {
+ result.put("SPACK_PREFIX", spack_prefix);
+ }
+
+ String spack_env_path = System.getenv("SPACK_ENV_PATH");
+ if (spack_env_path != null) {
+ result.put("SPACK_ENV_PATH", spack_env_path);
+ }
+
+ String spack_debug_log_id = System.getenv("SPACK_DEBUG_LOG_ID");
+ if (spack_debug_log_id != null) {
+ result.put("SPACK_DEBUG_LOG_ID", spack_debug_log_id);
+ }
+
+ String spack_debug_log_dir = System.getenv("SPACK_DEBUG_LOG_DIR");
+ if (spack_debug_log_dir != null) {
+ result.put("SPACK_DEBUG_LOG_DIR", spack_debug_log_dir);
+ }
+
+ String spack_compiler_spec = System.getenv("SPACK_COMPILER_SPEC");
+ if (spack_compiler_spec != null) {
+ result.put("SPACK_COMPILER_SPEC", spack_compiler_spec);
+ }
+
+ String spack_cc_rpath_arg = System.getenv("SPACK_CC_RPATH_ARG");
+ if (spack_cc_rpath_arg != null) {
+ result.put("SPACK_CC_RPATH_ARG", spack_cc_rpath_arg);
+ }
+
+ String spack_cxx_rpath_arg = System.getenv("SPACK_CXX_RPATH_ARG");
+ if (spack_cxx_rpath_arg != null) {
+ result.put("SPACK_CXX_RPATH_ARG", spack_cxx_rpath_arg);
+ }
+
+ String spack_f77_rpath_arg = System.getenv("SPACK_F77_RPATH_ARG");
+ if (spack_f77_rpath_arg != null) {
+ result.put("SPACK_F77_RPATH_ARG", spack_f77_rpath_arg);
+ }
+
+ String spack_fc_rpath_arg = System.getenv("SPACK_FC_RPATH_ARG");
+ if (spack_fc_rpath_arg != null) {
+ result.put("SPACK_FC_RPATH_ARG", spack_fc_rpath_arg);
+ }
+
+ String spack_short_spec = System.getenv("SPACK_SHORT_SPEC");
+ if (spack_short_spec != null) {
+ result.put("SPACK_SHORT_SPEC", spack_short_spec);
+ }
+
+ String spack_cc = System.getenv("SPACK_CC");
+ if (spack_cc != null) {
+ result.put("SPACK_CC", spack_cc);
+ }
+
+ String spack_cxx = System.getenv("SPACK_CXX");
+ if (spack_cxx != null) {
+ result.put("SPACK_CXX", spack_cxx);
+ }
+
+ String spack_f77 = System.getenv("SPACK_F77");
+ if (spack_f77 != null) {
+ result.put("SPACK_F77", spack_f77);
+ }
+
+ String spack_fc = System.getenv("SPACK_FC");
+ if (spack_fc != null) {
+ result.put("SPACK_FC", spack_fc);
+ }
+
+ String spack_cflags = System.getenv("SPACK_CFLAGS");
+ if (spack_cflags != null) {
+ result.put("SPACK_CFLAGS", spack_cflags);
+ }
+
+ String spack_cxxflags = System.getenv("SPACK_CXXFLAGS");
+ if (spack_cxxflags != null) {
+ result.put("SPACK_CXXFLAGS", spack_cxxflags);
+ }
+
+ String spack_fcflags = System.getenv("SPACK_FCFLAGS");
+ if (spack_fcflags != null) {
+ result.put("SPACK_FCFLAGS", spack_fcflags);
+ }
+
+ String spack_fflags = System.getenv("SPACK_FFLAGS");
+ if (spack_fflags != null) {
+ result.put("SPACK_FFLAGS", spack_fflags);
+ }
+
+ String spack_ldflags = System.getenv("SPACK_LDFLAGS");
+ if (spack_ldflags != null) {
+ result.put("SPACK_LDFLAGS", spack_ldflags);
+ }
+
+ String spack_ldlibs = System.getenv("SPACK_LDLIBS");
+ if (spack_ldlibs != null) {
+ result.put("SPACK_LDLIBS", spack_ldlibs);
+ }
+
+ String spack_debug = System.getenv("SPACK_DEBUG");
+ if (spack_debug != null) {
+ result.put("SPACK_DEBUG", spack_debug);
+ }
+
+ String spack_test_command = System.getenv("SPACK_TEST_COMMAND");
+ if (spack_test_command != null) {
+ result.put("SPACK_TEST_COMMAND", spack_test_command);
+ }
+
+ String spack_dependencies = System.getenv("SPACK_DEPENDENCIES");
+ if (spack_dependencies != null) {
+ result.put("SPACK_DEPENDENCIES", spack_dependencies);
+ }
+
return result.build();
}

View File

@ -3,93 +3,164 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import inspect
from spack import *
from multiprocessing import cpu_count
from spack.util.environment import env_flag
from spack.build_environment import SPACK_NO_PARALLEL_MAKE
class Bazel(Package):
"""Bazel is Google's own build tool"""
"""Bazel is an open-source build and test tool similar to Make, Maven, and
Gradle. It uses a human-readable, high-level build language. Bazel supports
projects in multiple languages and builds outputs for multiple platforms.
Bazel supports large codebases across multiple repositories, and large
numbers of users."""
homepage = "https://www.bazel.io"
url = "https://github.com/bazelbuild/bazel/releases/download/0.11.1/bazel-0.11.1-dist.zip"
homepage = "https://bazel.build/"
url = "https://github.com/bazelbuild/bazel/releases/download/1.2.0/bazel-1.2.0-dist.zip"
maintainers = ['adamjstewart']
version('1.2.0', sha256='9cb46b0a18b9166730307a0e82bf4c02281a1cc6da0fb11239e6fe4147bdee6e')
version('1.1.0', sha256='4b66a8c93af7832ed32e7236cf454a05f3aa06d25a8576fc3f83114f142f95ab')
version('1.0.1', sha256='f4d2dfad011ff03a5fae41b9b02cd96cd7297c1205d496603d66516934fbcfee')
version('1.0.0', sha256='c61daf0b69dd95205c695b2f9022d296d052c727062cfd396d54ffb2154f8cac')
version('0.29.1', sha256='872a52cff208676e1169b3e1cae71b1fe572c4109cbd66eab107d8607c378de5')
version('0.29.0', sha256='01cb6f2e808bd016cf0e217e12373c9efb808123e58b37885be8364458d3a40a')
version('0.28.1', sha256='2cea463d611f5255d2f3d41c8de5dcc0961adccb39cf0ac036f07070ba720314')
version('0.28.0', sha256='26ad8cdadd413b8432cf46d9fc3801e8db85d9922f85dd8a7f5a92fec876557f')
version('0.27.2', sha256='5e1bf2b48e54eb7e518430667d29aef53695d6dd7c718665a52131ab27aadab2')
version('0.27.1', sha256='8051d77da4ec338acd91770f853e4c25f4407115ed86fd35a6de25921673e779')
version('0.27.0', sha256='c3080d3b959ac08502ad5c84a51608c291accb1481baad88a628bbf79b30c67a')
version('0.26.1', sha256='c0e94f8f818759f3f67af798c38683520c540f469cb41aea8f5e5a0e43f11600')
version('0.26.0', sha256='d26dadf62959255d58e523da3448a6222af768fe1224e321b120c1d5bbe4b4f2')
version('0.25.3', sha256='23eafd3e439bc71baba9c592b52cb742dabc8640a13b9da1751fec090a2dda99')
version('0.25.2', sha256='7456032199852c043e6c5b3e4c71dd8089c1158f72ec554e6ec1c77007f0ab51')
version('0.25.1', sha256='a52bb31aeb1f821e649d25ef48023cfb54a12887aff875c6349ebcac36c2f056')
version('0.25.0', sha256='f624fe9ca8d51de192655369ac538c420afb7cde16e1ad052554b582fff09287')
version('0.24.1', sha256='56ea1b199003ad832813621744178e42b39e6206d34fbae342562c287da0cd54')
version('0.24.0', sha256='621d2a97899a88850a913eabf9285778331a309fd4658b225b1377f80060fa85')
version('0.23.2', sha256='293a5a7d851e0618eeb5e6958d94a11d45b6a00f2ba9376de61ac2bd5f917439')
version('0.23.1', sha256='dd47199f92452bf67b2c5d60ad4b7143554eaf2c6196ab6e8713449d81a0491d')
version('0.23.0', sha256='2daf9c2c6498836ed4ebae7706abb809748b1350cacd35b9f89452f31ac0acc1')
version('0.22.0', sha256='6860a226c8123770b122189636fb0c156c6e5c9027b5b245ac3b2315b7b55641')
version('0.21.0', sha256='6ccb831e683179e0cfb351cb11ea297b4db48f9eab987601c038aa0f83037db4')
version('0.20.0', sha256='1945afa84fd8858b0a3c68c09915a4bc81065c61df2591387b2985e2297d30bd')
version('0.19.2', sha256='11234cce4f6bdc62c3ac688f41c7b5c178eecb6f7e2c4ba0bcf00ba8565b1d19')
version('0.19.1', sha256='c9405f7b8c79ebc81f9f0e49bb656df4a0da246771d010c2cdd6bb30e2500ac0')
version('0.19.0', sha256='ee6135c5c47306c8421d43ad83aabc4f219cb065376ee37797f2c8ba9a615315')
version('0.18.1', sha256='baed9f28c317000a4ec1ad2571b3939356d22746ca945ac2109148d7abb860d4')
version('0.18.0', sha256='d0e86d2f7881ec8742a9823a986017452d2da0dfe4e989111da787cb89257155')
version('0.17.2', sha256='b6e87acfa0a405bb8b3417c58477b66d5bc27dc0d31ba6fa12bc255b9278d33b')
version('0.17.1', sha256='23e4281c3628cbd746da3f51330109bbf69780bd64461b63b386efae37203f20')
version('0.16.1', sha256='09c66b94356c82c52f212af52a81ac28eb06de1313755a2f23eeef84d167b36c')
version('0.16.0', sha256='c730593916ef0ba62f3d113cc3a268e45f7e8039daf7b767c8641b6999bd49b1')
version('0.15.2', sha256='bf53ec73be3a6d412d85ef612cec6e9c85db45da42001fab0cf1dad44cfc03f1')
version('0.15.1', sha256='c62b351fa4c1ba5aeb34d0a137176f8e8f1d89a32f548a10e96c11df176ffc6c')
version('0.15.0', sha256='c3b716e6625e6b8c323350c95cd3ae0f56aeb00458dddd10544d5bead8a7b602')
version('0.14.1', sha256='d49cdcd82618ae7a7a190e6f0a80d9bf85c1a66b732f994f37732dc14ffb0025')
version('0.14.0', sha256='259627de8b9d415cc80904523facf3d50e6e8e68448ab968eb1c9cb8ca1ef843')
version('0.13.1', sha256='b0269e75b40d87ff87886e5f3432cbf88f70c96f907ab588e6c21b2922d72db0')
version('0.13.0', sha256='82e9035084660b9c683187618a29aa896f8b05b5f16ae4be42a80b5e5b6a7690')
version('0.12.0', sha256='3b3e7dc76d145046fdc78db7cac9a82bc8939d3b291e53a7ce85315feb827754')
version('0.11.1', sha256='e8d762bcc01566fa50952c8028e95cfbe7545a39b8ceb3a0d0d6df33b25b333f')
version('0.11.0', sha256='abfeccc94728cb46be8dbb3507a23ccffbacef9fbda96a977ef4ea8d6ab0d384')
version('0.10.1', sha256='708248f6d92f2f4d6342006c520f22dffa2f8adb0a9dc06a058e3effe7fee667')
version('0.10.0', sha256='47e0798caaac4df499bce5fe554a914abd884a855a27085a4473de1d737d9548')
version('0.9.0', sha256='efb28fed4ffcfaee653e0657f6500fc4cbac61e32104f4208da385676e76312a')
version('0.4.5', sha256='2b737be42678900470ae9e48c975ac5b2296d9ae23c007bf118350dbe7c0552b')
version('0.4.4', sha256='d52a21dda271ae645711ce99c70cf44c5d3a809138e656bbff00998827548ebb')
version('0.9.0', sha256='efb28fed4ffcfaee653e0657f6500fc4cbac61e32104f4208da385676e76312a')
version('0.8.1', sha256='dfd0761e0b7e36c1d74c928ad986500c905be5ebcfbc29914d574af1db7218cf')
version('0.8.0', sha256='aa840321d056abd3c6be10c4a1e98a64f9f73fff9aa89c468dae8c003974a078')
version('0.7.0', sha256='a084a9c5d843e2343bf3f319154a48abe3d35d52feb0ad45dec427a1c4ffc416')
version('0.6.1', sha256='dada1f60a512789747011184b2767d2b44136ef3b036d86947f1896d200d2ba7')
version('0.6.0', sha256='a0e53728a9541ef87934831f3d05f2ccfdc3b8aeffe3e037be2b92b12400598e')
version('0.5.4', sha256='2157b05309614d6af0e4bbc6065987aede590822634a0522161f3af5d647abc9')
version('0.5.3', sha256='76b5c5880a0b15f5b91f7d626c5bc3b76ce7e5d21456963c117ab711bf1c5333')
version('0.5.2', sha256='2418c619bdd44257a170b85b9d2ecb75def29e751b725e27186468ada2e009ea')
version('0.5.1', sha256='85e6a18b111afeea2e475fe991db2a441ec3824211d659bee7b0012c36be9a40')
version('0.5.0', sha256='ebba7330a8715e96a6d6dc0aa085125d529d0740d788f0544c6169d892e4f861')
version('0.4.5', sha256='2b737be42678900470ae9e48c975ac5b2296d9ae23c007bf118350dbe7c0552b')
version('0.4.4', sha256='d52a21dda271ae645711ce99c70cf44c5d3a809138e656bbff00998827548ebb')
version('0.4.3', sha256='cbd2ab580181c17317cf18b2bf825bcded2d97cab01cd5b5fe4f4d520b64f90f')
version('0.4.2', sha256='8e6f41252abadcdb2cc7a07f910ec4b45fb12c46f0a578672c6a186c7efcdb36')
version('0.4.1', sha256='008c648d3c46ece063ae8b5008480d8ae6d359d35967356685d1c09da07e1064')
version('0.4.0', sha256='6474714eee72ba2d4e271ed00ce8c05d67a9d15327bc03962b821b2af2c5ca36')
version('0.3.2', sha256='ca5caf7b2b48c7639f45d815b32e76d69650f3199eb8caa541d402722e3f6c10')
version('0.3.1', sha256='218d0e28b4d1ee34585f2ac6b18d169c81404d93958815e73e60cc0368efcbb7')
version('0.3.0', sha256='357fd8bdf86034b93902616f0844bd52e9304cccca22971ab7007588bf9d5fb3')
depends_on('java@8:', type=('build', 'link', 'run'))
depends_on('zip')
# https://docs.bazel.build/versions/master/install-compile-source.html#bootstrap-bazel
depends_on('java@8', type=('build', 'run'))
depends_on('python', type=('build', 'run'))
patch('fix_env_handling.patch', when='@:0.4.5')
patch('fix_env_handling-0.9.0.patch', when='@0.9.0:0.12.0')
patch('fix_env_handling-0.13.0.patch', when='@0.13.0:0.13.999')
patch('fix_env_handling-0.17.2.patch', when='@0.14.0:')
patch('link.patch')
patch('cc_configure.patch', when='@:0.4.5')
patch('unix_cc_configure.patch', when='@0.9.0')
patch('unix_cc_configure-0.10.0.patch', when='@0.10.0:0.14.999')
patch('unix_cc_configure-0.17.2.patch', when='@0.15.0:')
# Pass Spack environment variables to the build
patch('bazelruleclassprovider-0.25.patch', when='@0.25:')
patch('bazelruleclassprovider-0.14.patch', when='@0.14:0.24')
patch('bazelconfiguration-0.3.patch', when='@:0.13')
# Inject include paths
patch('unix_cc_configure-0.15.patch', when='@0.15:')
patch('unix_cc_configure-0.10.patch', when='@0.10:0.14')
patch('unix_cc_configure-0.5.3.patch', when='@0.5.3:0.9')
patch('cc_configure-0.5.0.patch', when='@0.5.0:0.5.2')
patch('cc_configure-0.3.0.patch', when='@:0.4')
# Set CC and CXX
patch('compile-0.29.patch', when='@0.29:')
patch('compile-0.21.patch', when='@0.21:0.28')
patch('compile-0.16.patch', when='@0.16:0.20')
patch('compile-0.13.patch', when='@0.13:0.15')
patch('compile-0.9.patch', when='@0.9:0.12')
patch('compile-0.6.patch', when='@0.6:0.8')
patch('compile-0.4.patch', when='@0.4:0.5')
patch('compile-0.3.patch', when='@:0.3')
phases = ['bootstrap', 'install']
def url_for_version(self, version):
if version >= Version('0.4.1'):
return 'https://github.com/bazelbuild/bazel/releases/download/{0}/bazel-{0}-dist.zip'.format(version)
url = 'https://github.com/bazelbuild/bazel/releases/download/{0}/bazel-{0}-dist.zip'
else:
return 'https://github.com/bazelbuild/bazel/archive/{0}.tar.gz'.format(version)
url = 'https://github.com/bazelbuild/bazel/archive/{0}.tar.gz'
return url.format(version)
def setup_build_environment(self, env):
env.set('EXTRA_BAZEL_ARGS', '--host_javabase=@local_jdk//:jdk')
def bootstrap(self, spec, prefix):
bash = which('bash')
bash('./compile.sh')
def install(self, spec, prefix):
bash = which('bash')
bash('-c', './compile.sh')
mkdir(prefix.bin)
install('output/bazel', prefix.bin)
@run_after('install')
@on_package_attributes(run_tests=True)
def test(self):
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/bazel.rb
with working_dir('spack-test', create=True):
touch('WORKSPACE')
with open('ProjectRunner.java', 'w') as f:
f.write("""\
public class ProjectRunner {
public static void main(String args[]) {
System.out.println("Hi!");
}
}""")
with open('BUILD', 'w') as f:
f.write("""\
java_binary(
name = "bazel-test",
srcs = glob(["*.java"]),
main_class = "ProjectRunner",
)""")
bazel = Executable(self.prefix.bin.bazel)
bazel('build', '//:bazel-test')
exe = Executable('bazel-bin/bazel-test')
assert exe(output=str) == 'Hi!\n'
def setup_dependent_package(self, module, dependent_spec):
class BazelExecutable(Executable):
"""Special callable executable object for bazel so the user can
specify parallel or not on a per-invocation basis. Using
'parallel' as a kwarg will override whatever the package's
global setting is, so you can either default to true or false
and override particular calls.
Note that if the SPACK_NO_PARALLEL_MAKE env var is set it
overrides everything.
"""
def __init__(self, name, command, jobs):
super(BazelExecutable, self).__init__(name)
self.bazel_command = command
self.jobs = jobs
def __call__(self, *args, **kwargs):
disable = env_flag(SPACK_NO_PARALLEL_MAKE)
parallel = ((not disable) and kwargs.get('parallel',
self.jobs > 1))
jobs = "--jobs=1"
if parallel:
jobs = "--jobs=%d" % self.jobs
args = (self.bazel_command,) + (jobs,) + args
return super(BazelExecutable, self).__call__(*args, **kwargs)
jobs = cpu_count()
dependent_module = inspect.getmodule(dependent_spec.package)
if not dependent_spec.package.parallel:
jobs = 1
elif dependent_module.make_jobs:
jobs = dependent_module.make_jobs
module.bazel = BazelExecutable('bazel', 'build', jobs)
module.bazel = Executable('bazel')

View File

@ -1,6 +1,4 @@
diff --git a/tools/cpp/unix_cc_configure.bzl.orig b/tools/cpp/unix_cc_configure.bzl
index f67b9b5..cc952e0 100755
--- a/tools/cpp/unix_cc_configure.bzl.orig
--- a/tools/cpp/unix_cc_configure.bzl
+++ b/tools/cpp/unix_cc_configure.bzl
@@ -147,9 +147,18 @@ def get_escaped_cxx_inc_directories(repository_ctx, cc, additional_flags = []):
else:
@ -12,14 +10,13 @@ index f67b9b5..cc952e0 100755
+ _prepare_include_path(repository_ctx, _cxx_inc_convert(p))
+ for p in inc_dirs.split("\n")
+ ]
+
+ env = repository_ctx.os.environ
+ if "SPACK_DEPENDENCIES" in env:
+ for dep in env["SPACK_DEPENDENCIES"].split(":"):
+ path = dep + "/include"
+ if "SPACK_INCLUDE_DIRS" in env:
+ for path in env["SPACK_INCLUDE_DIRS"].split(":"):
+ default_inc_directories.append(path)
+
+ return default_inc_directories
def _is_option_supported(repository_ctx, cc, option):
"""Checks that `option` is supported by the C compiler. Doesn't %-escape the option."""

View File

@ -1,8 +1,6 @@
diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
index 361931b..a79129b 100755
--- a/tools/cpp/unix_cc_configure.bzl
+++ b/tools/cpp/unix_cc_configure.bzl
@@ -145,11 +145,19 @@ def get_escaped_cxx_inc_directories(repository_ctx, cc, lang_flag, additional_fl
@@ -145,11 +145,18 @@ def get_escaped_cxx_inc_directories(repository_ctx, cc, lang_flag, additional_fl
else:
inc_dirs = result.stderr[index1 + 1:index2].strip()
@ -13,9 +11,8 @@ index 361931b..a79129b 100755
]
+ env = repository_ctx.os.environ
+ if "SPACK_DEPENDENCIES" in env:
+ for dep in env["SPACK_DEPENDENCIES"].split(":"):
+ path = dep + "/include"
+ if "SPACK_INCLUDE_DIRS" in env:
+ for path in env["SPACK_INCLUDE_DIRS"].split(":"):
+ default_inc_directories.append(path)
+
+ return default_inc_directories

View File

@ -1,10 +1,6 @@
diff --git a/spack-expanded-archive/tools/cpp/unix_cc_configure.bzl.orig b/spack-expanded-archive/tools/cpp/unix_cc_configure.bzl
old mode 100644
new mode 100755
index aa46f55..ae3c689
--- spack-expanded-archive/tools/cpp/unix_cc_configure.bzl
+++ spack-expanded-archive/tools/cpp/unix_cc_configure.bzl
@@ -117,9 +117,23 @@ def get_escaped_cxx_inc_directories(repository_ctx, cc):
--- a/tools/cpp/unix_cc_configure.bzl
+++ b/tools/cpp/unix_cc_configure.bzl
@@ -117,9 +117,19 @@ def get_escaped_cxx_inc_directories(repository_ctx, cc):
else:
inc_dirs = result.stderr[index1 + 1:index2].strip()
@ -16,12 +12,8 @@ index aa46f55..ae3c689
+ ]
+ env = repository_ctx.os.environ
+ if "SPACK_DEPENDENCIES" in env:
+ for dep in env["SPACK_DEPENDENCIES"].split(":"):
+ path = dep + "/include"
+ # path = repository_ctx.os.path.join(dep, "include")
+ # if not repository_ctx.os.path.exists(path):
+ # continue
+ 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))
+ )

View File

@ -57,7 +57,6 @@ class Jdk(Package):
version('1.8.0_131-b11', sha256='62b215bdfb48bace523723cdbb2157c665e6a25429c73828a32f00e587301236', curl_options=curl_options,
url='http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz')
provides('java')
provides('java@12', when='@12.0:12.999')
provides('java@11', when='@11.0:11.999')
provides('java@10', when='@10.0:10.999')