valgrind.scm 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
  4. ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
  5. ;;; Copyright © 2016, 2020 Efraim Flashner <efraim@flashner.co.il>
  6. ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  7. ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
  8. ;;;
  9. ;;; This file is part of GNU Guix.
  10. ;;;
  11. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  12. ;;; under the terms of the GNU General Public License as published by
  13. ;;; the Free Software Foundation; either version 3 of the License, or (at
  14. ;;; your option) any later version.
  15. ;;;
  16. ;;; GNU Guix is distributed in the hope that it will be useful, but
  17. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. ;;; GNU General Public License for more details.
  20. ;;;
  21. ;;; You should have received a copy of the GNU General Public License
  22. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  23. (define-module (gnu packages valgrind)
  24. #:use-module (guix packages)
  25. #:use-module (guix download)
  26. #:use-module (guix build-system gnu)
  27. #:use-module (guix licenses)
  28. #:use-module (gnu packages gdb)
  29. #:use-module (gnu packages perl)
  30. #:use-module (gnu packages))
  31. (define-public valgrind
  32. (package
  33. (name "valgrind")
  34. ;; Note: check "guix refresh -l -e '(@ (gnu packages valgrind) valgrind)'"
  35. ;; when updating this package to find which branch it should go to.
  36. (version "3.17.0")
  37. (source (origin
  38. (method url-fetch)
  39. (uri (list (string-append "https://sourceware.org/pub/valgrind"
  40. "/valgrind-" version ".tar.bz2")
  41. (string-append "ftp://sourceware.org/pub/valgrind"
  42. "/valgrind-" version ".tar.bz2")))
  43. (sha256
  44. (base32
  45. "18l5jbk301j3462gipqn9bkfx44mdmwn0pwr73r40gl1irkfqfmd"))
  46. (patches (search-patches "valgrind-enable-arm.patch"))))
  47. (build-system gnu-build-system)
  48. (outputs '("doc" ;16 MB
  49. "out"))
  50. (arguments
  51. `(,@(if (string-prefix? "powerpc" (or (%current-target-system)
  52. (%current-system)))
  53. `(#:make-flags '("CFLAGS+=-maltivec"))
  54. '())
  55. #:phases
  56. (modify-phases %standard-phases
  57. (add-after 'install 'patch-suppression-files
  58. (lambda* (#:key outputs #:allow-other-keys)
  59. ;; Don't assume the FHS.
  60. (let* ((out (assoc-ref outputs "out"))
  61. (dir (string-append out "/lib/valgrind")))
  62. (substitute* (find-files dir "\\.supp$")
  63. (("obj:/lib") "obj:*/lib")
  64. (("obj:/usr/X11R6/lib") "obj:*/lib")
  65. (("obj:/usr/lib") "obj:*/lib"))
  66. #t)))
  67. (add-after 'install 'install-doc
  68. (lambda* (#:key outputs #:allow-other-keys)
  69. (let ((orig (format #f "~a/share/doc" (assoc-ref outputs "out")))
  70. (dest (format #f "~a/share" (assoc-ref outputs "doc"))))
  71. (mkdir-p dest)
  72. (rename-file orig dest)
  73. #t))))))
  74. (native-inputs
  75. `(("perl" ,perl)))
  76. (home-page "https://www.valgrind.org/")
  77. (synopsis "Debugging and profiling tool suite")
  78. (description
  79. "Valgrind is an instrumentation framework for building dynamic analysis
  80. tools. There are Valgrind tools that can automatically detect many memory
  81. management and threading bugs, and profile your programs in detail. You can
  82. also use Valgrind to build new tools.")
  83. (license gpl2+)
  84. ;; Hide this variant so end users get the "interactive" Valgrind below.
  85. (properties '((hidden? . #t)))))
  86. (define-public valgrind/interactive
  87. (package/inherit
  88. valgrind
  89. (inputs
  90. ;; GDB is needed to provide a sane default for `--db-command'.
  91. `(("gdb" ,gdb)))
  92. (properties '())))