From 5168af6988cafae482a4a09d721e6ac04689b02c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20M=C3=BCller?= <mueller@kip.uni-heidelberg.de>
Date: Wed, 3 Apr 2024 10:57:15 +0200
Subject: [PATCH 1/4] chore(build-brainscales): define base dependencies

We do always depend on git to be available for `waf setup`.
---
 packages/build-brainscales/package.py | 4 ++++
 packages/hxtorch/package.py           | 2 --
 packages/pynn-brainscales/package.py  | 2 --
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/packages/build-brainscales/package.py b/packages/build-brainscales/package.py
index a162821d..a919b949 100644
--- a/packages/build-brainscales/package.py
+++ b/packages/build-brainscales/package.py
@@ -14,6 +14,10 @@ import spack.build_environment
 class BuildBrainscales(WafPackage):
     """Common stuff for BrainScaleS packages..."""
 
+    # waf setup performs git clone and might query gerrit
+    depends_on('git', type=('build', 'link'))
+    depends_on('py-git-review', type=('build', 'link'))
+
     def do_fetch(self, mirror_only=False):
         """Setup the project."""
 
diff --git a/packages/hxtorch/package.py b/packages/hxtorch/package.py
index f9751d98..8c36d7d9 100644
--- a/packages/hxtorch/package.py
+++ b/packages/hxtorch/package.py
@@ -47,7 +47,6 @@ class Hxtorch(build_brainscales.BuildBrainscales):
     depends_on('cppcheck', type=('build', 'link', 'run'))
     depends_on('genpybind@ebrains', type=('build', 'link', 'run'))
     depends_on('gflags', type=('build', 'link', 'run'))
-    depends_on('git', type=('build', 'link'))
     depends_on('googletest@1.11.0:+gmock', type=('build', 'link', 'run')) # variadic templates needed
     depends_on('inja', type=('build', 'link', 'run', 'test')) # template engine for PPU source jit generation
     depends_on('intel-tbb', type=('build', 'link', 'run'))  # ppu gdbserver
@@ -57,7 +56,6 @@ class Hxtorch(build_brainscales.BuildBrainscales):
     depends_on('pkgconfig', type=('build', 'link', 'run'))
     depends_on('psmisc', type=('run', 'test'))
     depends_on('python@3.7.0:', type=('build', 'link', 'run')) # BrainScaleS-2 only supports Python >= 3.7
-    depends_on('py-git-review', type=('build', 'link'))
     depends_on('py-h5py', type=('build', 'link', 'run')) # PyNN tests need it
     depends_on('py-jax@0.3.25:', type=('build', 'link', 'run'))
     depends_on('py-matplotlib', type=('build', 'link', 'run'))
diff --git a/packages/pynn-brainscales/package.py b/packages/pynn-brainscales/package.py
index 39f07d81..d3c8027e 100644
--- a/packages/pynn-brainscales/package.py
+++ b/packages/pynn-brainscales/package.py
@@ -47,7 +47,6 @@ class PynnBrainscales(build_brainscales.BuildBrainscales):
     depends_on('cppcheck', type=('build', 'link', 'run'))
     depends_on('genpybind@ebrains', type=('build', 'link', 'run'))
     depends_on('gflags', type=('build', 'link', 'run'))
-    depends_on('git', type=('build', 'link'))
     depends_on('googletest@1.11.0:+gmock', type=('build', 'link', 'run')) # variadic templates needed
     depends_on('inja', type=('build', 'link', 'run', 'test')) # template engine for PPU source jit generation
     depends_on('intel-tbb', type=('build', 'link', 'run'))  # ppu gdbserver
@@ -58,7 +57,6 @@ class PynnBrainscales(build_brainscales.BuildBrainscales):
     depends_on('psmisc', type=('run', 'test'))
     depends_on('python@3.7.0:', type=('build', 'link', 'run')) # BrainScaleS-2 only supports Python >= 3.7
     depends_on('py-deap@1.3.1:', type=('build', 'link', 'run'))
-    depends_on('py-git-review', type=('build', 'link'))
     depends_on('py-h5py', type=('build', 'link', 'run')) # PyNN tests need it
     depends_on('py-matplotlib', type=('build', 'link', 'run'))
     depends_on('py-nose', type=('build', 'link', 'run'))
-- 
GitLab


From 9a0f494fb2ffe9daa7ad871cfb70a513ee13584c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20M=C3=BCller?= <mueller@kip.uni-heidelberg.de>
Date: Wed, 3 Apr 2024 10:57:05 +0200
Subject: [PATCH 2/4] chore(hxtorch): Remove jaxsnn-specific deps

---
 packages/hxtorch/package.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/packages/hxtorch/package.py b/packages/hxtorch/package.py
index 8c36d7d9..745d6c57 100644
--- a/packages/hxtorch/package.py
+++ b/packages/hxtorch/package.py
@@ -57,7 +57,6 @@ class Hxtorch(build_brainscales.BuildBrainscales):
     depends_on('psmisc', type=('run', 'test'))
     depends_on('python@3.7.0:', type=('build', 'link', 'run')) # BrainScaleS-2 only supports Python >= 3.7
     depends_on('py-h5py', type=('build', 'link', 'run')) # PyNN tests need it
-    depends_on('py-jax@0.3.25:', type=('build', 'link', 'run'))
     depends_on('py-matplotlib', type=('build', 'link', 'run'))
     depends_on('py-networkx', type=('build', 'link', 'run'))
     depends_on('py-nose', type=('build', 'link', 'run'))
@@ -69,7 +68,6 @@ class Hxtorch(build_brainscales.BuildBrainscales):
     depends_on('py-pylint', type=('build', 'link', 'run'))
     depends_on('py-torch@1.9.1:', type=('build', 'link', 'run', 'test'))
     depends_on('py-torchvision', type=('run')) # for demos
-    depends_on('py-tree-math', type=('build', 'link', 'run'))
     depends_on('py-pyyaml', type=('build', 'link', 'run'))
     depends_on('py-scipy', type=('build', 'link', 'run'))
     depends_on('py-sqlalchemy', type=('build', 'link', 'run'))
-- 
GitLab


From 6bb89fb88200f7a49db69989adf2d0d0f390674c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20M=C3=BCller?= <mueller@kip.uni-heidelberg.de>
Date: Thu, 21 Mar 2024 10:05:39 +0100
Subject: [PATCH 3/4] fix(genpybind): Drop superfluous run dep on llvm

---
 packages/genpybind/package.py        | 7 +++++--
 packages/hxtorch/package.py          | 2 +-
 packages/pynn-brainscales/package.py | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/packages/genpybind/package.py b/packages/genpybind/package.py
index a0a631be..fdca20b6 100644
--- a/packages/genpybind/package.py
+++ b/packages/genpybind/package.py
@@ -43,8 +43,8 @@ class Genpybind(WafPackage):
     version('ebrains', tag='ebrains_release-1-rc1', git='https://github.com/electronicvisions/genpybind')
 
     depends_on(
-            'llvm+clang+python+visionary@5.0.0: libcxx=none',
-        type=('build', 'link', 'run'))
+            'llvm+clang+python+visionary@5.0.0:',
+        type=('build', 'link'))
     depends_on('binutils', type='build')
     depends_on('python@2.7:', type=('build', 'run'))
 
@@ -52,6 +52,9 @@ class Genpybind(WafPackage):
 
     patch('v0.2.1-python3.10.patch', when='@:0.2.1 ^python@3.10:')
 
+    # llvm-config needs to be found at build time of packages using genpybind
+    def setup_dependent_build_environment(self, env, dependent_spec):
+        env.prepend_path("PATH", self.spec["llvm"].prefix.bin)
 
     def configure_args(self):
         args = super(Genpybind, self).configure_args()
diff --git a/packages/hxtorch/package.py b/packages/hxtorch/package.py
index 745d6c57..4e4652dc 100644
--- a/packages/hxtorch/package.py
+++ b/packages/hxtorch/package.py
@@ -45,7 +45,7 @@ class Hxtorch(build_brainscales.BuildBrainscales):
     depends_on('boost@1.69.0: +graph+icu+mpi+numpy+coroutine+context+filesystem+python+serialization+system+thread+program_options cxxstd=17', type=('build', 'link', 'run', 'test'))
     depends_on('cereal', type=('build', 'link', 'run', 'test'))
     depends_on('cppcheck', type=('build', 'link', 'run'))
-    depends_on('genpybind@ebrains', type=('build', 'link', 'run'))
+    depends_on('genpybind@ebrains', type=('build', 'link'))
     depends_on('gflags', type=('build', 'link', 'run'))
     depends_on('googletest@1.11.0:+gmock', type=('build', 'link', 'run')) # variadic templates needed
     depends_on('inja', type=('build', 'link', 'run', 'test')) # template engine for PPU source jit generation
diff --git a/packages/pynn-brainscales/package.py b/packages/pynn-brainscales/package.py
index d3c8027e..9bbefd4d 100644
--- a/packages/pynn-brainscales/package.py
+++ b/packages/pynn-brainscales/package.py
@@ -45,7 +45,7 @@ class PynnBrainscales(build_brainscales.BuildBrainscales):
     depends_on('boost@1.69.0: +graph+icu+mpi+numpy+coroutine+context+filesystem+python+serialization+system+thread+program_options cxxstd=17', type=('build', 'link', 'run', 'test'))
     depends_on('cereal', type=('build', 'link', 'run', 'test'))
     depends_on('cppcheck', type=('build', 'link', 'run'))
-    depends_on('genpybind@ebrains', type=('build', 'link', 'run'))
+    depends_on('genpybind@ebrains', type=('build', 'link'))
     depends_on('gflags', type=('build', 'link', 'run'))
     depends_on('googletest@1.11.0:+gmock', type=('build', 'link', 'run')) # variadic templates needed
     depends_on('inja', type=('build', 'link', 'run', 'test')) # template engine for PPU source jit generation
-- 
GitLab


From 27e0d16eef2817956977adc2c78ebbefed314e6c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20M=C3=BCller?= <mueller@kip.uni-heidelberg.de>
Date: Wed, 3 Apr 2024 10:58:49 +0200
Subject: [PATCH 4/4] fix(jaxsnn): Provide genpybind via build-brainscales

This is somewhat ugly, we should rather introduce a list of dependencies
that are requires for building `hxtorch.core` (which is build by both,
`hxtorch` and `jaxsnn`) and use it in jaxsnn.
---
 packages/build-brainscales/package.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/packages/build-brainscales/package.py b/packages/build-brainscales/package.py
index a919b949..4fc13e34 100644
--- a/packages/build-brainscales/package.py
+++ b/packages/build-brainscales/package.py
@@ -18,6 +18,9 @@ class BuildBrainscales(WafPackage):
     depends_on('git', type=('build', 'link'))
     depends_on('py-git-review', type=('build', 'link'))
 
+    # hack to provide genpybind PATH in all brainscales-style builds
+    depends_on('genpybind@ebrains', type=('build', 'link'))
+
     def do_fetch(self, mirror_only=False):
         """Setup the project."""
 
-- 
GitLab