Subject: [bug#71920] [PATCH] gnu: xyce: Update to 7.8.

From: Robin Ole Heinemann <[email-masked]>
Date: Wed, 3 Jul 2024 17:16:12 +0200

* gnu/packages/engineering.scm (xyce-{serial,parallel}): Update to 7.8.
     [inputs]: Remove lapack. Add openblas.
     [arguments]: Add option to 'configure-flags' to use openblas instead of
      lapack.

Change-Id: Ie99689829c679851233e186c639924935de6b297
---
 gnu/packages/engineering.scm | 181 ++++++++++++++++++-----------------
 1 file changed, 93 insertions(+), 88 deletions(-)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 64335d89f7..344a12fd2e 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2079,44 +2079,49 @@ (define trilinos-serial-xyce
     (build-system cmake-build-system)
     (arguments
      `(#:out-of-source? #t
-       #:phases
-       (modify-phases %standard-phases
-         ;; Delete unneeded tribits(build system) directory which makes validate-runpath
-         ;; phase to fail.
-         (add-before 'validate-runpath 'delete-tribits
-           (lambda* (#:key outputs #:allow-other-keys)
-             (delete-file-recursively
-              (string-append (assoc-ref outputs "out")
-                             "/lib/cmake/tribits")))))
-       #:configure-flags
-       (list "-DCMAKE_CXX_FLAGS=-O3 -fPIC"
-             "-DCMAKE_C_FLAGS=-O3 -fPIC"
-             "-DCMAKE_Fortran_FLAGS=-O3 -fPIC"
-             "-DTrilinos_ENABLE_NOX=ON"
-             "-DNOX_ENABLE_LOCA=ON"
-             "-DTrilinos_ENABLE_EpetraExt=ON"
-             "-DEpetraExt_BUILD_BTF=ON"
-             "-DEpetraExt_BUILD_EXPERIMENTAL=ON"
-             "-DEpetraExt_BUILD_GRAPH_REORDERINGS=ON"
-             "-DTrilinos_ENABLE_TrilinosCouplings=ON"
-             "-DTrilinos_ENABLE_Ifpack=ON"
-             "-DTrilinos_ENABLE_Isorropia=ON"
-             "-DTrilinos_ENABLE_AztecOO=ON"
-             "-DTrilinos_ENABLE_Belos=ON"
-             "-DTrilinos_ENABLE_Teuchos=ON"
-             "-DTeuchos_ENABLE_COMPLEX=ON"
-             "-DTrilinos_ENABLE_Amesos=ON"
-             "-DAmesos_ENABLE_KLU=ON"
-             "-DAmesos_ENABLE_UMFPACK=ON"
-             "-DTrilinos_ENABLE_Sacado=ON"
-             "-DTrilinos_ENABLE_Kokkos=OFF"
-             "-DTrilinos_ENABLE_ALL_OPTIONAL_PACKAGES=OFF"
-             "-DTPL_ENABLE_AMD=ON"
-             "-DTPL_ENABLE_UMFPACK=ON"
-             "-DTPL_ENABLE_BLAS=ON"
-             "-DTPL_ENABLE_LAPACK=ON")))
+       #:phases (modify-phases %standard-phases
+                  ;; Delete unneeded tribits(build system) directory which makes validate-runpath
+                  ;; phase to fail.
+                  (add-before 'validate-runpath 'delete-tribits
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (delete-file-recursively (string-append (assoc-ref
+                                                               outputs "out")
+                                                              "/lib/cmake/tribits")))))
+       #:configure-flags (list "-DCMAKE_CXX_FLAGS=-O3 -fPIC"
+                               "-DCMAKE_C_FLAGS=-O3 -fPIC"
+                               "-DCMAKE_Fortran_FLAGS=-O3 -fPIC"
+                               "-DTrilinos_ENABLE_NOX=ON"
+                               "-DNOX_ENABLE_LOCA=ON"
+                               "-DTrilinos_ENABLE_EpetraExt=ON"
+                               "-DEpetraExt_BUILD_BTF=ON"
+                               "-DEpetraExt_BUILD_EXPERIMENTAL=ON"
+                               "-DEpetraExt_BUILD_GRAPH_REORDERINGS=ON"
+                               "-DTrilinos_ENABLE_TrilinosCouplings=ON"
+                               "-DTrilinos_ENABLE_Ifpack=ON"
+                               "-DTrilinos_ENABLE_Isorropia=ON"
+                               "-DTrilinos_ENABLE_AztecOO=ON"
+                               "-DTrilinos_ENABLE_Belos=ON"
+                               "-DTrilinos_ENABLE_Teuchos=ON"
+                               "-DTrilinos_ENABLE_COMPLEX_DOUBLE=ON"
+                               "-DTrilinos_ENABLE_Amesos=ON"
+                               "-DAmesos_ENABLE_KLU=ON"
+                               "-DAmesos_ENABLE_UMFPACK=ON"
+                               "-DTrilinos_ENABLE_Amesos2=ON"
+                               "-DAmesos2_ENABLE_KLU2=ON"
+                               "-DAmesos2_ENABLE_Basker=ON"
+                               "-DTrilinos_ENABLE_Sacado=ON"
+                               "-DTrilinos_ENABLE_Stokhos=ON"
+                               "-DTrilinos_ENABLE_Kokkos=ON"
+                               "-DTrilinos_ENABLE_ALL_OPTIONAL_PACKAGES=OFF"
+                               "-DTrilinos_ENABLE_CXX11=ON"
+                               "-DTPL_ENABLE_AMD=ON"
+                               "-DTPL_ENABLE_UMFPACK=ON"
+                               "-DTPL_ENABLE_BLAS=ON"
+                               "-DTPL_ENABLE_LAPACK=ON"
+                               "-DBLAS_LIBRARY_NAMES=openblas"
+                               "-DLAPACK_LIBRARY_NAMES=openblas")))
     (native-inputs (list gfortran swig))
-    (inputs (list boost lapack suitesparse))
+    (inputs (list boost openblas suitesparse))
     (home-page "https://trilinos.org")
     (synopsis "Engineering and scientific problems algorithms")
     (description
@@ -2124,37 +2129,43 @@ (define trilinos-serial-xyce
 technologies within an object-oriented software framework for the solution of
 large-scale, complex multi-physics engineering and scientific problems.  A
 unique design feature of Trilinos is its focus on packages.")
-    (license (list license:lgpl2.1+
-                   license:bsd-3))))
+    (license (list license:lgpl2.1+ license:bsd-3))))
+
+(define xyce-common-flags
+  (list "CXXFLAGS=-O3"
+         "--enable-stokhos"
+         "--enable-amesos2"
+         "LIBS=-lopenblas"))
 
 (define-public xyce-serial
   (package
     (name "xyce-serial")
-    (version "6.8")
+    (version "7.8.0")
     (source
-     (origin (method url-fetch)
-             (uri (string-append "https://archive.org/download/Xyce-"
-                                 version "/Xyce-" version ".tar.gz"))
-             (sha256
-              (base32
-               "09flp1xywbb2laayd9rg8vd0fjsh115y6k1p71jacy0nrbdvvlcg"))))
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/Xyce/Xyce")
+             (commit (string-append "Release-" version))))
+       (sha256
+        (base32 "01h2gln4qik12a2mp9ai52c21pd8316vsm2nxishw5dfn7cp58zr"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:tests? #f
-       #:configure-flags
-       (list
-        "CXXFLAGS=-O3"
-        (string-append "ARCHDIR="
-                       (assoc-ref %build-inputs "trilinos")))))
-    (native-inputs
-     `(("bison" ,bison-3.0)                  ;'configure' fails with Bison 3.4
-       ("flex" ,flex)
-       ("fortran" ,gfortran)))
-    (inputs
-     `(("fftw" ,fftw)
-       ("suitesparse" ,suitesparse)
-       ("lapack" ,lapack)
-       ("trilinos" ,trilinos-serial-xyce)))
+     (list
+      #:tests? #f
+      #:configure-flags #~(list
+                         (string-append "ARCHDIR=" #$(this-package-input "trilinos"))
+                         #$@xyce-common-flags)))
+    (native-inputs (list bison
+                         flex
+                         gfortran
+                         autoconf
+                         automake
+                         libtool))
+    (inputs `(("fftw" ,fftw)
+              ("suitesparse" ,suitesparse)
+              ("openblas" ,openblas)
+              ("trilinos" ,trilinos-serial-xyce)))
     (home-page "https://xyce.sandia.gov/")
     (synopsis "High-performance analog circuit simulator")
     (description
@@ -2164,39 +2175,33 @@ (define-public xyce-serial
     (license license:gpl3+)))
 
 (define trilinos-parallel-xyce
-  (package (inherit trilinos-serial-xyce)
+  (package
+    (inherit trilinos-serial-xyce)
     (name "trilinos-parallel-xyce")
     (arguments
-     `(,@(substitute-keyword-arguments (package-arguments trilinos-serial-xyce)
-           ((#:configure-flags flags)
-            `(append (list "-DTrilinos_ENABLE_ShyLU=ON"
-                           "-DTrilinos_ENABLE_Zoltan=ON"
-                           "-DTPL_ENABLE_MPI=ON")
-                     ,flags)))))
-    (inputs
-     `(("mpi" ,openmpi)
-       ,@(package-inputs trilinos-serial-xyce)))))
+     (substitute-keyword-arguments (package-arguments trilinos-serial-xyce)
+        ((#:configure-flags flags)
+         `(cons*
+          "-DTrilinos_ENABLE_ShyLU=ON"
+          "-DTrilinos_ENABLE_Zoltan=ON"
+          "-DTPL_ENABLE_MPI=ON"
+          ,flags))))
+    (inputs (modify-inputs (package-inputs trilinos-serial-xyce)
+              (append openmpi)))))
 
 (define-public xyce-parallel
-  (package (inherit xyce-serial)
+  (package
+    (inherit xyce-serial)
     (name "xyce-parallel")
     (arguments
-     `(,@(substitute-keyword-arguments (package-arguments xyce-serial)
-           ((#:configure-flags flags)
-            `(list "CXXFLAGS=-O3"
-                   "CXX=mpiCC"
-                   "CC=mpicc"
-                   "F77=mpif77"
-                   "--enable-mpi"
-                   (string-append
-                    "ARCHDIR="
-                    (assoc-ref %build-inputs "trilinos")))))))
-    (propagated-inputs
-     `(("mpi" ,openmpi)))
-    (inputs
-     `(("trilinos" ,trilinos-parallel-xyce)
-       ,@(alist-delete "trilinos"
-                       (package-inputs xyce-serial))))))
+     (substitute-keyword-arguments (package-arguments xyce-serial)
+       ((#:configure-flags _)
+        #~(list "CXX=mpiCC" "CC=mpicc" "F77=mpif77" "--enable-mpi"
+                (string-append "ARCHDIR=" #$(this-package-input "trilinos"))
+                #$@xyce-common-flags))))
+    (propagated-inputs (list openmpi))
+    (inputs (modify-inputs (package-inputs xyce-serial)
+              (replace "trilinos" trilinos-parallel-xyce)))))
 
 (define-public freehdl
   (package

base-commit: 85012e64819b39fd6112038134548b415fd5daff
-- 
2.45.1