guix: qt-build-system, qt-utils: Unify wrapping of qt-programs.
[jackhill/guix/guix.git] / guix / build / qt-build-system.scm
CommitLineData
b6d852ce
HG
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
1879b05f 3;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
b6d852ce 4;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
7e24e1e5 5;;; Copyright © 2019, 2020, 2021 Hartmut Goebel <h.goebel@crazy-compilers.com>
b6d852ce
HG
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
22(define-module (guix build qt-build-system)
23 #:use-module ((guix build cmake-build-system) #:prefix cmake:)
24 #:use-module (guix build utils)
7e24e1e5 25 #:use-module (guix build qt-utils)
b6d852ce
HG
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
34;; Commentary:
35;;
36;; Builder-side code of the standard Qt build procedure.
37;;
38;; Code:
39
8377512e
HG
40(define* (check-setup #:rest args)
41 ;; Make Qt render "offscreen". In many cases this allows to run tests
42 ;; without starting a X11 server.
43 (setenv "QT_QPA_PLATFORM" "offscreen")
44 ;; Qt/KDE tests often need dbus (`dbus-launch …`) which is not fully
45 ;; set-up the the build container.
46 (setenv "DBUS_FATAL_WARNINGS" "0")
47 ;; Set here to ease overwriting 'check (even if set there, too)
48 (setenv "CTEST_OUTPUT_ON_FAILURE" "1")
49 #t)
50
b6d852ce
HG
51(define %standard-phases
52 (modify-phases cmake:%standard-phases
8377512e 53 (add-before 'check 'check-setup check-setup)
7e24e1e5 54 (add-after 'install 'qt-wrap wrap-all-qt-programs)))
b6d852ce
HG
55
56(define* (qt-build #:key inputs (phases %standard-phases)
57 #:allow-other-keys #:rest args)
58 "Build the given package, applying all of PHASES in order."
59 (apply cmake:cmake-build #:inputs inputs #:phases phases args))