qt-utils.scm 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2016 David Craven <david@craven.ch>
  3. ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
  4. ;;;
  5. ;;; This file is part of GNU Guix.
  6. ;;;
  7. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  8. ;;; under the terms of the GNU General Public License as published by
  9. ;;; the Free Software Foundation; either version 3 of the License, or (at
  10. ;;; your option) any later version.
  11. ;;;
  12. ;;; GNU Guix is distributed in the hope that it will be useful, but
  13. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;;; GNU General Public License for more details.
  16. ;;;
  17. ;;; You should have received a copy of the GNU General Public License
  18. ;;; 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))
  22. (define* (wrap-qt-program out program #:key (sh (which "bash")))
  23. (define (suffix env-var path)
  24. (let ((env-val (getenv env-var)))
  25. (if env-val (string-append env-val ":" path) path)))
  26. (let ((qml-path (suffix "QML2_IMPORT_PATH"
  27. (string-append out "/lib/qt5/qml")))
  28. (plugin-path (suffix "QT_PLUGIN_PATH"
  29. (string-append out "/lib/qt5/plugins")))
  30. (xdg-data-path (suffix "XDG_DATA_DIRS"
  31. (string-append out "/share")))
  32. (xdg-config-path (suffix "XDG_CONFIG_DIRS"
  33. (string-append out "/etc/xdg"))))
  34. (wrap-program (string-append out "/bin/" program)
  35. #:sh sh
  36. `("QML2_IMPORT_PATH" = (,qml-path))
  37. `("QT_PLUGIN_PATH" = (,plugin-path))
  38. `("XDG_DATA_DIRS" = (,xdg-data-path))
  39. `("XDG_CONFIG_DIRS" = (,xdg-config-path)))))