guix: qt-build-system: Add phase check-setup.

* guix/build/qt-build-system.scm (check-setup): New function.
  (%standard-phases): Add as new phase `check-setup before `check.
* doc/guix.texi (Build System)[qt-build-system]: Describe the new phase.
This commit is contained in:
Hartmut Goebel 2020-01-22 13:29:34 +01:00
parent 1d7051f82b
commit 8377512e0c
No known key found for this signature in database
GPG key ID: 634A8DFFD3F631DF
2 changed files with 34 additions and 5 deletions

View file

@ -47,7 +47,7 @@ Copyright @copyright{} 2017 Thomas Danckaert@*
Copyright @copyright{} 2017 humanitiesNerd@* Copyright @copyright{} 2017 humanitiesNerd@*
Copyright @copyright{} 2017 Christopher Allan Webber@* Copyright @copyright{} 2017 Christopher Allan Webber@*
Copyright @copyright{} 2017, 2018, 2019 Marius Bakke@* Copyright @copyright{} 2017, 2018, 2019 Marius Bakke@*
Copyright @copyright{} 2017, 2019 Hartmut Goebel@* Copyright @copyright{} 2017, 2019, 2020 Hartmut Goebel@*
Copyright @copyright{} 2017, 2019 Maxim Cournoyer@* Copyright @copyright{} 2017, 2019 Maxim Cournoyer@*
Copyright @copyright{} 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice@* Copyright @copyright{} 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice@*
Copyright @copyright{} 2017 George Clemmer@* Copyright @copyright{} 2017 George Clemmer@*
@ -6447,10 +6447,24 @@ Which Perl package is used can be specified with @code{#:perl}.
This variable is exported by @code{(guix build-system qt)}. It This variable is exported by @code{(guix build-system qt)}. It
is intended for use with applications using Qt or KDE. is intended for use with applications using Qt or KDE.
This build system adds the phase @code{qt-wrap} to the ones defined by This build system adds the following two phases to the ones defined by
@code{cmake-build-system}, after the @code{install} phase. @code{cmake-build-system}:
This phase searches for Qt5 plugin paths, QML paths and some XDG in the inputs @table @code
@item check-setup
The phase @code{check-setup} prepares the environment for running
the checks as commonly used by Qt test programs.
For now this only sets some environment variables:
@code{QT_QPA_PLATFORM=offscreen},
@code{DBUS_FATAL_WARNINGS=0} and
@code{CTEST_OUTPUT_ON_FAILURE=1}.
This phase is added before the @code{check} phase.
It's a separate phase to ease adjusting if necessary.
@item qt-wrap
The phase @code{qt-wrap}
searches for Qt5 plugin paths, QML paths and some XDG in the inputs
and output. In case some path is found, all programs in the output's and output. In case some path is found, all programs in the output's
@file{bin/}, @file{sbin/}, @file{libexec/} and @file{lib/libexec/} directories @file{bin/}, @file{sbin/}, @file{libexec/} and @file{lib/libexec/} directories
are wrapped in scripts defining the necessary environment variables. are wrapped in scripts defining the necessary environment variables.
@ -6460,6 +6474,9 @@ by listing their names in the @code{#:qt-wrap-excluded-outputs} parameter.
This is useful when an output is known not to contain any Qt binaries, and This is useful when an output is known not to contain any Qt binaries, and
where wrapping would gratuitously add a dependency of that output on Qt, KDE, where wrapping would gratuitously add a dependency of that output on Qt, KDE,
or such. or such.
This phase is added after the @code{install} phase.
@end table
@end defvr @end defvr
@defvr {Scheme Variable} r-build-system @defvr {Scheme Variable} r-build-system

View file

@ -2,7 +2,7 @@
;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch> ;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2018 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2019 Hartmut Goebel <h.goebel@crazy-compilers.com> ;;; Copyright © 2019, 2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -36,6 +36,17 @@
;; ;;
;; Code: ;; Code:
(define* (check-setup #:rest args)
;; Make Qt render "offscreen". In many cases this allows to run tests
;; without starting a X11 server.
(setenv "QT_QPA_PLATFORM" "offscreen")
;; Qt/KDE tests often need dbus (`dbus-launch …`) which is not fully
;; set-up the the build container.
(setenv "DBUS_FATAL_WARNINGS" "0")
;; Set here to ease overwriting 'check (even if set there, too)
(setenv "CTEST_OUTPUT_ON_FAILURE" "1")
#t)
(define (variables-for-wrapping base-directories) (define (variables-for-wrapping base-directories)
(define (collect-sub-dirs base-directories subdirectory) (define (collect-sub-dirs base-directories subdirectory)
@ -101,6 +112,7 @@ add a dependency of that output on Qt."
(define %standard-phases (define %standard-phases
(modify-phases cmake:%standard-phases (modify-phases cmake:%standard-phases
(add-before 'check 'check-setup check-setup)
(add-after 'install 'qt-wrap wrap-all-programs))) (add-after 'install 'qt-wrap wrap-all-programs)))
(define* (qt-build #:key inputs (phases %standard-phases) (define* (qt-build #:key inputs (phases %standard-phases)