gnu: fenics-dolfin, fenics: Remove input labels.

* gnu/packages/simulation.scm (fenics-dolfin)[inputs, native-inputs]
[propagated-inputs]: Remove labels.  Replace CATCH2-1, which was
actually unused, by CATCH-FRAMEWORK.
[arguments]: Rewrite using gexps.  Adjust 'set-paths' phase accordingly.
(fenics): Likewise.
This commit is contained in:
Ludovic Courtès 2023-06-15 17:31:56 +02:00 committed by Ludovic Courtès
parent 9a86e2e97f
commit eb64632422
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -569,28 +569,24 @@ (define-public fenics-dolfin
"$ENV{CATCH_DIR}/include" back "\n"))))))) "$ENV{CATCH_DIR}/include" back "\n")))))))
(build-system cmake-build-system) (build-system cmake-build-system)
(inputs (inputs
`(("blas" ,openblas) (list openblas
("boost" ,boost) boost
("eigen" ,eigen) eigen
("hdf5" ,hdf5-parallel-openmpi) hdf5-parallel-openmpi
("lapack" ,lapack) lapack
("libxml2" ,libxml2) libxml2
("openmpi" ,openmpi) openmpi
("python" ,python-3) python-3
("scotch" ,pt-scotch32) pt-scotch32
("suitesparse" ,suitesparse) suitesparse
("sundials" ,sundials-openmpi) sundials-openmpi
("zlib" ,zlib))) zlib))
(native-inputs (native-inputs
`(("catch" ,catch2-1) (list catch-framework pkg-config))
("pkg-config" ,pkg-config)))
(propagated-inputs (propagated-inputs
`(("ffc" ,python-fenics-ffc) (list python-fenics-ffc petsc-openmpi slepc-openmpi))
("petsc" ,petsc-openmpi)
("slepc" ,slepc-openmpi)))
(arguments (arguments
`(#:configure-flags (list #:configure-flags #~`("-DDOLFIN_ENABLE_DOCS:BOOL=OFF"
`("-DDOLFIN_ENABLE_DOCS:BOOL=OFF"
"-DDOLFIN_ENABLE_HDF5:BOOL=ON" "-DDOLFIN_ENABLE_HDF5:BOOL=ON"
"-DDOLFIN_ENABLE_MPI:BOOL=ON" "-DDOLFIN_ENABLE_MPI:BOOL=ON"
"-DDOLFIN_ENABLE_PARMETIS:BOOL=OFF" "-DDOLFIN_ENABLE_PARMETIS:BOOL=OFF"
@ -598,20 +594,28 @@ (define-public fenics-dolfin
"-DDOLFIN_ENABLE_SUNDIALS:BOOL=ON" "-DDOLFIN_ENABLE_SUNDIALS:BOOL=ON"
"-DDOLFIN_ENABLE_TRILINOS:BOOL=OFF") "-DDOLFIN_ENABLE_TRILINOS:BOOL=OFF")
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'patch-usr-bin-file 'mpi-setup (add-after 'patch-usr-bin-file 'mpi-setup
,%openmpi-setup) #$%openmpi-setup)
(add-after 'patch-source-shebangs 'set-paths (add-after 'patch-source-shebangs 'set-paths
(lambda _ (lambda _
;; Define paths to store locations. ;; Define paths to store locations.
(setenv "BLAS_DIR" (assoc-ref %build-inputs "blas")) (setenv "BLAS_DIR"
(setenv "CATCH_DIR" (assoc-ref %build-inputs "catch")) #$(this-package-input "openblas"))
(setenv "LAPACK_DIR" (assoc-ref %build-inputs "lapack")) (setenv "CATCH_DIR"
(setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc")) #$(this-package-input "catch"))
(setenv "SLEPC_DIR" (assoc-ref %build-inputs "slepc")) (setenv "LAPACK_DIR"
(setenv "SCOTCH_DIR" (assoc-ref %build-inputs "scotch")) #$(this-package-input "lapack"))
(setenv "SUNDIALS_DIR" (assoc-ref %build-inputs "sundials")) (setenv "PETSC_DIR"
(setenv "UMFPACK_DIR" (assoc-ref %build-inputs "suitesparse")))) #$(this-package-input "petsc"))
(setenv "SLEPC_DIR"
#$(this-package-input "slepc"))
(setenv "SCOTCH_DIR"
#$(this-package-input "scotch"))
(setenv "SUNDIALS_DIR"
#$(this-package-input "sundials"))
(setenv "UMFPACK_DIR"
#$(this-package-input "suitesparse"))))
(add-before 'check 'pre-check (add-before 'check 'pre-check
(lambda _ (lambda _
;; The Dolfin repository uses git-lfs, whereby web links are ;; The Dolfin repository uses git-lfs, whereby web links are
@ -630,8 +634,7 @@ (define-public fenics-dolfin
;; invoked ;; invoked
(call-with-output-file "CTestCustom.cmake" (call-with-output-file "CTestCustom.cmake"
(lambda (port) (lambda (port)
(display (display (string-append
(string-append
"set(CTEST_CUSTOM_TESTS_IGNORE " "set(CTEST_CUSTOM_TESTS_IGNORE "
"demo_bcs_serial " "demo_bcs_serial "
"demo_bcs_mpi " "demo_bcs_mpi "
@ -708,29 +711,27 @@ (define-public fenics
(name "fenics") (name "fenics")
(build-system python-build-system) (build-system python-build-system)
(inputs (inputs
`(("pybind11" ,pybind11) (modify-inputs (package-inputs fenics-dolfin)
("python-matplotlib" ,python-matplotlib) (delete "python")
,@(alist-delete "python" (package-inputs fenics-dolfin)))) (prepend pybind11 python-matplotlib)))
(native-inputs (native-inputs
`(("cmake" ,cmake-minimal) (modify-inputs (package-native-inputs fenics-dolfin)
("ply" ,python-ply) (prepend cmake-minimal python-ply python-pytest python-decorator)))
("pytest" ,python-pytest)
("python-decorator" ,python-decorator)
,@(package-native-inputs fenics-dolfin)))
(propagated-inputs (propagated-inputs
`(("dolfin" ,fenics-dolfin) (list fenics-dolfin
("petsc4py" ,python-petsc4py) python-petsc4py
("slepc4py" ,python-slepc4py) python-slepc4py
;; 'dolfin/jit/jit.py' parses 'dolfin.pc' at run time. ;; 'dolfin/jit/jit.py' parses 'dolfin.pc' at run time.
("python-pkgconfig" ,python-pkgconfig))) python-pkgconfig))
(arguments (arguments
`(#:phases (list #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'relax-requirements (add-after 'unpack 'relax-requirements
(lambda _ (lambda _
(substitute* "python/setup.py" (substitute* "python/setup.py"
(("pybind11==") "pybind11>=")))) (("pybind11==")
"pybind11>="))))
(add-after 'unpack 'set-dolfin-pc-file-name (add-after 'unpack 'set-dolfin-pc-file-name
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
;; Instead of cluttering the user's 'PKG_CONFIG_PATH' environment ;; Instead of cluttering the user's 'PKG_CONFIG_PATH' environment
@ -739,15 +740,16 @@ (define-public fenics
"/lib/pkgconfig/dolfin.pc"))) "/lib/pkgconfig/dolfin.pc")))
(substitute* "python/dolfin/jit/jit.py" (substitute* "python/dolfin/jit/jit.py"
(("pkgconfig\\.parse\\(\"dolfin\"\\)") (("pkgconfig\\.parse\\(\"dolfin\"\\)")
(string-append "pkgconfig.parse(\"" pc-file "\")")))))) (string-append "pkgconfig.parse(\"" pc-file
"\")"))))))
(add-after 'patch-source-shebangs 'set-paths (add-after 'patch-source-shebangs 'set-paths
(lambda _ (lambda _
;; Define paths to store locations. ;; Define paths to store locations.
(setenv "PYBIND11_DIR" (assoc-ref %build-inputs "pybind11")) (setenv "PYBIND11_DIR" #$(this-package-input "pybind11"))
;; Move to python sub-directory. ;; Move to python sub-directory.
(chdir "python"))) (chdir "python")))
(add-after 'build 'mpi-setup (add-after 'build 'mpi-setup
,%openmpi-setup) #$%openmpi-setup)
(add-before 'check 'pre-check (add-before 'check 'pre-check
(lambda _ (lambda _
;; Exclude three tests that generate ;; Exclude three tests that generate
@ -758,8 +760,8 @@ (define-public fenics
;; git-lfs. ;; git-lfs.
(substitute* "demo/test.py" (substitute* "demo/test.py"
(("(.*stem !.*)" line) (("(.*stem !.*)" line)
(string-append (string-append line
line "\n" "\n"
"excludeList = [\n" "excludeList = [\n"
"'built-in-meshes', \n" "'built-in-meshes', \n"
"'hyperelasticity', \n" "'hyperelasticity', \n"
@ -786,30 +788,33 @@ (define-public fenics
"demos = [" "demos = ["
"d for d in demos if d[0].stem not in " "d for d in demos if d[0].stem not in "
"excludeList]\n"))) "excludeList]\n")))
(setenv "HOME" (getcwd)) (setenv "HOME"
(getcwd))
;; Restrict OpenBLAS to MPI-only in preference to MPI+OpenMP. ;; Restrict OpenBLAS to MPI-only in preference to MPI+OpenMP.
(setenv "OPENBLAS_NUM_THREADS" "1"))) (setenv "OPENBLAS_NUM_THREADS" "1")))
(replace 'check (replace 'check
(lambda* (#:key tests? #:allow-other-keys) (lambda* (#:key tests? #:allow-other-keys)
(when tests? (when tests?
(with-directory-excursion "test" (with-directory-excursion "test"
(invoke (invoke "pytest"
"pytest" "unit" "unit"
;; The test test_snes_set_from_options() in the file ;; The test test_snes_set_from_options() in the file
;; unit/nls/test_PETScSNES_solver.py fails and is ignored. ;; unit/nls/test_PETScSNES_solver.py fails and is ignored.
"--ignore" "unit/nls/test_PETScSNES_solver.py" "--ignore"
"unit/nls/test_PETScSNES_solver.py"
;; Fails with a segfault. ;; Fails with a segfault.
"--ignore" "unit/io/test_XDMF.py"))))) "--ignore"
"unit/io/test_XDMF.py")))))
(add-after 'install 'install-demo-files (add-after 'install 'install-demo-files
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let* ((demos (string-append (let* ((demos (string-append (assoc-ref outputs "out")
(assoc-ref outputs "out")
"/share/python-dolfin/demo"))) "/share/python-dolfin/demo")))
(mkdir-p demos) (mkdir-p demos)
(with-directory-excursion "demo" (with-directory-excursion "demo"
(for-each (lambda (file) (for-each (lambda (file)
(let* ((dir (dirname file)) (let* ((dir (dirname file))
(tgt-dir (string-append demos "/" dir))) (tgt-dir (string-append
demos "/" dir)))
(unless (equal? "." dir) (unless (equal? "." dir)
(mkdir-p tgt-dir) (mkdir-p tgt-dir)
(install-file file tgt-dir)))) (install-file file tgt-dir))))