summaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2026-01-28 11:35:11 +0100
committerAndreas Enge <andreas@enge.fr>2026-02-07 12:28:51 +0100
commitf3997b9a0f4920e10ccca6ae616bb3ff151d954c (patch)
tree8010abe9d1f81bdff70b90411650d92586e4e6ed /gnu/packages
parent32a4f0613b6602f1f077887f0fca191553c33ddf (diff)
gnu: optizelle: Improve style and switch to pyproject.
* gnu/packages/maths.scm (optizelle): [source]<snippet>: Improve style. [arguments]<#:imported-modules, #:modules>: Switch to pyproject-build-system. <#:phases>: Rewrite phase 'set-numpy-path using the site-packages procedure. [inputs, native-inputs]: Drop labels. Change-Id: I76db3d0353cf95e411cfd11a81b34cf6cd851d05 Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/maths.scm77
1 files changed, 36 insertions, 41 deletions
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index fd8270bd8ad..bd744ae9399 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -10869,55 +10869,50 @@ half-precision floating point formats.")
(("file.*package.*$" all)
(string-append "# " all))
((".*[^l].[.]txt\\)\n") "")
- (("add_license.*\"\n") ""))
- #t))))
+ (("add_license.*\"\n") ""))))))
(build-system cmake-build-system)
(arguments
- `(#:imported-modules ((guix build python-build-system)
- ,@%cmake-build-system-modules)
- #:modules (((guix build python-build-system) #:select
- (python-version))
+ (list
+ #:imported-modules (append %cmake-build-system-modules
+ %pyproject-build-system-modules)
+ #:modules `(((guix build pyproject-build-system) #:prefix py:)
(guix build cmake-build-system)
(guix build utils))
- #:configure-flags `("-DCMAKE_CXX_FLAGS:STRING=-pthread"
- "-DENABLE_CPP_UNIT:BOOL=ON"
- "-DENABLE_CPP_EXAMPLES:BOOL=ON"
- "-DENABLE_PYTHON:BOOL=ON"
- "-DENABLE_PYTHON_UNIT:BOOL=ON"
- "-DENABLE_PYTHON_EXAMPLES:BOOL=ON"
- ,(string-append "-DBLAS_LIBRARY:FILEPATH="
- (assoc-ref %build-inputs
- "blas/lapack")
- "/lib/libopenblas.so")
- ,(string-append "-DLAPACK_LIBRARY:FILEPATH="
- (assoc-ref %build-inputs
- "fortran:lib")
- "/lib/libgfortran.so;"
- (assoc-ref %build-inputs
- "fortran:lib")
- "/lib/libquadmath.so"))
- #:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'set-numpy-path ; Needed for the unit tests.
- (lambda* (#:key inputs #:allow-other-keys)
- (let* ((pyver (python-version (assoc-ref inputs "python")))
- (npdir (string-append (assoc-ref inputs "numpy")
- "/lib/python" pyver
- "/site-packages")))
+ #:configure-flags
+ #~(list "-DCMAKE_CXX_FLAGS:STRING=-pthread"
+ "-DENABLE_CPP_UNIT:BOOL=ON"
+ "-DENABLE_CPP_EXAMPLES:BOOL=ON"
+ "-DENABLE_PYTHON:BOOL=ON"
+ "-DENABLE_PYTHON_UNIT:BOOL=ON"
+ "-DENABLE_PYTHON_EXAMPLES:BOOL=ON"
+ (string-append "-DBLAS_LIBRARY:FILEPATH="
+ (search-input-file %build-inputs
+ "/lib/libopenblas.so"))
+ (string-append "-DLAPACK_LIBRARY:FILEPATH="
+ (search-input-file %build-inputs
+ "/lib/libgfortran.so")
+ ";" (search-input-file %build-inputs
+ "/lib/libquadmath.so")))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'set-numpy-path ; Needed for the unit tests.
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((numpy-out (dirname (dirname (which "numpy-config"))))
+ (outputs (list (cons "out" numpy-out))))
(substitute* "src/cmake/Modules/Optizelle.cmake"
(("PYTHONPATH=")
- (string-append "LD_LIBRARY_PATH=$ENV{LIBRARY_PATH};"
- "PYTHONPATH=" npdir ":"))))))
- (delete 'install-license-files)))) ; LICENSE.txt is installed.
+ (string-append
+ "LD_LIBRARY_PATH=$ENV{LIBRARY_PATH};"
+ "PYTHONPATH=" (py:site-packages inputs outputs) ":"))))))
+ (delete 'install-license-files)))) ; LICENSE.txt is installed.
(inputs
- `(("blas/lapack" ,openblas)
- ("fortran:lib" ,gfortran "lib")
- ("jsoncpp" ,jsoncpp)
- ("numpy" ,python-numpy)
- ("python" ,python)))
+ (list openblas
+ (list gfortran "lib")
+ jsoncpp
+ python-numpy
+ python))
(native-inputs
- `(("fortran" ,gfortran)
- ("pkg-config" ,pkg-config)))
+ (list gfortran pkg-config))
(home-page "https://www.optimojoe.com/products/optizelle/")
(synopsis "Mathematical optimization library")
(description "@code{optizelle} is a software library designed to