qt-utils.scm 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2016 David Craven <david@craven.ch>
  3. ;;;
  4. ;;; This file is part of GNU Guix.
  5. ;;;
  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.
  10. ;;;
  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.
  15. ;;;
  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/>.
  18. (define-module (guix build qt-utils)
  19. #:use-module (guix build utils)
  20. #:export (wrap-qt-program))
  21. (define (wrap-qt-program out program)
  22. (define (suffix env-var path)
  23. (let ((env-val (getenv env-var)))
  24. (if env-val (string-append env-val ":" path) path)))
  25. (let ((qml-path (suffix "QML2_IMPORT_PATH"
  26. (string-append out "/lib/qt5/qml")))
  27. (plugin-path (suffix "QT_PLUGIN_PATH"
  28. (string-append out "/lib/qt5/plugins")))
  29. (xdg-data-path (suffix "XDG_DATA_DIRS"
  30. (string-append out "/share")))
  31. (xdg-config-path (suffix "XDG_CONFIG_DIRS"
  32. (string-append out "/etc/xdg"))))
  33. (wrap-program (string-append out "/bin/" program)
  34. `("QML2_IMPORT_PATH" = (,qml-path))
  35. `("QT_PLUGIN_PATH" = (,plugin-path))
  36. `("XDG_DATA_DIRS" = (,xdg-data-path))
  37. `("XDG_CONFIG_DIRS" = (,xdg-config-path)))))