~ruther/guix-local

712d0c27f88ea980495d3df644da0a44c8036db0 — Liliana Marie Prikler 2 months ago a6c8312
build: renpy: Add check command.

* guix/build/renpy-build-system.scm (start-xorg-server, check): New variables.
(%standard-phases): Adjust accordingly.
* guix/build-system/renpy.scm (renpy-build): Support #:tests? and #:test-flags.
2 files changed, 20 insertions(+), 2 deletions(-)

M guix/build-system/renpy.scm
M guix/build/renpy-build-system.scm
M guix/build-system/renpy.scm => guix/build-system/renpy.scm +4 -0
@@ 81,6 81,8 @@
                      (outputs '("out"))
                      (output "out")
                      (game "game")
                      (tests? #t)
                      (test-flags ''())
                      (search-paths '())
                      (system (%current-system))
                      (guile #f)


@@ 102,6 104,8 @@
                         #:outputs #$(outputs->gexp outputs)
                         #:output #$output
                         #:game #$game
                         #:test-flags #$test-flags
                         #:tests? #$tests?
                         #:search-paths
                         '#$(sexp->gexp
                             (map search-path-specification->sexp

M guix/build/renpy-build-system.scm => guix/build/renpy-build-system.scm +16 -2
@@ 1,5 1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Liliana Marie Prikler <liliana.prikler@gmail.com>
;;; Copyright © 2021, 2025 Liliana Marie Prikler <liliana.prikler@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;


@@ 39,6 39,19 @@
          ;; badly if we do
          "quit"))

(define* (start-xorg-server #:key tests? inputs native-inputs #:allow-other-keys)
  (when tests?
    (let ((Xvfb (search-input-file (or native-inputs inputs)
                                   "/bin/Xvfb")))
      (setenv "HOME" (getcwd))
      (system (format #f "~a :1 &" Xvfb))
      (setenv "DISPLAY" ":1"))))

(define* (check #:key game tests? (test-flags '()) #:allow-other-keys)
  (if tests?
      (apply invoke "renpy" game "test" test-flags)
      (display "test suite not run\n")))

(define* (install #:key inputs outputs game (output "out") #:allow-other-keys)
  (let* ((out (assoc-ref outputs output))
         (json-dump (call-with-input-file (string-append game


@@ 87,7 100,8 @@
    (delete 'bootstrap)
    (delete 'configure)
    (replace 'build build)
    (delete 'check)
    (add-before 'check 'start-xorg-server start-xorg-server)
    (replace 'check check)
    (replace 'install install)
    (add-after 'install 'install-desktop-file install-desktop-file)))