1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 David Craven <david@craven.ch>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (guix build qt-utils)
20 #:use-module (guix build utils)
21 #:export (wrap-qt-program))
23 (define (wrap-qt-program out program)
24 (define (suffix env-var path)
25 (let ((env-val (getenv env-var)))
26 (if env-val (string-append env-val ":" path) path)))
28 (let ((qml-path (suffix "QML2_IMPORT_PATH"
29 (string-append out "/qml")))
30 (plugin-path (suffix "QT_PLUGIN_PATH"
31 (string-append out "/plugins")))
32 (xdg-data-path (suffix "XDG_DATA_DIRS"
33 (string-append out "/share")))
34 (xdg-config-path (suffix "XDG_CONFIG_DIRS"
35 (string-append out "/etc/xdg"))))
36 (wrap-program (string-append out "/bin/" program)
37 `("QML2_IMPORT_PATH" = (,qml-path))
38 `("QT_PLUGIN_PATH" = (,plugin-path))
39 `("XDG_DATA_DIRS" = (,xdg-data-path))
40 `("XDG_CONFIG_DIRS" = (,xdg-config-path)))))