diff mbox series

[bug#65630,v3,3/4] gnu: onnx: Use G-Expressions.

Message ID fd00927eff034ac9fad34ddea933b35a46afa179.1694375976.git.atai@atai.org
State New
Headers show
Series [bug#65630,v3,1/4] gnu: python-protobuf: Update to 3.20.3 | expand

Commit Message

Andy Tai Sept. 10, 2023, 8:01 p.m. UTC
* gnu/packages/machine-learning.scm (onnx)[arguments]: Convert to list of G-Expressions.
---
 gnu/packages/machine-learning.scm | 88 ++++++++++++++++---------------
 1 file changed, 45 insertions(+), 43 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index c1f5925b11..3c26eb4e64 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1078,50 +1078,52 @@  (define-public onnx
               (snippet '(delete-file-recursively "third_party"))))
     (build-system python-build-system)
     (arguments
-     '(#:phases (modify-phases %standard-phases
-                  (add-before 'build 'pass-cmake-arguments
-                    (lambda* (#:key outputs #:allow-other-keys)
-                      ;; Pass options to the CMake-based build process.
-                      (define out
-                        (assoc-ref outputs "out"))
-
-                      (define args
-                        ;; Copy arguments from 'cmake-build-system', plus ask
-                        ;; for shared libraries.
-                        (list "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
-                              (string-append "-DCMAKE_INSTALL_PREFIX=" out)
-                              "-DCMAKE_INSTALL_LIBDIR=lib"
-                              "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE"
-                              (string-append "-DCMAKE_INSTALL_RPATH=" out
-                                             "/lib")
-                              "-DCMAKE_VERBOSE_MAKEFILE=ON"
-                              "-DONNX_USE_PROTOBUF_SHARED_LIBS=ON"
-                              "-DONNX_OPT_USE_SYSTEM_PROTOBUF=ON"
+     (list #:phases #~(modify-phases %standard-phases
+                        (add-before 'build 'pass-cmake-arguments
+                          (lambda* (#:key outputs #:allow-other-keys)
+                            ;; Pass options to the CMake-based build process.
+                            (define out
+                              (assoc-ref outputs "out"))
+
+                            (define args
+                              ;; Copy arguments from 'cmake-build-system', plus ask
+                              ;; for shared libraries.
+                              (list "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
+                               (string-append "-DCMAKE_INSTALL_PREFIX=" out)
+                               "-DCMAKE_INSTALL_LIBDIR=lib"
+                               "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE"
+                               (string-append "-DCMAKE_INSTALL_RPATH=" out
+                                              "/lib")
+                               "-DCMAKE_VERBOSE_MAKEFILE=ON"
+                               "-DONNX_USE_PROTOBUF_SHARED_LIBS=ON"
+                               "-DONNX_OPT_USE_SYSTEM_PROTOBUF=ON"
                                ; force system copy use;
-                              "-DBUILD_SHARED_LIBS=ON"))
-
-                      ;; This environment variable is honored by 'setup.py',
-                      ;; which passes it down to 'cmake'.
-                      (setenv "CMAKE_ARGS" (string-join args))
-
-                      ;; This one is honored by 'setup.py' and passed to 'make
-                      ;; -j'.
-                      (setenv "MAX_JOBS"
-                              (number->string (parallel-job-count)))))
-                  (add-before 'check 'make-test-directory-writable
-                    (lambda _
-                      ;; Make things writable for tests.
-                      (setenv "HOME" (getcwd))
-                      (for-each make-file-writable
-                                (find-files "onnx/examples" "."
-                                            #:directories? #t))))
-                  (add-after 'install 'install-from-cmake
-                    (lambda _
-                      ;; Run "make install" in the build tree 'setup.py'
-                      ;; created for CMake so that libonnx.so,
-                      ;; libonnx_proto.so, etc. are installed.
-                      (invoke "make" "install"
-                              "-C" ".setuptools-cmake-build"))))))
+                               "-DBUILD_SHARED_LIBS=ON"))
+
+                            ;; This environment variable is honored by 'setup.py',
+                            ;; which passes it down to 'cmake'.
+                            (setenv "CMAKE_ARGS"
+                                    (string-join args))
+
+                            ;; This one is honored by 'setup.py' and passed to 'make
+                            ;; -j'.
+                            (setenv "MAX_JOBS"
+                                    (number->string (parallel-job-count)))))
+                        (add-before 'check 'make-test-directory-writable
+                          (lambda _
+                            ;; Make things writable for tests.
+                            (setenv "HOME"
+                                    (getcwd))
+                            (for-each make-file-writable
+                                      (find-files "onnx/examples" "."
+                                                  #:directories? #t))))
+                        (add-after 'install 'install-from-cmake
+                          (lambda _
+                            ;; Run "make install" in the build tree 'setup.py'
+                            ;; created for CMake so that libonnx.so,
+                            ;; libonnx_proto.so, etc. are installed.
+                            (invoke "make" "install" "-C"
+                                    ".setuptools-cmake-build"))))))
     (native-inputs
      (list cmake
            googletest