[bug#77991,2/4] gnu: scotch: Keep *.cmake in the main output.

Message ID f8112759099ec1b49e08fa836be9893ae08a2e8a.1745335552.git.ludo@gnu.org
State New
Headers
Series Upgrade Scotch to 7.0.7 |

Commit Message

Ludovic Courtès April 22, 2025, 3:31 p.m. UTC
  From: Ludovic Courtès <ludovic.courtes@inria.fr>

This fixes a bug whereby ‘SCOTCHConfig.cmake’ would fail to find
‘scotchmetisTargets.cmake’ because it expects it to be in the same
directory as itself, ${CMAKE_CURRENT_LIST_DIR}.

* gnu/packages/maths.scm (scotch)[arguments]: Adjust ‘install-metis’
phase to keep *.cmake in “out”.

Change-Id: If8d8f890852c35cede6e81c33d18b9101988a635
---
 gnu/packages/maths.scm | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
  

Patch

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 2c53f6d8af..6a11103e3b 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -5220,15 +5220,22 @@  (define-public scotch
        (modify-phases %standard-phases
          (add-after 'install 'install-metis
            (lambda* (#:key outputs #:allow-other-keys)
+             ;; Move the METIS compatibility library to a separate output to
+             ;; avoid a name clash on <metis.h>.
              (let* ((out    (assoc-ref outputs "out"))
                     (metis  (assoc-ref outputs "metis"))
                     (prefix (string-length out)))
                (for-each (lambda (file)
-                           (let ((target (string-append
-                                          metis
-                                          (string-drop file prefix))))
-                             (mkdir-p (dirname target))
-                             (rename-file file target)))
+                           ;; 'SCOTCHConfig.cmake' includes
+                           ;; *metisTargets.cmake from
+                           ;; ${CMAKE_CURRENT_LIST_DIR} so keep all *.cmake
+                           ;; files in "out".
+                           (unless (string-suffix? ".cmake" file)
+                             (let ((target (string-append
+                                            metis
+                                            (string-drop file prefix))))
+                               (mkdir-p (dirname target))
+                               (rename-file file target))))
                          (find-files out "metis"))))))))
     (home-page "https://www.labri.fr/perso/pelegrin/scotch/")
     (properties