~ruther/guix-local

04365b11c2e078a2e6fe7990737127951db1923f — Nicolas Graves a month ago 8ca9759
gnu: gemmi: Switch to pyproject.

* gnu/packages/chemistry.scm (gemmi):
[arguments]<#:imported-modules, #:modules, #:phases>: Switch to
pyproject-build-system.

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

M gnu/packages/chemistry.scm
M gnu/packages/chemistry.scm => gnu/packages/chemistry.scm +45 -44
@@ 1049,56 1049,57 @@ integrals for Gaussian type functions.")
    (build-system cmake-build-system)
    (arguments
     (list
      #:modules '((guix build cmake-build-system)
                  (guix build utils)
                  ((guix build python-build-system)
                   #:select (site-packages)))
      #:imported-modules (append %cmake-build-system-modules
                                 '((guix build python-build-system)))
                                 %pyproject-build-system-modules)
      #:modules
      '((guix build cmake-build-system)
        (guix build utils)
        ((guix build pyproject-build-system) #:select (site-packages)))
      #:configure-flags
      #~(list "-DUSE_PYTHON=ON"
              (string-append "-DPYTHON_INSTALL_DIR="
                             (site-packages %build-inputs %outputs)))
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'patch-includes
            (lambda _
              (substitute* (list "src/json.cpp"
                                 "src/sprintf.cpp"
                                 "include/gemmi/dirwalk.hpp"
                                 "include/gemmi/cif.hpp"
                                 "include/gemmi/json.hpp"
                                 "python/gemmi.cpp"
                                 "python/serial.h"
                                 "include/gemmi/atof.hpp"
                                 "include/gemmi/numb.hpp"
                                 "include/gemmi/fourier.hpp")
                (("<stb/stb_sprintf.h>") "<stb_sprintf.h>")
                (("\"third_party/tinydir.h\"") "<tinydir.h>")
                (("\"third_party/tao/pegtl.hpp\"") "<tao/pegtl.hpp>")
                (("\"\\.\\./third_party/sajson.h\"") "<sajson.h>")
                (("\"gemmi/third_party/tao/pegtl/parse_error.hpp\"")
                 "<tao/pegtl/parse_error.hpp>")
                (("\"third_party/fast_float.h\"")
                 "<fast_float/fast_float.h>")
                (("\"third_party/pocketfft_hdronly.h\"")
                 "<pocketfft_hdronly.h>")
                (("\"\\.\\./third_party/serializer.h\"")
                 "<zpp/serializer.h>"))))
          (add-after 'unpack 'change-bin-prefix
            (lambda _
              (substitute* "CMakeLists.txt"
                (("install\\(TARGETS program DESTINATION bin\\)")
                 (string-append
                  "install(TARGETS program DESTINATION "
                  #$output:bin "/bin)")))))
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?
                (with-directory-excursion "../source"
                  (setenv "PYTHONPATH" "../build/py")
                  (invoke "python3" "-m" "unittest" "discover" "-v"
                          "-s" "tests"))))))))
      (with-extensions (list (pyproject-guile-json))
        #~(modify-phases %standard-phases
            (add-after 'unpack 'patch-includes
              (lambda _
                (substitute* (list "src/json.cpp"
                                   "src/sprintf.cpp"
                                   "include/gemmi/dirwalk.hpp"
                                   "include/gemmi/cif.hpp"
                                   "include/gemmi/json.hpp"
                                   "python/gemmi.cpp"
                                   "python/serial.h"
                                   "include/gemmi/atof.hpp"
                                   "include/gemmi/numb.hpp"
                                   "include/gemmi/fourier.hpp")
                  (("<stb/stb_sprintf.h>") "<stb_sprintf.h>")
                  (("\"third_party/tinydir.h\"") "<tinydir.h>")
                  (("\"third_party/tao/pegtl.hpp\"") "<tao/pegtl.hpp>")
                  (("\"\\.\\./third_party/sajson.h\"") "<sajson.h>")
                  (("\"gemmi/third_party/tao/pegtl/parse_error.hpp\"")
                   "<tao/pegtl/parse_error.hpp>")
                  (("\"third_party/fast_float.h\"")
                   "<fast_float/fast_float.h>")
                  (("\"third_party/pocketfft_hdronly.h\"")
                   "<pocketfft_hdronly.h>")
                  (("\"\\.\\./third_party/serializer.h\"")
                   "<zpp/serializer.h>"))))
            (add-after 'unpack 'change-bin-prefix
              (lambda _
                (substitute* "CMakeLists.txt"
                  (("install\\(TARGETS program DESTINATION bin\\)")
                   (string-append
                    "install(TARGETS program DESTINATION "
                    #$output:bin "/bin)")))))
            (replace 'check
              (lambda* (#:key tests? #:allow-other-keys)
                (when tests?
                  (with-directory-excursion "../source"
                    (setenv "PYTHONPATH" "../build/py")
                    (invoke "python3" "-m" "unittest" "discover" "-v"
                            "-s" "tests")))))))))
    (inputs (list python zlib))
    (native-inputs
     (list fast-float