qt-build-system.scm 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
  3. ;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
  4. ;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
  5. ;;; Copyright © 2019, 2020, 2021 Hartmut Goebel <h.goebel@crazy-compilers.com>
  6. ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
  7. ;;;
  8. ;;; This file is part of GNU Guix.
  9. ;;;
  10. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  11. ;;; under the terms of the GNU General Public License as published by
  12. ;;; the Free Software Foundation; either version 3 of the License, or (at
  13. ;;; your option) any later version.
  14. ;;;
  15. ;;; GNU Guix is distributed in the hope that it will be useful, but
  16. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. ;;; GNU General Public License for more details.
  19. ;;;
  20. ;;; You should have received a copy of the GNU General Public License
  21. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  22. (define-module (guix build qt-build-system)
  23. #:use-module ((guix build cmake-build-system) #:prefix cmake:)
  24. #:use-module (guix build utils)
  25. #:use-module (guix build qt-utils)
  26. #:use-module (ice-9 match)
  27. #:use-module (ice-9 regex)
  28. #:use-module (ice-9 ftw)
  29. #:use-module (srfi srfi-1)
  30. #:use-module (srfi srfi-26)
  31. #:export (%standard-phases
  32. qt-build))
  33. ;; Commentary:
  34. ;;
  35. ;; Builder-side code of the standard Qt build procedure.
  36. ;;
  37. ;; Code:
  38. (define* (check-setup #:rest args)
  39. ;; Make Qt render "offscreen". In many cases this allows to run tests
  40. ;; without starting a X11 server.
  41. (setenv "QT_QPA_PLATFORM" "offscreen")
  42. ;; Qt/KDE tests often need dbus (`dbus-launch …`) which is not fully
  43. ;; set-up the the build container.
  44. (setenv "DBUS_FATAL_WARNINGS" "0")
  45. ;; Set here to ease overwriting 'check (even if set there, too)
  46. (setenv "CTEST_OUTPUT_ON_FAILURE" "1")
  47. #t)
  48. (define %standard-phases
  49. (modify-phases cmake:%standard-phases
  50. (add-before 'check 'check-setup check-setup)
  51. (add-after 'install 'qt-wrap wrap-all-qt-programs)))
  52. (define* (qt-build #:key inputs (phases %standard-phases)
  53. #:allow-other-keys #:rest args)
  54. "Build the given package, applying all of PHASES in order."
  55. (apply cmake:cmake-build #:inputs inputs #:phases phases args))