Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • rshimoura/ebrains-spack-builds
  • ziaee/ebrains-spack-builds
  • hl11/ebrains-spack-builds
  • filippomarchetti/ebrains-spack-builds
  • jkaiser/ebrains-spack-builds
  • hjorth/ebrains-spack-builds-sept-2024
  • dsegebarth/ebrains-spack-builds
  • kozlov/ebrains-spack-builds
  • dsegebarth/ebrains-spack-builds-na-3
  • ansimsek/ebrains-spack-builds
  • lupoc/ebrains-spack-builds
  • hartmut/ebrains-spack-builds
  • ri/tech-hub/platform/esd/ebrains-spack-builds
  • lcalori0/ebrains-spack-builds
  • deepu/ebrains-spack-builds
  • noelp/ebrains-spack-builds
16 results
Show changes
Showing
with 854 additions and 12 deletions
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Acpype(PythonPackage):
"""A tool based in Python to use Antechamber to generate topologies for chemical
compounds and to interface with others python applications like CCPN and ARIA"""
# Homepage and download url
homepage = "https://github.com/alanwilter/acpype"
git = 'https://github.com/alanwilter/acpype.git'
url = 'https://github.com/alanwilter/acpype/archive/refs/tags/2022.7.21.tar.gz'
# Set the gitlab accounts of this package maintainers
maintainers = ['dbeltran']
# Versions
version('master', branch='master')
version('2022.7.21', sha256='5f7e6162d9a0aed2f770b9ccf5617ac1398a423cca815ae37cbf66d4cd62ea2f')
# Dependencies
depends_on('python@3.8:', type=('build', 'run'))
depends_on('ambertools')
depends_on('openbabel')
depends_on('py-poetry-core')
# Test
@run_after('install')
@on_package_attributes(run_tests=True)
def check_install (self):
python("-c", 'import acpype')
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Ambertools(CMakePackage):
"""AmberTools is a free, useful standalone package and a prerequisite
for installing Amber itself. The AmberTools suite is free of charge,
and its components are mostly released under the GNU General Public
License (GPL). A few components are included that are in the public
domain or which have other, open-source, licenses. The libsander and
libpbsa libraries use the LGPL license."""
homepage = "https://ambermd.org/AmberTools.php"
url = "https://ambermd.org/downloads/AmberTools22jlmrcc.tar.bz2"
maintainers("d-beltran")
# begin EBRAINS (added): add version
version("23_rc6", sha256="debb52e6ef2e1b4eaa917a8b4d4934bd2388659c660501a81ea044903bf9ee9d")
# end EBRAINS
version("22jlmrcc", sha256="1571d4e0f7d45b2a71dce5999fa875aea8c90ee219eb218d7916bf30ea229121")
depends_on("flex", type="build")
depends_on("bison", type="build")
depends_on("tcsh", type="build")
depends_on("zlib", type=("build", "run"))
depends_on("bzip2", type=("build", "run"))
depends_on("blas", type=("build", "run"))
depends_on("lapack", type=("build", "run"))
depends_on("arpack-ng", type=("build", "run"))
depends_on("netcdf-c", type=("build", "run"))
depends_on("netcdf-fortran", type=("build", "run"))
depends_on("fftw", type=("build", "run"))
depends_on("readline", type=("build", "run"))
depends_on("netlib-xblas~plain_blas", type=("build", "run"))
# Specific variants needed for boost according to build logs
depends_on(
"boost+thread+system+program_options+iostreams+regex+timer+chrono+filesystem+graph",
type=("build", "run"),
)
# Python dependencies
# begin EBRAINS (modified): add version
depends_on("python@3.8:3.10 +tkinter", type=("build", "run"), when="@22jlmrcc")
depends_on("python@3.8: +tkinter", type=("build", "run"), when="@23_rc6")
# end EBRAINS
depends_on("py-setuptools", type="build")
depends_on("py-numpy", type=("build", "run"))
depends_on("py-matplotlib", type=("build", "run"))
depends_on("py-scipy", type=("build", "run"))
def cmake_args(self):
# Translated from ambertools build/run_cmake script
# We also add the TRUST_SYSTEM_LIBS argument mentioned in the ambertools guide
# https://ambermd.org/pmwiki/pmwiki.php/Main/CMake-Guide-to-Options
args = [
self.define("COMPILER", "GNU"),
self.define("MPI", False),
self.define("CUDA", False),
self.define("INSTALL_TESTS", True),
self.define("DOWNLOAD_MINICONDA", False),
self.define("TRUST_SYSTEM_LIBS", True),
# This is to avoid the x11 (X11_Xext_LIB) error
# It is equivalent to the "-noX11" flag accoridng to the docs:
# https://ambermd.org/pmwiki/pmwiki.php/Main/CMake-Common-Options
self.define("BUILD_GUI", False),
]
return args
def setup_run_environment(self, env):
env.set("AMBER_PREFIX", self.prefix)
env.set("AMBERHOME", self.prefix)
def setup_build_environment(self, env):
env.set("AMBER_PREFIX", self.prefix)
env.set("AMBERHOME", self.prefix)
@run_after("install")
@on_package_attributes(run_tests=True)
def check_install(self):
make("test.serial")
# Temporarily copy netcdf.h header file to netcdf-fortran/include to pass the Ambertools
# cmake check (quickest fix, will probably cause problems, needs to change)
@run_before("cmake")
def fix_check(self):
cp = Executable("cp")
cp(
self.spec["netcdf-c"].headers.directories[0] + "/netcdf.h",
self.spec["netcdf-fortran"].headers.directories[0],
)
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
from spack.package import *
class Apbs(CMakePackage):
"""
APBS (Adaptive Poisson-Boltzmann Solver) solves the equations of continuum electrostatics
for large biomolecular assemblages. This software was designed from the ground up
for large biomolecular assemblages. This software was designed "from the ground up"
using modern design principles to ensure its ability to interface with other computational
packages and evolve as methods and applications change over time. The APBS code is
accompanied by extensive documentation for both users and programmers and is supported
......@@ -30,17 +29,50 @@ class Apbs(CMakePackage):
version('3.4.0', sha256='572ff606974119430020ec948c78e171d8525fb0e67a56dad937a897cac67461')
# Dependencies.
depends_on('cmake@3.19', type='build')
depends_on('python@3.9:3.10', type=('build'))
depends_on('blas', type='build')
depends_on('suite-sparse', type='build')
depends_on('maloc', type='build')
depends_on('cmake@3.19:', type=('build'))
depends_on('bison', type=('build'))
depends_on('flex', type=('build'))
depends_on('swig', type=('build'))
depends_on('readline', type=('build', 'run'))
depends_on('eigen', type=('build', 'run'))
depends_on('boost', type=('build', 'run'))
depends_on('blas', type=('build', 'run'))
depends_on('arpack-ng', type=('build', 'run'))
depends_on('suite-sparse', type=('build', 'run'))
depends_on('maloc', type=('build', 'run'))
depends_on('python@3.8:3.11', type=('build', 'run'))
def cmake_args(self):
# Min and max Python versions need to be set as variables to pass tests.
# See tests/CMakeLists.txt lines 6-14.
python_version = str(self.spec['python'].version)
args = [
'-DPYTHON_MIN_VERSION=3.9',
'-DPYTHON_MAX_VERSION=3.10',
]
self.define('PYTHON_MIN_VERSION', python_version),
self.define('PYTHON_MAX_VERSION', python_version),
self.define('BLAS_FOUND', True),
self.define('BLAS_INCLUDE_DIRS', self.spec['blas'].prefix.include),
self.define('BLAS_LIBRARIES', self.spec['blas'].libs.joined(';'))
]
return args
def setup_build_environment(self, env):
# add suite-sparse libs to path because tests can't find them
env.prepend_path('LD_LIBRARY_PATH', self.spec['suite-sparse'].prefix.lib)
env.prepend_path('LD_LIBRARY_PATH', self.spec['blas'].prefix.lib)
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_build_environment(env)
@run_after('install')
@on_package_attributes(run_tests=True)
def install_test(self):
with working_dir(self.build_directory):
# for testing, apbs needs to be in the path
import os
os.environ['PATH'] = self.prefix.bin + ':' + os.environ['PATH']
ctest = which("ctest")
ctest("-C", "Release", "--output-on-failure")
def check(self):
# this would run "make test" before installation, so we override this and define install_test() instead
pass
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Arbor(CMakePackage, CudaPackage):
"""Arbor is a high-performance library for computational neuroscience
simulations."""
homepage = "https://arbor-sim.org"
git = "https://github.com/arbor-sim/arbor.git"
url = "https://github.com/arbor-sim/arbor/releases/download/v0.9.0/arbor-v0.9.0-full.tar.gz"
maintainers = ("thorstenhater", "ErbB4", "haampie")
version("master", branch="master", submodules=True)
version("develop", branch="master", submodules=True)
version(
"0.10.0",
sha256="72966b7a2f45ce259b8ba167ca3e4f5ab9f212136a300267aaac0c04ed3fe3fc",
url="https://github.com/arbor-sim/arbor/releases/download/v0.10.1/arbor-v0.10.0-full.tar.gz",
)
version(
"0.9.0",
sha256="5f9740955c821aca81e23298c17ad64f33f635756ad9b4a0c1444710f564306a",
url="https://github.com/arbor-sim/arbor/releases/download/v0.9.0/arbor-v0.9.0-full.tar.gz",
)
version(
"0.8.1",
sha256="caebf96676ace6a9c50436541c420ca4bb53f0639dcab825de6fa370aacf6baa",
url="https://github.com/arbor-sim/arbor/releases/download/v0.8.1/arbor-v0.8.1-full.tar.gz",
)
version(
"0.8.0",
sha256="18df5600308841616996a9de93b55a105be0f59692daa5febd3a65aae5bc2c5d",
url="https://github.com/arbor-sim/arbor/releases/download/v0.8/arbor-v0.8-full.tar.gz",
)
version(
"0.7.0",
sha256="c3a6b7193946aee882bb85f9c38beac74209842ee94e80840968997ba3b84543",
url="https://github.com/arbor-sim/arbor/releases/download/v0.7/arbor-v0.7-full.tar.gz",
)
version(
"0.6.0",
sha256="4cd333b18effc8833428ddc0b99e7dc976804771bc85da90034c272c7019e1e8",
url="https://github.com/arbor-sim/arbor/releases/download/v0.6/arbor-v0.6-full.tar.gz",
)
version(
"0.5.2",
sha256="290e2ad8ca8050db1791cabb6b431e7c0409c305af31b559e397e26b300a115d",
url="https://github.com/arbor-sim/arbor/releases/download/v0.5.2/arbor-v0.5.2-full.tar.gz",
)
variant(
"assertions",
default=False,
description="Enable arb_assert() assertions in code.",
)
variant("doc", default=False, description="Build documentation.")
variant("mpi", default=False, description="Enable MPI support")
variant("python", default=True, description="Enable Python frontend support")
variant(
"vectorize",
default=False,
description="Enable vectorization of computational kernels",
)
variant(
"gpu_rng",
default=False,
description="Use GPU generated random numbers -- not bitwise equal to CPU version",
when="+cuda",
)
# https://docs.arbor-sim.org/en/latest/install/build_install.html#compilers
conflicts("%gcc@:8")
conflicts("%clang@:9")
# Cray compiler v9.2 and later is Clang-based.
conflicts("%cce@:9.1")
conflicts("%intel")
# begin EBRAINS (modified: added run dep)
depends_on("cmake@3.19:", type=("build", "run"))
# end EBRAINS
# misc dependencies
depends_on("fmt@7.1:", when="@0.5.3:") # required by the modcc compiler
depends_on("fmt@9.1:", when="@0.7.1:")
# begin EBRAINS (modified: relaxed (upstream gave no info about update))
# upstream adds: depends_on("fmt@10.1:", when="@0.9.1:")
depends_on("googletest@1.12.1:", when="@0.7.1:")
depends_on("pugixml@1.11:", when="@0.7.1:")
# upstream adds: depends_on("pugixml@1.13:", when="@0.9.1:")
depends_on("nlohmann-json@3.11.2:")
depends_on("random123")
#upstream adds: depends_on("random123@1.14.0:", when="@0.10:")
# end EBRAINS (modified)
with when("+cuda"):
depends_on("cuda@10:")
depends_on("cuda@11:", when="@0.7.1:")
depends_on("cuda@12:", when="@0.9.1:")
# mpi
# begin EBRAINS (modified: added run dep)
depends_on("mpi", when="+mpi", type=("build", "run"))
# end EBRAINS (modified)
depends_on("py-mpi4py", when="+mpi+python", type=("build", "run"))
# python (bindings)
with when("+python"):
extends("python")
depends_on("python@3.7:", type=("build", "run"))
depends_on("python@3.9:", when="@0.9.1:", type=("build", "run"))
depends_on("py-numpy", type=("build", "run"))
depends_on("py-pybind11@2.6:", type="build")
depends_on("py-pybind11@2.8.1:", when="@0.5.3:", type="build")
depends_on("py-pybind11@2.10.1:", when="@0.7.1:", type="build")
depends_on("py-pandas", type="test")
depends_on("py-seaborn", type="test")
# sphinx based documentation
with when("+doc"):
depends_on("python@3.10:", type="build")
depends_on("py-sphinx", type="build")
depends_on("py-svgwrite", type="build")
@property
def build_targets(self):
return ["all", "html"] if "+doc" in self.spec else ["all"]
def cmake_args(self):
args = [
self.define_from_variant("ARB_WITH_ASSERTIONS", "assertions"),
self.define_from_variant("ARB_WITH_MPI", "mpi"),
self.define_from_variant("ARB_WITH_PYTHON", "python"),
self.define_from_variant("ARB_VECTORIZE", "vectorize"),
]
if "+cuda" in self.spec:
args.append("-DARB_GPU=cuda")
args.append(self.define_from_variant("ARB_USE_GPU_RNG", "gpu_rng"))
# query spack for the architecture-specific compiler flags set by its wrapper
args.append("-DARB_ARCH=none")
opt_flags = spack.build_environment.optimization_flags(
self.compiler, self.spec.target
)
# Might return nothing
if opt_flags:
args.append("-DARB_CXX_FLAGS_TARGET=" + opt_flags)
# Needed, spack has no units package
args.append("-DARB_USE_BUNDLED_UNITS=ON")
return args
@run_after("install", when="+python")
@on_package_attributes(run_tests=True)
def install_test(self):
python("-c", "import arbor")
python("python/example/single_cell_model.py")
--- 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/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)
--- 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
@@ -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/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 --color=auto --color=auto -Naur a/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java 1980-01-01 00:00:00
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java 2024-02-15 13:36:37
@@ -143,7 +143,7 @@
LabelConstants.EXPERIMENTAL_EXTERNAL_PATH_PREFIX.getRelative(
execPath.relativeTo(execRoot.getParentDirectory()));
} else {
- absolutePathProblems.add(execPathFragment.getPathString());
+ // absolutePathProblems.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"
diff --git a/third_party/ijar/zlib_client.h b/third_party/ijar/zlib_client.h
index c4b051e0100c..0a917ff0a99a 100644
--- a/third_party/ijar/zlib_client.h
+++ b/third_party/ijar/zlib_client.h
@@ -16,7 +16,9 @@
#define THIRD_PARTY_IJAR_ZLIB_CLIENT_H_
#include <limits.h>
+
#include <limits>
+#include <stdexcept>
#include "third_party/ijar/common.h"
diff --git a/third_party/ijar/mapped_file_unix.cc b/third_party/ijar/mapped_file_unix.cc
index 6e3a90871844..65179e3290ec 100644
--- a/third_party/ijar/mapped_file_unix.cc
+++ b/third_party/ijar/mapped_file_unix.cc
@@ -15,10 +15,11 @@
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
-#include <unistd.h>
#include <sys/mman.h>
+#include <unistd.h>
#include <algorithm>
+#include <limits>
#include "third_party/ijar/mapped_file.h"
--- a/third_party/grpc/grpc_1.33.1.patch
+++ b/third_party/grpc/grpc_1.33.1.patch
@@ -58,6 +58,14 @@ index 09fcad95a2..9b737e5deb 100644
)
native.bind(
+@@ -245,6 +245,7 @@ def grpc_deps():
+ "https://storage.googleapis.com/grpc-bazel-mirror/github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
+ "https://github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
+ ],
++ patches = ["@com_github_grpc_grpc//:third_party/abseil-cpp/absl.patch"],
+ )
+
+ if "bazel_toolchains" not in native.existing_rules():
diff --git a/bazel/grpc_extra_deps.bzl b/bazel/grpc_extra_deps.bzl
index 4c1dfad2e8..f63c54ddef 100644
--- a/bazel/grpc_extra_deps.bzl
@@ -120,3 +128,25 @@ index c047f0c515..7c24fbc617 100644
":windows": "@com_github_grpc_grpc//third_party/cares:config_windows/ares_config.h",
":android": "@com_github_grpc_grpc//third_party/cares:config_android/ares_config.h",
"//conditions:default": "@com_github_grpc_grpc//third_party/cares:config_linux/ares_config.h",
+
+--- /dev/null
++++ b/third_party/abseil-cpp/absl.patch
+@@ -0,0 +1,18 @@
++0e2c62da1dcaf6529abab952bdcc96c6de2d9506 by Abseil Team <absl-team@google.com>:
++
++Add missing <limits> include
++
++PiperOrigin-RevId: 339054753
++
++--
++
++--- absl/synchronization/internal/graphcycles.cc
+++++ absl/synchronization/internal/graphcycles.cc
++@@ -37,6 +37,7 @@
++
++ #include <algorithm>
++ #include <array>
+++#include <limits>
++ #include "absl/base/internal/hide_ptr.h"
++ #include "absl/base/internal/raw_logging.h"
++ #include "absl/base/internal/spinlock.h"
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
from spack.package import *
class Bazel(Package):
"""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://bazel.build/"
url = "https://github.com/bazelbuild/bazel/releases/download/3.1.0/bazel-3.1.0-dist.zip"
maintainers("LydDeb")
tags = ["build-tools"]
license("Apache-2.0")
version("7.0.2", sha256="dea2b90575d43ef3e41c402f64c2481844ecbf0b40f8548b75a204a4d504e035")
version("7.0.1", sha256="596b13e071d27c43343ec8f5d263cb5312fafe7ef8702401f7ed492f182f4e6c")
version("7.0.0", sha256="477e54f6374001f439a9471ba1de9d7824daf129db95510849ecc5e19ce88170")
version("6.5.0", sha256="fc89da919415289f29e4ff18a5e01270ece9a6fe83cb60967218bac4a3bb3ed2")
version("6.4.0", sha256="bd88ff602c8bbb29ee82ba2a6b12ad092d51ec668c6577f9628f18e48ff4e51e")
version("6.3.2", sha256="8cd7feac58193be2bcba451ba6688a46824d37ca6359ff58e0d44eb98f042948")
version("6.3.1", sha256="2676319e86c5aeab142dccd42434364a33aa330a091c13562b7de87a10e68775")
version("6.3.0", sha256="902198981b1d26112fc05913e79f1b3e9772c3f95594caf85619d041ba06ede0")
version("6.2.1", sha256="4cf4d264bff388ee0012735728630d23832d3c9d021383b2fadceadb0775dd6b")
version("6.2.0", sha256="f1e8f788637ac574d471d619d2096baaca04a19b57a034399e079633db441945")
version("6.1.2", sha256="6fb3ee22fe9fa86d82e173572d504c089f10825d749725592626e090b38c9679")
version("6.1.1", sha256="6b900f26d676c7eca1d2e7dff9b71890dabd3ff59cab2a2d2178bc8a0395342a")
version("6.1.0", sha256="c4b85675541cf66ee7cb71514097fdd6c5fc0e02527243617a4f20ca6b4f2932")
version("6.0.0", sha256="7bc0c5145c19a56d82a08fce6908c5e1a0e75e4fbfb3b6f12b4deae7f4b38cbc")
version("5.4.0", sha256="a1c62d9bcb4e03106ddf0b7bd96196ba246e1c9b7a935daf8d9beda8bbdcb8a1")
version("5.3.2", sha256="3880ad919592d1e3e40c506f13b32cd0a2e26f129d87cb6ba170f1801d7d7b82")
version("5.3.1", sha256="18486e7152ca26b26585e9b2a6f49f332b116310d3b7e5b70583f1f1f24bb8ae")
version("5.3.0", sha256="ee801491ff0ec3a562422322a033c9afe8809b64199e4a94c7433d4e14e6b921")
version("5.2.0", sha256="820a94dbb14071ed6d8c266cf0c080ecb265a5eea65307579489c4662c2d582a")
version("5.1.1", sha256="7f5d3bc1d344692b2400f3765fd4b5c0b636eb4e7a8a7b17923095c7b56a4f78")
version("5.1.0", sha256="4de301f509fc6d0cbc697b2017384ecdc94df8f36245bbcbedc7ea6780acc9f5")
version("5.0.0", sha256="072dd62d237dbc11e0bac02e118d8c2db4d0ba3ba09f1a0eb1e2a460fb8419db")
version("4.2.4", sha256="d5ba2ef28da5275f22e832aaa7f9319c61ea5db9b6a3e23b28a6a64ad03078f3")
version("4.2.3", sha256="b0e84d0538f3ec2b95a49bae31a5066f0967281a3ca99965016fbe178acd2d3d")
version("4.2.2", sha256="9981d0d53a356c4e87962847750a97c9e8054e460854748006c80f0d7e2b2d33")
version("4.2.1", sha256="12ea7aa11e2bdb12de1dceb9939a22e96f5a480437cb17c123379d8e0fdf5e82")
version("4.2.0", sha256="74814b63920aaee47dbbbee7082e5c4317e4eebaf07e03c5fb5626e1716f1034")
version("4.1.0", sha256="f377d755c96a50f6bd2f423562598d822f43356783330a0b780ad442864d6eeb")
version("4.0.0", sha256="d350f80e70654932db252db380d2ec0144a00e86f8d9f2b4c799ffdb48e9cdd1")
version("3.7.2", sha256="de255bb42163a915312df9f4b86e5b874b46d9e8d4b72604b5123c3a845ed9b1")
version("3.7.1", sha256="c9244e5905df6b0190113e26082c72d58b56b1b0dec66d076f083ce4089b0307")
version("3.7.0", sha256="63873623917c756d1be49ff4d5fc23049736180e6b9a7d5236c6f204eddae3cc")
version("3.6.0", sha256="3a18f24febb5203f11b0985b27e120ac623058d1d5ca79cd6df992e67d57240a")
version("3.5.1", sha256="67eae714578b22d24192b0eb3a2d35b07578bbd57a33c50f1e74f8acd6378b3c")
version("3.5.0", sha256="334429059cf82e222ca8a9d9dbbd26f8e1eb308613463c2b8655dd4201b127ec")
version("3.4.1", sha256="27af1f11c8f23436915925b25cf6e1fb07fccf2d2a193a307c93437c60f63ba8")
version("3.4.0", sha256="7583abf8905ba9dd5394294e815e8873635ac4e5067e63392e8a33b397e450d8")
version("3.3.1", sha256="e0f1f43c65c4e0a38522b37e81f6129d8a1f7cd3d8884847be306544a7492747")
version("3.3.0", sha256="05a03960de09d5775839c5766ad8a0a30f261feaba5fa53ce3e49168d1eee826")
version("3.2.0", sha256="44ec129436f6de45f2230e14100104919443a1364c2491f5601666b358738bfa")
version("3.1.0", sha256="d7f40d0cac95a06cea6cb5b7f7769085257caebc3ee84269dd9298da760d5615")
version("3.0.0", sha256="530f5132e0a50da7ebb0ed08d9b6f1ddfd0d7d9b5d0beb2df5d687a4c8daf6b3")
version("2.2.0", sha256="9379878a834d105a47a87d3d7b981852dd9f64bc16620eacd564b48533e169a7")
version("2.1.1", sha256="83f67f28f4e47ff69043307d1791c9bffe83949e84165d49058b84eded932647")
version("2.1.0", sha256="3371cd9050989173a3b27364668328653a65653a50a85c320adc53953b4d5f46")
version("2.0.1", sha256="a863ed9e6fc420fbd92e63a12fe1a5b9be1a7a36f11f61f1fdc582c813bbe543")
version("2.0.0", sha256="724da3c656f68e787a86ebb9844773aa1c2e3a873cc39462a8f1b336153d6cbb")
variant(
"nodepfail",
default=True,
description="Disable failing dependency checks due to injected absolute paths - "
"required for most builds using bazel with spack",
)
# begin EBRAINS (added): to provide ld via GCC_HOST_COMPILER_PREFIX
depends_on("binutils", type=("build"))
# end EBRAINS
# https://bazel.build/install/compile-source#bootstrap-unix-prereq
depends_on("java@11", when="@5.3:", type=("build", "run"))
depends_on("java@8,11", when="@3.3:5.2", type=("build", "run"))
depends_on("java@8", when="@0.6:3.2", type=("build", "run"))
depends_on("python+pythoncmd", type=("build", "run"))
depends_on("zip", when="platform=linux", type=("build", "run"))
# Pass Spack environment variables to the build
patch("bazelruleclassprovider-0.25.patch")
# Inject include paths
patch("unix_cc_configure-3.0.patch", when="@3:")
patch("unix_cc_configure-0.15.patch", when="@:2")
# Set CC and CXX
# begin EBRAINS (modified): bring upstream after checking since when this is breaking the build
patch("compile-0.29.patch", when="@:5.3")
# end EBRAINS
# Disable dependency search
patch("cppcompileaction-7.0.0.patch", when="@7: +nodepfail")
patch("cppcompileaction-0.3.2.patch", when="@:6 +nodepfail")
# https://github.com/bazelbuild/bazel/issues/17956
patch("apple-clang-14.0.3.patch", when="@:4.2.3,5:6.1.1")
# https://github.com/bazelbuild/bazel/issues/17958
patch(
"https://github.com/bazelbuild/bazel/commit/43dadb275b3f9690242bf2d94a0757c721d231a9.patch?full_index=1",
sha256="af73a49006baa05475b1b79dad83e1e014ebfe22f38aa55774f9a465404aed54",
when="@5.0:5.4.0,6.0",
)
# Fix build with Fujitsu compiler
patch("blaze_util_posix-0.29.1.patch", when="%fj")
patch("unix_cc_configure_fj-5.2.patch", when="@5.2:%fj")
patch("unix_cc_configure_fj-5.0.patch", when="@5.0:5.1%fj")
patch("unix_cc_configure_fj-0.29.1.patch", when="@:4%fj")
patch("bazelruleclassprovider_fj-0.25.patch", when="%fj")
# https://blog.bazel.build/2021/05/21/bazel-4-1.html
conflicts("platform=darwin target=aarch64:", when="@:4.0")
# https://github.com/bazelbuild/bazel/issues/18642
patch(
"https://github.com/bazelbuild/bazel/pull/20785.patch?full_index=1",
sha256="85dde31d129bbd31e004c5c87f23cdda9295fbb22946dc6d362f23d83bae1fd8",
when="@6.0:6.4",
)
conflicts("%gcc@13:", when="@:5")
# Patches for compiling various older bazels which had ICWYU violations revealed by
# (but not unique to) GCC 11 header changes. These are derived from
# https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/29084/
patch("gcc11_1.patch", when="@:4")
patch("gcc11_2.patch", when="@:4")
patch("gcc11_3.patch", when="@:4")
patch("gcc11_4.patch", when="@4.1:4")
# Bazel-4.0.0 does not compile with gcc-11
# Newer versions of grpc and abseil dependencies are needed but are not in bazel-4.0.0
conflicts("@4.0.0", when="%gcc@11:")
# https://github.com/bazelbuild/bazel/pull/23667
conflicts("%apple-clang@16:", when="@:7.3")
executables = ["^bazel$"]
# Download resources to perform offline build with bazel.
# The following URLs and sha256 are in the file distdir_deps.bzl at the root of bazel sources.
resource_dictionary = {}
resource_dictionary["bazel_skylib"] = {
"url": "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.1/bazel-skylib-1.0.1.tar.gz",
"sha256": "f1c8360c01fcf276778d3519394805dc2a71a64274a3a0908bc9edff7b5aebc8",
"when": "@4:6",
}
resource_dictionary["com_google_absl"] = {
"url": "https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.0.tar.gz",
"sha256": "59d2976af9d6ecf001a81a35749a6e551a335b949d34918cfade07737b9d93c5",
"when": "@6.0:6.4",
}
resource_dictionary["zulu_11_56_19"] = {
"url": "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-linux_x64.tar.gz",
"sha256": "e064b61d93304012351242bf0823c6a2e41d9e28add7ea7f05378b7243d34247",
"when": "@6",
}
resource_dictionary["zulu_11_50_19"] = {
"url": "https://mirror.bazel.build/openjdk/azul-zulu11.50.19-ca-jdk11.0.12/zulu11.50.19-ca-jdk11.0.12-linux_x64.tar.gz",
"sha256": "b8e8a63b79bc312aa90f3558edbea59e71495ef1a9c340e38900dd28a1c579f3",
"when": "@5",
}
resource_dictionary["zulu_11_37_17"] = {
"url": "https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz",
"sha256": "360626cc19063bc411bfed2914301b908a8f77a7919aaea007a977fa8fb3cde1",
"when": "@4",
}
for resource_name in resource_dictionary.keys():
resource(
when=resource_dictionary[resource_name]["when"],
name=resource_name,
url=resource_dictionary[resource_name]["url"],
sha256=resource_dictionary[resource_name]["sha256"],
destination="archive",
expand=False,
)
@classmethod
def determine_version(cls, exe):
output = Executable(exe)("version", output=str, error=str)
match = re.search(r"Build label: ([\d.]+)", output)
return match.group(1) if match else None
# begin EBRAINS (added)
def setup_dependent_build_environment(self, env, dependent_spec):
env.prepend_path("GCC_HOST_COMPILER_PREFIX", self.spec['binutils'].prefix.bin)
# end EBRAINS
def setup_build_environment(self, env):
# fix the broken linking (on power9)
# https://github.com/bazelbuild/bazel/issues/10327
env.set("BAZEL_LINKOPTS", "")
env.set("BAZEL_LINKLIBS", "-lstdc++")
# .WARNING: Option 'host_javabase' is deprecated
# Use local java installation
# begin EBRAINS (modified): expose CC and CXX (the spack compiler wrappers)
args = "--color=no --define=ABSOLUTE_JAVABASE={0} --verbose_failures --action_env=CC --action_env=CXX --jobs={1}".format(
self.spec["java"].prefix, make_jobs
)
# end EBRAINS
resource_stages = self.stage[1:]
for _resource in resource_stages:
try:
resource_name = _resource.resource.name
if self.spec.satisfies(self.resource_dictionary[resource_name]["when"]):
archive_path = _resource.source_path
args += " --distdir={0}".format(archive_path)
except AttributeError:
continue
env.set("EXTRA_BAZEL_ARGS", args)
@run_before("install")
def bootstrap(self):
bash = which("bash")
bash("./compile.sh")
def install(self, spec, prefix):
mkdir(prefix.bin)
install("output/bazel", prefix.bin)
@run_after("install")
@on_package_attributes(run_tests=True)
def install_test(self):
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/bazel.rb
# Bazel does not work properly on NFS, switch to /tmp
with working_dir("/tmp/spack/bazel/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",
)"""
)
# Spack's logs don't handle colored output well
bazel = Executable(self.spec["bazel"].command.path)
bazel(
"--output_user_root=/tmp/spack/bazel/spack-test",
"build",
"--color=no",
f"--jobs={make_jobs}",
"//:bazel-test",
)
exe = Executable("bazel-bin/bazel-test")
assert exe(output=str) == "Hi!\n"
def setup_dependent_package(self, module, dependent_spec):
module.bazel = Executable(self.spec["bazel"].command.path)
@property
def parallel(self):
return not self.spec.satisfies("%fj")
--- a/tools/cpp/unix_cc_configure.bzl
+++ b/tools/cpp/unix_cc_configure.bzl
@@ -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()
- return [
+ default_inc_directories = [
_prepare_include_path(repository_ctx, _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(path)
+
+ return default_inc_directories
+
def _is_compiler_option_supported(repository_ctx, cc, option):
"""Checks that `option` is supported by the C compiler. Doesn't %-escape the option."""
result = repository_ctx.execute([
diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
index 5feb10b76a..cde0b8f8f1 100644
--- a/tools/cpp/unix_cc_configure.bzl
+++ b/tools/cpp/unix_cc_configure.bzl
@@ -151,8 +151,14 @@ def get_escaped_cxx_inc_directories(repository_ctx, cc, lang_flag, additional_fl
).stdout.strip() + "/share"
inc_directories.append(_prepare_include_path(repository_ctx, resource_dir))
+ env = repository_ctx.os.environ
+ if "SPACK_INCLUDE_DIRS" in env:
+ for path in env["SPACK_INCLUDE_DIRS"].split(":"):
+ inc_directories.append(path)
+
return inc_directories
+
def _is_compiler_option_supported(repository_ctx, cc, option):
"""Checks that `option` is supported by the C compiler. Doesn't %-escape the option."""
result = repository_ctx.execute([