summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorPaul Garlick <pgarlick@tourbillion-technology.com>2021-07-09 23:01:43 +0100
committerPaul Garlick <pgarlick@tourbillion-technology.com>2021-07-12 16:19:46 +0100
commitb9fd7f9d5b8aa78a40a57e2ac85535f77a82de3d (patch)
tree9796dc57a3fafa1afe5e2a61edb09edef4f13da4 /gnu
parent62b60ba08249cbe239f3abe033a15fac83c4b54a (diff)
downloadguix-b9fd7f9d5b8aa78a40a57e2ac85535f77a82de3d.tar.gz
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.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/maths.scm32
1 files 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 <ludo@gnu.org>
 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2016, 2017 Thomas Danckaert <post@thomasdanckaert.be>
-;;; Copyright © 2017, 2018, 2019, 2020 Paul Garlick <pgarlick@tourbillion-technology.com>
+;;; Copyright © 2017, 2018, 2019, 2020, 2021 Paul Garlick <pgarlick@tourbillion-technology.com>
 ;;; Copyright © 2017 Nikita <nikita@n0.is>
 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
 ;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
@@ -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