From f11bb588ddf6b8165d3e450e3f34247c8e61ce09 Mon Sep 17 00:00:00 2001
From: Eleni Mathioulaki <emathioulaki@athenarc.gr>
Date: Tue, 10 Oct 2023 13:25:24 +0200
Subject: [PATCH] get correct compiler path from self.compiler

---
 .../nest-simulator-3.6-p1-CxxRealPath.patch   | 31 ++++++++-----------
 packages/nest/package.py                      |  5 ++-
 packages/py-nestml/package.py                 |  1 -
 3 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/packages/nest/nest-simulator-3.6-p1-CxxRealPath.patch b/packages/nest/nest-simulator-3.6-p1-CxxRealPath.patch
index a013f906..db06851a 100644
--- a/packages/nest/nest-simulator-3.6-p1-CxxRealPath.patch
+++ b/packages/nest/nest-simulator-3.6-p1-CxxRealPath.patch
@@ -1,18 +1,13 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index a924f3ebf..641e15d09 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -23,6 +23,13 @@ cmake_minimum_required( VERSION 3.19 )
- list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
- 
- project( nest CXX C )
-+
-+# In case the CXX compiler set is a symlink that disappears at runtime, we want
-+# to resolve to the actual binary.
-+# (Required e.g. for Docker build-images with Spack installations / EBRAINS Jupyter)
-+file(REAL_PATH ${CMAKE_CXX_COMPILER} CMAKE_CXX_COMPILER)
-+file(REAL_PATH ${CMAKE_C_COMPILER} CMAKE_C_COMPILER)
-+
- set( NEST_USER_EMAIL "users@nest-simulator.org" )
- 
- include( ColorMessages )
+diff --git a/bin/nest-config.in b/bin/nest-config.in
+index a54ae0352..43bff5286 100755
+--- a/bin/nest-config.in
++++ b/bin/nest-config.in
+@@ -71,7 +71,7 @@
+         echo "-L$prefix/@CMAKE_INSTALL_LIBDIR@/nest @MODULE_LINK_LIBS@"
+         ;;
+     --compiler)
+-        echo "@CMAKE_CXX_COMPILER@"
++        echo "@SPACK_CXX_COMPILER@"
+         ;;
+     --compiler-name)
+         echo "@CMAKE_CXX_COMPILER_ID@"
diff --git a/packages/nest/package.py b/packages/nest/package.py
index b37011f1..24d7ca2d 100644
--- a/packages/nest/package.py
+++ b/packages/nest/package.py
@@ -160,7 +160,10 @@ class Nest(CMakePackage):
         make("install")
 
     def cmake_args(self):
-        args = ["-DCMAKE_INSTALL_LIBDIR=lib"]
+        args = [
+            "-DCMAKE_INSTALL_LIBDIR=lib",
+            "-DSPACK_CXX_COMPILER=" + self.compiler.cxx
+            ]
 
         for flag in "boost mpi openmp optimize".split():
             if '+' + flag in self.spec:
diff --git a/packages/py-nestml/package.py b/packages/py-nestml/package.py
index f4d9e322..d2010ea0 100644
--- a/packages/py-nestml/package.py
+++ b/packages/py-nestml/package.py
@@ -34,4 +34,3 @@ class PyNestml(PythonPackage):
     depends_on('py-odetoolbox', type=('build', 'run'))
     depends_on('nest', type=('build', 'run'))
     depends_on('py-pytest', type='test')
-    depends_on('gcc', type=('build', 'test', 'run'))    # this should be whatever compiler is used for the env
-- 
GitLab