summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorLiliana Marie Prikler <liliana.prikler@gmail.com>2022-06-17 08:49:05 +0200
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2022-06-17 18:49:04 +0200
commit8e19e3a3331a8251789aea5a977ec4e7b5dc5c25 (patch)
tree8e53ea0a9338804ae6ba19f08876fb918edc2a68 /gnu
parentd18f701aa12e1b881bea743d076ca89f96798f64 (diff)
gnu: Add back the distinction between python-renpy and renpy.
This partially reverts commit 9f1bd63fb5b6916f07d454ffde27cd3a66c95bb5. Note, that with this patch renpy fails to build due to incompatibilities with Python 3. * gnu/packages/game-development.scm (renpy): Split into ‘python-renpy’ for the python modules and ‘renpy’ for the games and binaries.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/game-development.scm167
1 files changed, 165 insertions, 2 deletions
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 4c1b97f0411..099268d58cf 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1257,9 +1257,9 @@ While it aims to be used as a drop-in replacement, it appears to be
1257developed mainly for Ren'py.") 1257developed mainly for Ren'py.")
1258 (license (list license:lgpl2.1 license:zlib))))) 1258 (license (list license:lgpl2.1 license:zlib)))))
1259 1259
1260(define-public renpy 1260(define-public python-renpy
1261 (package 1261 (package
1262 (name "renpy") 1262 (name "python-renpy")
1263 (version "7.4.11") 1263 (version "7.4.11")
1264 (source 1264 (source
1265 (origin 1265 (origin
@@ -1342,6 +1342,169 @@ the launcher and common Ren'py code provided by the @code{renpy} package and
1342are only used to bootstrap it.") 1342are only used to bootstrap it.")
1343 (license license:expat))) 1343 (license license:expat)))
1344 1344
1345(define-public renpy
1346 (package
1347 (inherit python-renpy)
1348 (name "renpy")
1349 (build-system python-build-system)
1350 (arguments
1351 `(#:tests? #f ; see python-renpy
1352 #:modules ((srfi srfi-1)
1353 (guix build python-build-system)
1354 (guix build utils))
1355 #:imported-modules ((srfi srfi-1) ,@%python-build-system-modules)
1356 #:phases
1357 (modify-phases %standard-phases
1358 (add-after 'unpack 'fix-commands
1359 (lambda* (#:key inputs outputs #:allow-other-keys)
1360 (substitute* "launcher/game/choose_directory.rpy"
1361 (("/usr/bin/python")
1362 (search-input-file inputs "/bin/python3")))
1363 (substitute* "launcher/game/front_page.rpy"
1364 (("xdg-open")
1365 (search-input-file inputs "/bin/xdg-open")))
1366 (substitute* "launcher/game/project.rpy"
1367 (("cmd = \\[ executable, \"-EO\", sys.argv\\[0\\] \\]")
1368 (string-append "cmd = [ \"" (assoc-ref outputs "out")
1369 "/bin/renpy\" ]"))
1370 ;; Projects are still created in the usual style, so we need
1371 ;; to adjust the path.
1372 (("cmd.append\\(self.path\\)")
1373 "cmd.append(self.path + \"/game\")"))))
1374 (add-after 'unpack 'drop-game-from-paths
1375 (lambda _
1376 (substitute* (list "launcher/game/gui7.rpy"
1377 "launcher/game/gui7/images.py")
1378 ((", \"game\",") ","))
1379 #t))
1380 (add-before 'build 'start-xserver
1381 (lambda* (#:key inputs native-inputs #:allow-other-keys)
1382 (let ((Xvfb (search-input-file (or native-inputs inputs)
1383 "/bin/Xvfb")))
1384 (setenv "HOME" (getcwd))
1385 (system (format #f "~a :1 &" Xvfb))
1386 (setenv "DISPLAY" ":1"))))
1387 (replace 'build
1388 (lambda _
1389 (invoke "python" "renpy.py" "launcher" "quit")
1390 (invoke "python" "renpy.py" "the_question" "quit")
1391 (invoke "python" "renpy.py" "tutorial" "quit")))
1392 (replace 'install
1393 (lambda* (#:key inputs outputs #:allow-other-keys)
1394 ;; Here we install our custom renpy program.
1395 ;; After finishing this step, "out" will have the following:
1396 ;; |-- bin/renpy
1397 ;; `-- share/renpy ; i.e. path_to_renpy_base()
1398 ;; |-- common
1399 ;; `-- gui
1400 ;;
1401 ;; Note that common shares the source files that would be installed
1402 ;; by python-renpy (which are instead deleted from that package),
1403 ;; but also contains their byte-compiled versions.
1404 ;; On other systems, renpy_base would point to site-packages or
1405 ;; even somewhere in /opt.
1406 ;; The former approach is not as straightforward as it seems
1407 ;; -- it causes renpy to load files twice for some weird reason --
1408 ;; and the latter is impossible on Guix. Hence the detour through
1409 ;; share/renpy and the custom renpy program.
1410 ;;
1411 ;; As a convention, other games should be installed as
1412 ;; subdirectories of share/renpy in their respective outputs as
1413 ;; well. This differs from the traditional layout, which is
1414 ;; roughly the following:
1415 ;; `-- Super Awesome Game
1416 ;; |-- game ; <- the folder we actually want
1417 ;; |-- lib ; compiled renpy module and dependencies
1418 ;; |-- renpy ; yet another copy of Ren'py's code
1419 ;; | |-- common ; the common folder from above
1420 ;; | `-- ... ; Python code (source + compiled)
1421 ;; |-- Super Awesome Game.py
1422 ;; `-- Super Awesome Game.sh
1423 (let* ((out (assoc-ref outputs "out"))
1424 (bin/renpy (string-append out "/bin/renpy")))
1425 (copy-recursively "renpy/common"
1426 (string-append out "/share/renpy/common"))
1427 (copy-recursively "gui"
1428 (string-append out "/share/renpy/gui"))
1429
1430 (mkdir-p (string-append out "/bin"))
1431 (copy-file (assoc-ref inputs "renpy.in") bin/renpy)
1432 (substitute* bin/renpy
1433 (("@PYTHON@") (search-input-file inputs "bin/python3"))
1434 (("@RENPY_BASE@") (string-append out "/share/renpy")))
1435 (chmod bin/renpy #o755))))
1436
1437 (add-after 'install 'install-games
1438 (lambda* (#:key inputs outputs #:allow-other-keys)
1439 (define renpy (assoc-ref outputs "out"))
1440 ;; TODO: We should offer a renpy-build-system to make the
1441 ;; installation of Ren'py games easier.
1442 (define* (install-renpy-game #:key output game name (renpy renpy)
1443 #:allow-other-keys)
1444 (let* ((name (or name (basename game)))
1445 (launcher (string-append output "/bin/renpy-" name))
1446 (share (string-append output "/share/renpy/" name)))
1447 (copy-recursively (string-append game "/game") share)
1448 (mkdir-p (string-append output "/bin"))
1449 (with-output-to-file launcher
1450 (lambda ()
1451 (format #t
1452 "#!~a~%~a ~a \"$@\""
1453 (search-input-file inputs "/bin/bash")
1454 (string-append renpy "/bin/renpy")
1455 share)))
1456 (chmod launcher #o755)))
1457
1458 (install-renpy-game #:output (assoc-ref outputs "out")
1459 #:game "launcher")
1460
1461 (install-renpy-game #:output (assoc-ref outputs "the-question")
1462 #:game "the_question"
1463 #:name "the-question")
1464
1465 (install-renpy-game #:output (assoc-ref outputs "tutorial")
1466 #:game "tutorial")))
1467 (replace 'wrap
1468 (lambda* (#:key inputs outputs #:allow-other-keys)
1469 (let ((out (assoc-ref outputs "out"))
1470 (site (string-append "/lib/python"
1471 (python-version
1472 (assoc-ref inputs "python"))
1473 "/site-packages")))
1474 (wrap-program (string-append out "/bin/renpy")
1475 `("GUIX_PYTHONPATH" =
1476 (,@(delete-duplicates
1477 (map
1478 (lambda (store-path)
1479 (string-append store-path site))
1480 (cons (assoc-ref outputs "out")
1481 (map cdr
1482 (filter
1483 (lambda (input)
1484 (string-prefix? "python" (car input)))
1485 inputs))))))))))))))
1486 (inputs
1487 `(("bash-minimal" ,bash-minimal)
1488 ("renpy.in" ,(search-auxiliary-file "renpy/renpy.in"))
1489 ("python-renpy" ,python-renpy)
1490 ("python:tk" ,python "tk")
1491 ("python" ,python) ; for ‘fix-commands’ and ‘wrap’
1492 ("xdg-utils" ,xdg-utils)))
1493 (propagated-inputs '())
1494 (native-inputs
1495 (list xorg-server-for-tests))
1496 (outputs
1497 (list "out" "tutorial" "the-question"))
1498 (home-page "https://www.renpy.org/")
1499 (synopsis "Visual Novel Engine")
1500 (description "Ren'Py is a visual novel engine that helps you use words,
1501images, and sounds to tell interactive stories that run on computers and
1502mobile devices. These can be both visual novels and life simulation games.
1503The easy to learn script language allows anyone to efficiently write large
1504visual novels, while its Python scripting is enough for complex simulation
1505games.")
1506 (license license:expat)))
1507
1345(define-public python-pyxel 1508(define-public python-pyxel
1346 (package 1509 (package
1347 (name "python-pyxel") 1510 (name "python-pyxel")