summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorLiliana Marie Prikler <liliana.prikler@gmail.com>2022-06-17 16:01:32 +0200
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2022-06-17 18:49:06 +0200
commitf7d66e41f8720c7db9b30926dec35e2cc3524d56 (patch)
tree84ab3f67f281b8fec362454b7c5829d0d754ef32 /gnu
parent6c04a8961fe15a6c856a2fb08ac39dab90d08be0 (diff)
gnu: renpy: Use new style.
* gnu/packages/game-development.scm (renpy)[arguments]: Change to list of G-Expressions. [inputs]: Drop labels. [native-inputs, outputs]: Squash to single line.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/game-development.scm293
1 files changed, 146 insertions, 147 deletions
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 4377654f8f4..04f2b061fcf 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -48,6 +48,7 @@
48 #:use-module (ice-9 match) 48 #:use-module (ice-9 match)
49 #:use-module ((guix licenses) #:prefix license:) 49 #:use-module ((guix licenses) #:prefix license:)
50 #:use-module (guix packages) 50 #:use-module (guix packages)
51 #:use-module (guix gexp)
51 #:use-module (guix download) 52 #:use-module (guix download)
52 #:use-module (guix git-download) 53 #:use-module (guix git-download)
53 #:use-module (guix svn-download) 54 #:use-module (guix svn-download)
@@ -1352,156 +1353,154 @@ are only used to bootstrap it.")
1352 (name "renpy") 1353 (name "renpy")
1353 (build-system python-build-system) 1354 (build-system python-build-system)
1354 (arguments 1355 (arguments
1355 `(#:tests? #f ; see python-renpy 1356 (list
1356 #:modules ((srfi srfi-1) 1357 #:tests? #f ; see python-renpy
1358 #:modules '((srfi srfi-1)
1357 (guix build python-build-system) 1359 (guix build python-build-system)
1358 (guix build utils)) 1360 (guix build utils))
1359 #:imported-modules ((srfi srfi-1) ,@%python-build-system-modules) 1361 #:imported-modules `((srfi srfi-1) ,@%python-build-system-modules)
1360 #:phases 1362 #:phases
1361 (modify-phases %standard-phases 1363 #~(modify-phases %standard-phases
1362 (add-after 'unpack 'fix-commands 1364 (add-after 'unpack 'fix-commands
1363 (lambda* (#:key inputs outputs #:allow-other-keys) 1365 (lambda* (#:key inputs outputs #:allow-other-keys)
1364 (substitute* "launcher/game/choose_directory.rpy" 1366 (substitute* "launcher/game/choose_directory.rpy"
1365 (("/usr/bin/python") 1367 (("/usr/bin/python")
1366 (search-input-file inputs "/bin/python3"))) 1368 (search-input-file inputs "/bin/python3")))
1367 (substitute* "launcher/game/front_page.rpy" 1369 (substitute* "launcher/game/front_page.rpy"
1368 (("xdg-open") 1370 (("xdg-open")
1369 (search-input-file inputs "/bin/xdg-open"))) 1371 (search-input-file inputs "/bin/xdg-open")))
1370 (substitute* "launcher/game/project.rpy" 1372 (substitute* "launcher/game/project.rpy"
1371 (("cmd = \\[ executable, \"-EO\", sys.argv\\[0\\] \\]") 1373 (("cmd = \\[ executable, \"-EO\", sys.argv\\[0\\] \\]")
1372 (string-append "cmd = [ \"" (assoc-ref outputs "out") 1374 (string-append "cmd = [ \"" (assoc-ref outputs "out")
1373 "/bin/renpy\" ]")) 1375 "/bin/renpy\" ]"))
1374 ;; Projects are still created in the usual style, so we need 1376 ;; Projects are still created in the usual style, so we need
1375 ;; to adjust the path. 1377 ;; to adjust the path.
1376 (("cmd.append\\(self.path\\)") 1378 (("cmd.append\\(self.path\\)")
1377 "cmd.append(self.path + \"/game\")")))) 1379 "cmd.append(self.path + \"/game\")"))))
1378 (add-after 'unpack 'drop-game-from-paths 1380 (add-after 'unpack 'drop-game-from-paths
1379 (lambda _ 1381 (lambda _
1380 (substitute* (list "launcher/game/gui7.rpy" 1382 (substitute* (list "launcher/game/gui7.rpy"
1381 "launcher/game/gui7/images.py") 1383 "launcher/game/gui7/images.py")
1382 ((", \"game\",") ",")) 1384 ((", \"game\",") ","))
1383 #t)) 1385 #t))
1384 (add-before 'build 'start-xserver 1386 (add-before 'build 'start-xserver
1385 (lambda* (#:key inputs native-inputs #:allow-other-keys) 1387 (lambda* (#:key inputs native-inputs #:allow-other-keys)
1386 (let ((Xvfb (search-input-file (or native-inputs inputs) 1388 (let ((Xvfb (search-input-file (or native-inputs inputs)
1387 "/bin/Xvfb"))) 1389 "/bin/Xvfb")))
1388 (setenv "HOME" (getcwd)) 1390 (setenv "HOME" (getcwd))
1389 (system (format #f "~a :1 &" Xvfb)) 1391 (system (format #f "~a :1 &" Xvfb))
1390 (setenv "DISPLAY" ":1")))) 1392 (setenv "DISPLAY" ":1"))))
1391 (replace 'build 1393 (replace 'build
1392 (lambda _ 1394 (lambda _
1393 (invoke "python" "renpy.py" "launcher" "quit") 1395 (invoke "python" "renpy.py" "launcher" "quit")
1394 (invoke "python" "renpy.py" "the_question" "quit") 1396 (invoke "python" "renpy.py" "the_question" "quit")
1395 (invoke "python" "renpy.py" "tutorial" "quit"))) 1397 (invoke "python" "renpy.py" "tutorial" "quit")))
1396 (replace 'install 1398 (replace 'install
1397 (lambda* (#:key inputs outputs #:allow-other-keys) 1399 (lambda* (#:key inputs outputs #:allow-other-keys)
1398 ;; Here we install our custom renpy program. 1400 ;; Here we install our custom renpy program.
1399 ;; After finishing this step, "out" will have the following: 1401 ;; After finishing this step, "out" will have the following:
1400 ;; |-- bin/renpy 1402 ;; |-- bin/renpy
1401 ;; `-- share/renpy ; i.e. path_to_renpy_base() 1403 ;; `-- share/renpy ; i.e. path_to_renpy_base()
1402 ;; |-- common 1404 ;; |-- common
1403 ;; `-- gui 1405 ;; `-- gui
1404 ;; 1406 ;;
1405 ;; Note that common shares the source files that would be installed 1407 ;; Note that common shares the source files that would be installed
1406 ;; by python-renpy (which are instead deleted from that package), 1408 ;; by python2-renpy (which are instead deleted from that package),
1407 ;; but also contains their byte-compiled versions. 1409 ;; but also contains their byte-compiled versions.
1408 ;; On other systems, renpy_base would point to site-packages or 1410 ;; On other systems, renpy_base would point to site-packages or
1409 ;; even somewhere in /opt. 1411 ;; even somewhere in /opt.
1410 ;; The former approach is not as straightforward as it seems 1412 ;; The former approach is not as straightforward as it seems
1411 ;; -- it causes renpy to load files twice for some weird reason -- 1413 ;; -- it causes renpy to load files twice for some weird reason --
1412 ;; and the latter is impossible on Guix. Hence the detour through 1414 ;; and the latter is impossible on Guix. Hence the detour through
1413 ;; share/renpy and the custom renpy program. 1415 ;; share/renpy and the custom renpy program.
1414 ;; 1416 ;;
1415 ;; As a convention, other games should be installed as 1417 ;; As a convention, other games should be installed as
1416 ;; subdirectories of share/renpy in their respective outputs as 1418 ;; subdirectories of share/renpy in their respective outputs as
1417 ;; well. This differs from the traditional layout, which is 1419 ;; well. This differs from the traditional layout, which is
1418 ;; roughly the following: 1420 ;; roughly the following:
1419 ;; `-- Super Awesome Game 1421 ;; `-- Super Awesome Game
1420 ;; |-- game ; <- the folder we actually want 1422 ;; |-- game ; <- the folder we actually want
1421 ;; |-- lib ; compiled renpy module and dependencies 1423 ;; |-- lib ; compiled renpy module and dependencies
1422 ;; |-- renpy ; yet another copy of Ren'py's code 1424 ;; |-- renpy ; yet another copy of Ren'py's code
1423 ;; | |-- common ; the common folder from above 1425 ;; | |-- common ; the common folder from above
1424 ;; | `-- ... ; Python code (source + compiled) 1426 ;; | `-- ... ; Python code (source + compiled)
1425 ;; |-- Super Awesome Game.py 1427 ;; |-- Super Awesome Game.py
1426 ;; `-- Super Awesome Game.sh 1428 ;; `-- Super Awesome Game.sh
1427 (let* ((out (assoc-ref outputs "out")) 1429 (let* ((out (assoc-ref outputs "out"))
1428 (bin/renpy (string-append out "/bin/renpy"))) 1430 (bin/renpy (string-append out "/bin/renpy")))
1429 (copy-recursively "renpy/common" 1431 (copy-recursively "renpy/common"
1430 (string-append out "/share/renpy/common")) 1432 (string-append out "/share/renpy/common"))
1431 (copy-recursively "gui" 1433 (copy-recursively "gui"
1432 (string-append out "/share/renpy/gui")) 1434 (string-append out "/share/renpy/gui"))
1433 1435
1434 (mkdir-p (string-append out "/bin")) 1436 (mkdir-p (string-append out "/bin"))
1435 (copy-file (assoc-ref inputs "renpy.in") bin/renpy) 1437 (copy-file #$(local-file (search-auxiliary-file "renpy/renpy.in"))
1436 (substitute* bin/renpy 1438 bin/renpy)
1437 (("@PYTHON@") (search-input-file inputs "bin/python3")) 1439 (substitute* bin/renpy
1438 (("@RENPY_BASE@") (string-append out "/share/renpy"))) 1440 (("@PYTHON@") (search-input-file inputs "bin/python3"))
1439 (chmod bin/renpy #o755)))) 1441 (("@RENPY_BASE@") (string-append out "/share/renpy")))
1440 1442 (chmod bin/renpy #o755))))
1441 (add-after 'install 'install-games 1443
1442 (lambda* (#:key inputs outputs #:allow-other-keys) 1444 (add-after 'install 'install-games
1443 (define renpy (assoc-ref outputs "out")) 1445 (lambda* (#:key inputs outputs #:allow-other-keys)
1444 ;; TODO: We should offer a renpy-build-system to make the 1446 (define renpy (assoc-ref outputs "out"))
1445 ;; installation of Ren'py games easier. 1447 ;; TODO: We should offer a renpy-build-system to make the
1446 (define* (install-renpy-game #:key output game name (renpy renpy) 1448 ;; installation of Ren'py games easier.
1447 #:allow-other-keys) 1449 (define* (install-renpy-game #:key output game name (renpy renpy)
1448 (let* ((name (or name (basename game))) 1450 #:allow-other-keys)
1449 (launcher (string-append output "/bin/renpy-" name)) 1451 (let* ((name (or name (basename game)))
1450 (share (string-append output "/share/renpy/" name))) 1452 (launcher (string-append output "/bin/renpy-" name))
1451 (copy-recursively (string-append game "/game") share) 1453 (share (string-append output "/share/renpy/" name)))
1452 (mkdir-p (string-append output "/bin")) 1454 (copy-recursively (string-append game "/game") share)
1453 (with-output-to-file launcher 1455 (mkdir-p (string-append output "/bin"))
1454 (lambda () 1456 (with-output-to-file launcher
1455 (format #t 1457 (lambda ()
1456 "#!~a~%~a ~a \"$@\"" 1458 (format #t
1457 (search-input-file inputs "/bin/bash") 1459 "#!~a~%~a ~a \"$@\""
1458 (string-append renpy "/bin/renpy") 1460 (search-input-file inputs "/bin/bash")
1459 share))) 1461 (string-append renpy "/bin/renpy")
1460 (chmod launcher #o755))) 1462 share)))
1461 1463 (chmod launcher #o755)))
1462 (install-renpy-game #:output (assoc-ref outputs "out") 1464
1463 #:game "launcher") 1465 (install-renpy-game #:output (assoc-ref outputs "out")
1464 1466 #:game "launcher")
1465 (install-renpy-game #:output (assoc-ref outputs "the-question") 1467
1466 #:game "the_question" 1468 (install-renpy-game #:output (assoc-ref outputs "the-question")
1467 #:name "the-question") 1469 #:game "the_question"
1468 1470 #:name "the-question")
1469 (install-renpy-game #:output (assoc-ref outputs "tutorial") 1471
1470 #:game "tutorial"))) 1472 (install-renpy-game #:output (assoc-ref outputs "tutorial")
1471 (replace 'wrap 1473 #:game "tutorial")))
1472 (lambda* (#:key inputs outputs #:allow-other-keys) 1474 (replace 'wrap
1473 (let ((out (assoc-ref outputs "out")) 1475 (lambda* (#:key inputs outputs #:allow-other-keys)
1474 (site (string-append "/lib/python" 1476 (let ((out (assoc-ref outputs "out"))
1475 (python-version 1477 (site (string-append "/lib/python"
1476 (assoc-ref inputs "python")) 1478 (python-version
1477 "/site-packages"))) 1479 (assoc-ref inputs "python"))
1478 (wrap-program (string-append out "/bin/renpy") 1480 "/site-packages")))
1479 `("GUIX_PYTHONPATH" = 1481 (wrap-program (string-append out "/bin/renpy")
1480 (,@(delete-duplicates 1482 `("GUIX_PYTHONPATH" =
1481 (map 1483 (,@(delete-duplicates
1482 (lambda (store-path) 1484 (map
1483 (string-append store-path site)) 1485 (lambda (store-path)
1484 (cons (assoc-ref outputs "out") 1486 (string-append store-path site))
1485 (map cdr 1487 (cons (assoc-ref outputs "out")
1486 (filter 1488 (map cdr
1487 (lambda (input) 1489 (filter
1488 (string-prefix? "python" (car input))) 1490 (lambda (input)
1489 inputs)))))))))))))) 1491 (string-prefix? "python" (car input)))
1490 (inputs 1492 inputs))))))))))))))
1491 `(("bash-minimal" ,bash-minimal) 1493 (inputs (list bash-minimal
1492 ("renpy.in" ,(search-auxiliary-file "renpy/renpy.in")) 1494 python
1493 ("python-pefile" ,python-pefile) 1495 python-pefile
1494 ("python-requests" ,python-requests) 1496 python-requests
1495 ("python-renpy" ,python-renpy) 1497 python-renpy
1496 ("python:tk" ,python "tk") 1498 python-six
1497 ("python-six" ,python-six) 1499 `(,python "tk")
1498 ("python" ,python) ; for ‘fix-commands’ and ‘wrap’ 1500 xdg-utils))
1499 ("xdg-utils" ,xdg-utils)))
1500 (propagated-inputs '()) 1501 (propagated-inputs '())
1501 (native-inputs 1502 (native-inputs (list xorg-server-for-tests))
1502 (list xorg-server-for-tests)) 1503 (outputs (list "out" "tutorial" "the-question"))
1503 (outputs
1504 (list "out" "tutorial" "the-question"))
1505 (home-page "https://www.renpy.org/") 1504 (home-page "https://www.renpy.org/")
1506 (synopsis "Visual Novel Engine") 1505 (synopsis "Visual Novel Engine")
1507 (description "Ren'Py is a visual novel engine that helps you use words, 1506 (description "Ren'Py is a visual novel engine that helps you use words,