minetest.scm 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
  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-system minetest)
  19. #:use-module (guix build-system copy)
  20. #:use-module (guix build-system gnu)
  21. #:use-module (guix build-system)
  22. #:use-module (guix utils)
  23. #:export (minetest-mod-build-system))
  24. ;;
  25. ;; Build procedure for minetest mods. This is implemented as an extension
  26. ;; of ‘copy-build-system’.
  27. ;;
  28. ;; Code:
  29. ;; Lazily resolve the bindings to avoid circular dependencies.
  30. (define (default-optipng)
  31. ;; Lazily resolve the binding to avoid a circular dependency.
  32. (module-ref (resolve-interface '(gnu packages image)) 'optipng))
  33. (define (default-minetest)
  34. (module-ref (resolve-interface '(gnu packages minetest)) 'minetest))
  35. (define (default-xvfb-run)
  36. (module-ref (resolve-interface '(gnu packages xorg)) 'xvfb-run))
  37. (define %minetest-build-system-modules
  38. ;; Build-side modules imported by default.
  39. `((guix build minetest-build-system)
  40. ,@%copy-build-system-modules))
  41. (define %default-modules
  42. ;; Modules in scope in the build-side environment.
  43. '((guix build gnu-build-system)
  44. (guix build minetest-build-system)
  45. (guix build utils)))
  46. (define (standard-minetest-packages)
  47. "Return the list of (NAME PACKAGE OUTPUT) or (NAME PACKAGE) tuples of
  48. standard packages used as implicit inputs of the Minetest build system."
  49. `(("xvfb-run" ,(default-xvfb-run))
  50. ("optipng" ,(default-optipng))
  51. ("minetest" ,(default-minetest))
  52. ,@(filter (lambda (input)
  53. (member (car input)
  54. '("libc" "tar" "gzip" "bzip2" "xz" "locales")))
  55. (standard-packages))))
  56. (define* (lower-mod name #:key (implicit-inputs? #t) #:allow-other-keys
  57. #:rest arguments)
  58. (define lower (build-system-lower gnu-build-system))
  59. (apply lower
  60. name
  61. (substitute-keyword-arguments arguments
  62. ;; minetest-mod-build-system adds implicit inputs by itself,
  63. ;; so don't let gnu-build-system add its own implicit inputs
  64. ;; as well.
  65. ((#:implicit-inputs? implicit-inputs? #t)
  66. #f)
  67. ((#:implicit-cross-inputs? implicit-cross-inputs? #t)
  68. #f)
  69. ((#:imported-modules imported-modules %minetest-build-system-modules)
  70. imported-modules)
  71. ((#:modules modules %default-modules)
  72. modules)
  73. ((#:phases phases '%standard-phases)
  74. phases)
  75. ;; Ensure nothing sneaks into the closure.
  76. ((#:allowed-references allowed-references '())
  77. allowed-references)
  78. ;; Add the implicit inputs.
  79. ((#:native-inputs native-inputs '())
  80. (if implicit-inputs?
  81. (append native-inputs (standard-minetest-packages))
  82. native-inputs)))))
  83. (define minetest-mod-build-system
  84. (build-system
  85. (name 'minetest-mod)
  86. (description "The build system for minetest mods")
  87. (lower lower-mod)))
  88. ;;; minetest.scm ends here