qt-build-system.scm 2.3 KB

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