~ruther/guix-local

ab3fd8a4e8bb7a3a04f008dc911855e98d1ca407 — Nicolas Graves 5 months ago e292f21
gnu: z3: Switch to pyproject.

* gnu/packages/maths.scm (z3):
[arguments]<#:imported-modules, #:modules, #:phases>: Switch to
pyproject-build-system.
<#:phases>: Replace phase 'compile-python-modules by the one in
pyproject-build-system.

Change-Id: Ie74daad5cd152bd80447219a9c82fa7d0827ac9b
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Signed-off-by: Rutherther <rutherther@ditigal.xyz>
1 files changed, 24 insertions(+), 28 deletions(-)

M gnu/packages/maths.scm
M gnu/packages/maths.scm => gnu/packages/maths.scm +24 -28
@@ 8755,11 8755,11 @@ arrays, uninterpreted functions and their combinations.")
    (build-system cmake-build-system)
    (arguments
     (list
      #:imported-modules `((guix build python-build-system)
                           ,@%cmake-build-system-modules)
      #:imported-modules (append %cmake-build-system-modules
                                 %pyproject-build-system-modules)
      #:modules '((guix build cmake-build-system)
                  (guix build utils)
                  ((guix build python-build-system) #:select (site-packages)))
                  ((guix build pyproject-build-system) #:prefix py:))
      #:configure-flags
      #~(list "-DZ3_BUILD_PYTHON_BINDINGS=ON"
              "-DZ3_LINK_TIME_OPTIMIZATION=ON"


@@ 8769,31 8769,27 @@ arrays, uninterpreted functions and their combinations.")
               #$(version-major+minor (package-version python-wrapper))
               "/site-packages"))
      #:phases
      #~(modify-phases %standard-phases
          (replace 'check
            (lambda* (#:key parallel-build? tests? #:allow-other-keys)
              (when tests?
                (invoke "make" "test-z3"
                        (format #f "-j~a"
                                (if parallel-build?
                                    (parallel-job-count)
                                    1)))
                (invoke "./test-z3" "/a"))))
          (add-after 'install 'compile-python-modules
            (lambda _
              (setenv "PYTHONHASHSEED" "0")

              (invoke "python" "-m" "compileall"
                      "--invalidation-mode=unchecked-hash"
                      #$output)))
          ;; This step is missing in the CMake build system, do it here.
          (add-after 'compile-python-modules 'fix-z3-library-path
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((dest (string-append (site-packages inputs outputs)
                                          "/z3/lib/libz3.so"))
                     (z3-lib (string-append #$output "/lib/libz3.so")))
                (mkdir-p (dirname dest))
                (symlink z3-lib dest)))))))
      (with-extensions (list (pyproject-guile-json))
        #~(modify-phases %standard-phases
            (replace 'check
              (lambda* (#:key parallel-build? tests? #:allow-other-keys)
                (when tests?
                  (invoke "make" "test-z3"
                          (format #f "-j~a"
                                  (if parallel-build?
                                      (parallel-job-count)
                                      1)))
                  (invoke "./test-z3" "/a"))))
            (add-after 'install 'compile-python-modules
              (assoc-ref py:%standard-phases 'compile-bytecode))
            ;; This step is missing in the CMake build system, do it here.
            (add-after 'compile-python-modules 'fix-z3-library-path
              (lambda* (#:key inputs outputs #:allow-other-keys)
                (let* ((dest (string-append (py:site-packages inputs outputs)
                                            "/z3/lib/libz3.so"))
                       (z3-lib (string-append #$output "/lib/libz3.so")))
                  (mkdir-p (dirname dest))
                  (symlink z3-lib dest))))))))
    (native-inputs
     (list which python-wrapper))
    (synopsis "Theorem prover")