From b9fd7f9d5b8aa78a40a57e2ac85535f77a82de3d Mon Sep 17 00:00:00 2001 From: Paul Garlick Date: Fri, 9 Jul 2021 23:01:43 +0100 Subject: gnu: gmsh: Install Python API in standard directory. * gnu/packages/maths.scm (gmsh)[imported-modules]: New argument. [modules]: New argument. [phases]: New argument. [inputs]: Add python. --- gnu/packages/maths.scm | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index b8e9a31be7..03c6b95f39 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -15,7 +15,7 @@ ;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2016 Leo Famulari ;;; Copyright © 2016, 2017 Thomas Danckaert -;;; Copyright © 2017, 2018, 2019, 2020 Paul Garlick +;;; Copyright © 2017, 2018, 2019, 2020, 2021 Paul Garlick ;;; Copyright © 2017 Nikita ;;; Copyright © 2017 Ben Woodcroft ;;; Copyright © 2017 Theodoros Foradis @@ -2291,11 +2291,37 @@ This is the certified version of the Open Cascade Technology (OCCT) library.") ("libxext" ,libxext))) (inputs `(("fontconfig" ,fontconfig) - ("libxft" ,libxft))) + ("libxft" ,libxft) + ("python" ,python))) (arguments `(#:configure-flags `("-DENABLE_SYSTEM_CONTRIB:BOOL=ON" "-DENABLE_BUILD_SHARED:BOOL=ON" - "-DENABLE_BUILD_DYNAMIC:BOOL=ON"))) + "-DENABLE_BUILD_DYNAMIC:BOOL=ON") + #:imported-modules (,@%cmake-build-system-modules + (guix build python-build-system)) + #:modules (((guix build python-build-system) #:select (site-packages)) + (guix build cmake-build-system) + (guix build utils)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch-paths + (lambda* (#:key inputs outputs #:allow-other-keys) + ;; Use the standard Guix site-package path for + ;; installation of the Python API. + (substitute* "CMakeLists.txt" + (("include\\(GNUInstallDirs\\)\n") + (string-append "include(GNUInstallDirs)\n" + " set(GMSH_PY_LIB " + (site-packages inputs outputs) ")\n")) + (("\\$\\{GMSH\\_PY\\} DESTINATION \\$\\{GMSH\\_LIB\\}") + "${GMSH_PY} DESTINATION ${GMSH_PY_LIB}")) + ;; Find the shared library. + (let ((libgmsh (string-append (assoc-ref outputs "out") + "/lib/libgmsh.so"))) + (substitute* "api/gmsh.py" + (("find_library\\(\"gmsh\"\\)") + (simple-format #f "\"~a\"" libgmsh)))) + #t))))) (home-page "http://gmsh.info/") (synopsis "3D finite element grid generator") (description "Gmsh is a 3D finite element grid generator with a built-in -- cgit v1.2.3