From unknown Sat Aug 09 04:52:54 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#46053 <46053@debbugs.gnu.org> To: bug#46053 <46053@debbugs.gnu.org> Subject: Status: [PATCH 0/2] Add Ren'py build system Reply-To: bug#46053 <46053@debbugs.gnu.org> Date: Sat, 09 Aug 2025 11:52:54 +0000 retitle 46053 [PATCH 0/2] Add Ren'py build system reassign 46053 guix-patches submitter 46053 Leo Prikler severity 46053 normal tag 46053 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 23 08:40:37 2021 Received: (at submit) by debbugs.gnu.org; 23 Jan 2021 13:40:37 +0000 Received: from localhost ([127.0.0.1]:33849 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3J9Y-0004eq-VE for submit@debbugs.gnu.org; Sat, 23 Jan 2021 08:40:37 -0500 Received: from lists.gnu.org ([209.51.188.17]:35598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3J9X-0004ei-Eg for submit@debbugs.gnu.org; Sat, 23 Jan 2021 08:40:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3J9X-0003lY-7s for guix-patches@gnu.org; Sat, 23 Jan 2021 08:40:35 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:63990) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3J9T-0006dU-O7 for guix-patches@gnu.org; Sat, 23 Jan 2021 08:40:34 -0500 Received: from nijino.local (217-149-173-242.nat.highway.telekom.at [217.149.173.242]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4DNHLq4Zrpz1LBRx for ; Sat, 23 Jan 2021 14:40:19 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4DNHLq4Zrpz1LBRx DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1611409219; bh=3Hg8fFrkfg4CUomMixe7kHz5RDYf13grqZrS+ZmM66A=; h=Subject:From:To:Date:From; b=YXV1YkLmu9M2j9iv3whQq94kITWnVPzH3vgSblBor3dKSc0nWicMvAsMWcKe05XBP 9UNY/PLJY0YwcKSXM1dpyPuWFltSSNIN5bMb2OuTzJTJ2D5d09K4pdO8kFtYiFHBHT HMYObEqRlmjdpak95GkF1fQmUkzMBEeUrbQzAwC8= Message-ID: <6bf051d15833939d09f190d11cdbbf7954fdc3c0.camel@student.tugraz.at> Subject: [PATCH 0/2] Add Ren'py build system From: Leo Prikler To: guix-patches@gnu.org Date: Sat, 23 Jan 2021 14:40:18 +0100 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 Received-SPF: pass client-ip=129.27.2.202; envelope-from=leo.prikler@student.tugraz.at; helo=mailrelay.tugraz.at X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Hi Guix, a proper Ren'py build system had been on my TODO list ever since I've packaged it back in 2019, but I've so far been too lazy to actually create one. While I'm happy to announce, that this is no longer the case, there are still a number of things, that can be improved in our Ren'py package and build system. This series contains two patches. The first adds the build system, the second a package example for "The Question". Since "The Question" is already an output of Ren'py, I don't see much value in this patch other than for explanatory purposes, so I don't think I'll commit that one. Instead, I'll probably redefine Ren'py once the first patch is merged. I'm building this series on top of #45736, so things might be a bit different on master, but I hope it works out regardless. Regards, Leo From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 23 08:47:22 2021 Received: (at 46053) by debbugs.gnu.org; 23 Jan 2021 13:47:22 +0000 Received: from localhost ([127.0.0.1]:33866 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3JG6-0004rr-3d for submit@debbugs.gnu.org; Sat, 23 Jan 2021 08:47:22 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:59362) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3JG4-0004rh-5l for 46053@debbugs.gnu.org; Sat, 23 Jan 2021 08:47:21 -0500 Received: from localhost.localdomain (217-149-173-242.nat.highway.telekom.at [217.149.173.242]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4DNHVs15XYz1LLyL for <46053@debbugs.gnu.org>; Sat, 23 Jan 2021 14:47:17 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4DNHVs15XYz1LLyL DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1611409637; bh=21l/Y+W3njFfgPgyDyhdLXNUNWc5/W+BED+J8B8k9+I=; h=From:To:Subject:Date:From; b=OC8Pu2Ox0gjtaRdLmgVcD6Emt+mjXd56E0zlr0k5QdkwWnZTrMS4GDHySgUl7jCMf RtBza3LbKTtXTn6jjLl6ngRab7H8UrpLJHaEw1G+YvH2WSaqfNz/OtmJ4XU3cfF3fb 3UuQBHzZs++TBpXw4InC5e1D9kaHycc5cFfEk+oo= From: Leo Prikler To: 46053@debbugs.gnu.org Subject: [PATCH 1/2] build-system: Add renpy-build-system. Date: Sat, 23 Jan 2021 14:46:55 +0100 Message-Id: <20210123134656.18353-1-leo.prikler@student.tugraz.at> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 46053 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/build/renpy-build-system.scm: New file. * guix/build-system/renpy.scm: New file. * Makefile.am (MODULES): Add them here. --- Makefile.am | 2 + guix/build-system/renpy.scm | 131 ++++++++++++++++++++++++++++++ guix/build/renpy-build-system.scm | 99 ++++++++++++++++++++++ 3 files changed, 232 insertions(+) create mode 100644 guix/build-system/renpy.scm create mode 100644 guix/build/renpy-build-system.scm diff --git a/Makefile.am b/Makefile.am index 8a8133d669..c2d71ca5be 100644 --- a/Makefile.am +++ b/Makefile.am @@ -150,6 +150,7 @@ MODULES = \ guix/build-system/node.scm \ guix/build-system/perl.scm \ guix/build-system/python.scm \ + guix/build-system/renpy.scm \ guix/build-system/ocaml.scm \ guix/build-system/qt.scm \ guix/build-system/waf.scm \ @@ -205,6 +206,7 @@ MODULES = \ guix/build/ocaml-build-system.scm \ guix/build/qt-build-system.scm \ guix/build/r-build-system.scm \ + guix/build/renpy-build-system.scm \ guix/build/rakudo-build-system.scm \ guix/build/ruby-build-system.scm \ guix/build/scons-build-system.scm \ diff --git a/guix/build-system/renpy.scm b/guix/build-system/renpy.scm new file mode 100644 index 0000000000..35edc0056d --- /dev/null +++ b/guix/build-system/renpy.scm @@ -0,0 +1,131 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2021 Leo Prikler +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix build-system renpy) + #:use-module (guix store) + #:use-module (guix utils) + #:use-module (guix memoization) + #:use-module (guix packages) + #:use-module (guix derivations) + #:use-module (guix search-paths) + #:use-module (guix build-system) + #:use-module (guix build-system gnu) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:export (%renpy-build-system-modules + default-renpy + renpy-build + renpy-build-system)) + +(define (default-renpy) + "Return the default Ren'py package." + ;; Lazily resolve the binding to avoid a circular dependency. + (let ((module (resolve-interface '(gnu packages game-development)))) + (module-ref module 'renpy))) + +(define %renpy-build-system-modules + ;; Build-side modules imported by default. + `((guix build renpy-build-system) + (guix build json) + (guix build python-build-system) + ,@%gnu-build-system-modules)) + +(define* (lower name + #:key source inputs native-inputs outputs system target + (renpy (default-renpy)) + #:allow-other-keys + #:rest arguments) + "Return a bag for NAME." + (define private-keywords + '(#:source #:target #:renpy #:inputs #:native-inputs)) + + (and (not target) ;XXX: no cross-compilation + (bag + (name name) + (system system) + (host-inputs `(,@(if source + `(("source" ,source)) + '()) + ,@inputs + + ;; Keep the standard inputs of 'gnu-build-system'. + ,@(standard-packages))) + (build-inputs `(("renpy" ,renpy) + ,@native-inputs)) + (outputs outputs) + (build renpy-build) + (arguments (strip-keyword-arguments private-keywords arguments))))) + +(define* (renpy-build store name inputs + #:key + (phases '(@ (guix build renpy-build-system) + %standard-phases)) + (configure-flags ''()) + (outputs '("out")) + (output "out") + (game "game") + (search-paths '()) + (system (%current-system)) + (guile #f) + (imported-modules %renpy-build-system-modules) + (modules '((guix build renpy-build-system) + (guix build utils)))) + "Build SOURCE using RENPY, and with INPUTS." + (define builder + `(begin + (use-modules ,@modules) + (renpy-build #:name ,name + #:source ,(match (assoc-ref inputs "source") + (((? derivation? source)) + (derivation->output-path source)) + ((source) + source) + (source + source)) + #:configure-flags ,configure-flags + #:system ,system + #:phases ,phases + #:outputs %outputs + #:output ,output + #:game ,game + #:search-paths ',(map search-path-specification->sexp + search-paths) + #:inputs %build-inputs))) + + (define guile-for-build + (match guile + ((? package?) + (package-derivation store guile system #:graft? #f)) + (#f ; the default + (let* ((distro (resolve-interface '(gnu packages commencement))) + (guile (module-ref distro 'guile-final))) + (package-derivation store guile system #:graft? #f))))) + + (build-expression->derivation store name builder + #:inputs inputs + #:system system + #:modules imported-modules + #:outputs outputs + #:guile-for-build guile-for-build)) + +(define renpy-build-system + (build-system + (name 'renpy) + (description "The Ren'py build system") + (lower lower))) diff --git a/guix/build/renpy-build-system.scm b/guix/build/renpy-build-system.scm new file mode 100644 index 0000000000..464fc97b13 --- /dev/null +++ b/guix/build/renpy-build-system.scm @@ -0,0 +1,99 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2021 Leo Prikler +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix build renpy-build-system) + #:use-module ((guix build gnu-build-system) #:prefix gnu:) + #:use-module ((guix build python-build-system) #:prefix python:) + #:use-module (guix build json) + #:use-module (guix build utils) + #:use-module (ice-9 match) + #:use-module (ice-9 ftw) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:export (%standard-phases + renpy-build)) + +(define* (build #:key game #:allow-other-keys) + (for-each make-file-writable + (find-files game (lambda (pred stat) + (eq? (stat:type stat) 'directory)))) + (invoke "renpy" + "--json-dump" (string-append game "/renpy-build.json") + game + ;; should be "compile", but renpy wants to compile itself really + ;; badly if we do + "quit") + #t) + +(define* (install #:key outputs game (output "out") #:allow-other-keys) + (let* ((out (assoc-ref outputs output)) + (json-dump (call-with-input-file (string-append game + "/renpy-build.json") + read-json)) + (build (assoc-ref json-dump "build")) + (executable-name (assoc-ref build "executable_name")) + (directory-name (assoc-ref build "directory_name"))) + (let ((launcher (string-append out "/bin/" executable-name)) + (data (string-append out "/share/renpy/" directory-name))) + (mkdir-p (string-append out "/bin")) + (copy-recursively game data) + ;; We don't actually want the metadata to be dumped in the output + ;; directory + (delete-file (string-append data "/renpy-build.json")) + (call-with-output-file launcher + (lambda (port) + (format port "#!~a~%~a ~a \"$@\"" + (which "bash") + (which "renpy") + data))) + (chmod launcher #o755))) + #t) + +(define* (install-desktop-file #:key outputs game (output "out") + #:allow-other-keys) + (let* ((out (assoc-ref outputs output)) + (json-dump (call-with-input-file (string-append game + "/renpy-build.json") + read-json)) + (build (assoc-ref json-dump "build")) + (directory-name (assoc-ref build "directory_name")) + (executable-name (assoc-ref build "executable_name"))) + (make-desktop-entry-file + (string-append out "/share/applications/" executable-name ".desktop") + #:name (assoc-ref json-dump "name") + #:generic-name (assoc-ref build "display_name") + #:exec (string-append (which "renpy") " " + out "/share/renpy/" directory-name) + #:categories '("Game" "Visual Novel"))) + #t) + +(define %standard-phases + (modify-phases gnu:%standard-phases + (add-after 'unpack 'enable-bytecode-determinism + (assoc-ref python:%standard-phases 'enable-bytecode-determinism)) + (delete 'bootstrap) + (delete 'configure) + (replace 'build build) + (delete 'check) + (replace 'install install) + (add-after 'install 'install-desktop-file install-desktop-file))) + +(define* (renpy-build #:key inputs (phases %standard-phases) + #:allow-other-keys #:rest args) + "Build the given Ren'py package, applying all of PHASES in order." + (apply gnu:gnu-build #:inputs inputs #:phases phases args)) -- 2.30.0 From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 23 08:47:25 2021 Received: (at 46053) by debbugs.gnu.org; 23 Jan 2021 13:47:25 +0000 Received: from localhost ([127.0.0.1]:33868 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3JG8-0004s6-Pv for submit@debbugs.gnu.org; Sat, 23 Jan 2021 08:47:24 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:52451) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3JG5-0004rp-TY for 46053@debbugs.gnu.org; Sat, 23 Jan 2021 08:47:22 -0500 Received: from localhost.localdomain (217-149-173-242.nat.highway.telekom.at [217.149.173.242]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4DNHVv41Ntz1LLyX for <46053@debbugs.gnu.org>; Sat, 23 Jan 2021 14:47:19 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4DNHVv41Ntz1LLyX DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1611409639; bh=JOnq1y3EcRblMNWz+MHh4GsC3BQDacS3mMGph56ye/c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WycsloEKKdFqtSb+wRXuDnhHCKiT8+zS5GA/1NsVA3+9owCGTr+dazN6t3I3fQRtO PggLBMnRmXX19T4rQOGJriPSufAB1l21FNMAn5C3R3Hkje9nt/VfBIm1lkRG6YlXpM NFGVBiWqt0GqiF1pR98BcY0t+o7mHPMAigbkdejw= From: Leo Prikler To: 46053@debbugs.gnu.org Subject: [PATCH 2/2] gnu: Add the-question. Date: Sat, 23 Jan 2021 14:46:56 +0100 Message-Id: <20210123134656.18353-2-leo.prikler@student.tugraz.at> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210123134656.18353-1-leo.prikler@student.tugraz.at> References: <20210123134656.18353-1-leo.prikler@student.tugraz.at> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 46053 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/packages/games.scm (the-question): New variable. --- gnu/packages/games.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm index ee1571e624..8b3a617d0a 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -196,6 +196,7 @@ #:use-module (guix build-system meson) #:use-module (guix build-system perl) #:use-module (guix build-system python) + #:use-module (guix build-system renpy) #:use-module (guix build-system qt) #:use-module (guix build-system scons) #:use-module (guix build-system trivial) @@ -12136,3 +12137,17 @@ game FPS.") implemented using ncurses user interface. An SDL graphical version is also available.") (license license:gpl3+))) + +(define-public the-question + (package + (name "the-question") + (version (package-version renpy)) + (source (package-source renpy)) + (build-system renpy-build-system) + (arguments + '(#:game "the_question/game")) + (synopsis "Ren'py example game") + (description "The Question is a short game demonstrating the capabilities +of Ren'py.") + (home-page (package-home-page renpy)) + (license (package-license renpy)))) -- 2.30.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 24 03:49:48 2021 Received: (at 46053) by debbugs.gnu.org; 24 Jan 2021 08:49:48 +0000 Received: from localhost ([127.0.0.1]:35813 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3b5g-0005iP-JG for submit@debbugs.gnu.org; Sun, 24 Jan 2021 03:49:48 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:52165) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3b5d-0005iA-Bm for 46053@debbugs.gnu.org; Sun, 24 Jan 2021 03:49:46 -0500 Received: from localhost (40-67.ipv4.commingeshautdebit.fr [185.131.40.67]) (Authenticated sender: admin@nicolasgoaziou.fr) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 35970240003; Sun, 24 Jan 2021 08:49:37 +0000 (UTC) From: Nicolas Goaziou To: Leo Prikler Subject: Re: [bug#46053] [PATCH 0/2] Add Ren'py build system References: <6bf051d15833939d09f190d11cdbbf7954fdc3c0.camel@student.tugraz.at> Date: Sun, 24 Jan 2021 09:49:36 +0100 In-Reply-To: <6bf051d15833939d09f190d11cdbbf7954fdc3c0.camel@student.tugraz.at> (Leo Prikler's message of "Sat, 23 Jan 2021 14:40:18 +0100") Message-ID: <87czxuen33.fsf@nicolasgoaziou.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 46053 Cc: 46053@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, Leo Prikler writes: > a proper Ren'py build system had been on my TODO list ever since I've > packaged it back in 2019, but I've so far been too lazy to actually > create one. While I'm happy to announce, that this is no longer the > case, there are still a number of things, that can be improved in our > Ren'py package and build system. That's nice. It should also be documented in the manual. It would be nice to have a "write a build system" in the cookbook (or the manual?) at some point. > This series contains two patches. The first adds the build system, the > second a package example for "The Question". Since "The Question" is > already an output of Ren'py, I don't see much value in this patch other > than for explanatory purposes, so I don't think I'll commit that one. > Instead, I'll probably redefine Ren'py once the first patch is merged. > I'm building this series on top of #45736, so things might be a bit > different on master, but I hope it works out regardless. LGTM, in addition to #45736. Regards, -- Nicolas Goaziou From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 24 05:52:08 2021 Received: (at 46053) by debbugs.gnu.org; 24 Jan 2021 10:52:09 +0000 Received: from localhost ([127.0.0.1]:35843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3d04-00005l-A9 for submit@debbugs.gnu.org; Sun, 24 Jan 2021 05:52:08 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:55054) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3d02-00005b-4n for 46053@debbugs.gnu.org; Sun, 24 Jan 2021 05:52:07 -0500 Received: from localhost.localdomain (217-149-173-242.nat.highway.telekom.at [217.149.173.242]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4DNqZ95mGQz1LBCm; Sun, 24 Jan 2021 11:52:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4DNqZ95mGQz1LBCm DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1611485522; bh=tANXfrfnp/shQTroYlPUw/QPhfb6ib8QwRom5vrvDRo=; h=From:To:Cc:Subject:Date:From; b=On2EOZEbMOcKOwcMHqhfYcU/Nl7BO+tRTDZ0UfWPfMUfuS1i2UjSi/O4IZ7W+AFUx /dYR+66dll6MuYqgOGKnX7TysxADYbnbTKY7U253wDpj8fAZlY2W/HYEJzYSOCV4AE +ElcbFpaMMY5dymsti8tIdR7mdbh7VZTpmuHBU3g= From: Leo Prikler To: 46053@debbugs.gnu.org Subject: [PATCH v2] build-system: Add renpy-build-system. Date: Sun, 24 Jan 2021 11:51:23 +0100 Message-Id: <20210124105122.9409-1-leo.prikler@student.tugraz.at> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 46053 Cc: mail@nicolasgoaziou.fr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/build/renpy-build-system.scm: New file. * guix/build-system/renpy.scm: New file. * Makefile.am (MODULES): Add them here. * doc/guix.texi (Build Systems): Document renpy-build-system. --- Makefile.am | 2 + doc/guix.texi | 13 +++ guix/build-system/renpy.scm | 131 ++++++++++++++++++++++++++++++ guix/build/renpy-build-system.scm | 99 ++++++++++++++++++++++ 4 files changed, 245 insertions(+) create mode 100644 guix/build-system/renpy.scm create mode 100644 guix/build/renpy-build-system.scm diff --git a/Makefile.am b/Makefile.am index 8a8133d669..c2d71ca5be 100644 --- a/Makefile.am +++ b/Makefile.am @@ -150,6 +150,7 @@ MODULES = \ guix/build-system/node.scm \ guix/build-system/perl.scm \ guix/build-system/python.scm \ + guix/build-system/renpy.scm \ guix/build-system/ocaml.scm \ guix/build-system/qt.scm \ guix/build-system/waf.scm \ @@ -205,6 +206,7 @@ MODULES = \ guix/build/ocaml-build-system.scm \ guix/build/qt-build-system.scm \ guix/build/r-build-system.scm \ + guix/build/renpy-build-system.scm \ guix/build/rakudo-build-system.scm \ guix/build/ruby-build-system.scm \ guix/build/scons-build-system.scm \ diff --git a/doc/guix.texi b/doc/guix.texi index 4a20b3b902..f44bf29963 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -7779,6 +7779,19 @@ passes flags specified by the @code{#:make-maker-flags} or Which Perl package is used can be specified with @code{#:perl}. @end defvr +@defvr {Scheme Variable} renpy-build-system +This variable is exported by @code{(guix build-system renpy)}. It implements +the more or less standard build procedure used by Ren'py games, which consists +of loading @code{#:game} once, thereby creating bytecode for it. + +It further creates a wrapper script in @code{bin/} and a desktop entry in +@code{share/applications}, both of which can be used to launch the game. + +Which Ren'py package is used can be specified with @code{#:renpy}. +Games can also be installed in outputs other than ``out'' by using +@code{#:output}. +@end defvr + @defvr {Scheme Variable} qt-build-system This variable is exported by @code{(guix build-system qt)}. It is intended for use with applications using Qt or KDE. diff --git a/guix/build-system/renpy.scm b/guix/build-system/renpy.scm new file mode 100644 index 0000000000..35edc0056d --- /dev/null +++ b/guix/build-system/renpy.scm @@ -0,0 +1,131 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2021 Leo Prikler +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix build-system renpy) + #:use-module (guix store) + #:use-module (guix utils) + #:use-module (guix memoization) + #:use-module (guix packages) + #:use-module (guix derivations) + #:use-module (guix search-paths) + #:use-module (guix build-system) + #:use-module (guix build-system gnu) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:export (%renpy-build-system-modules + default-renpy + renpy-build + renpy-build-system)) + +(define (default-renpy) + "Return the default Ren'py package." + ;; Lazily resolve the binding to avoid a circular dependency. + (let ((module (resolve-interface '(gnu packages game-development)))) + (module-ref module 'renpy))) + +(define %renpy-build-system-modules + ;; Build-side modules imported by default. + `((guix build renpy-build-system) + (guix build json) + (guix build python-build-system) + ,@%gnu-build-system-modules)) + +(define* (lower name + #:key source inputs native-inputs outputs system target + (renpy (default-renpy)) + #:allow-other-keys + #:rest arguments) + "Return a bag for NAME." + (define private-keywords + '(#:source #:target #:renpy #:inputs #:native-inputs)) + + (and (not target) ;XXX: no cross-compilation + (bag + (name name) + (system system) + (host-inputs `(,@(if source + `(("source" ,source)) + '()) + ,@inputs + + ;; Keep the standard inputs of 'gnu-build-system'. + ,@(standard-packages))) + (build-inputs `(("renpy" ,renpy) + ,@native-inputs)) + (outputs outputs) + (build renpy-build) + (arguments (strip-keyword-arguments private-keywords arguments))))) + +(define* (renpy-build store name inputs + #:key + (phases '(@ (guix build renpy-build-system) + %standard-phases)) + (configure-flags ''()) + (outputs '("out")) + (output "out") + (game "game") + (search-paths '()) + (system (%current-system)) + (guile #f) + (imported-modules %renpy-build-system-modules) + (modules '((guix build renpy-build-system) + (guix build utils)))) + "Build SOURCE using RENPY, and with INPUTS." + (define builder + `(begin + (use-modules ,@modules) + (renpy-build #:name ,name + #:source ,(match (assoc-ref inputs "source") + (((? derivation? source)) + (derivation->output-path source)) + ((source) + source) + (source + source)) + #:configure-flags ,configure-flags + #:system ,system + #:phases ,phases + #:outputs %outputs + #:output ,output + #:game ,game + #:search-paths ',(map search-path-specification->sexp + search-paths) + #:inputs %build-inputs))) + + (define guile-for-build + (match guile + ((? package?) + (package-derivation store guile system #:graft? #f)) + (#f ; the default + (let* ((distro (resolve-interface '(gnu packages commencement))) + (guile (module-ref distro 'guile-final))) + (package-derivation store guile system #:graft? #f))))) + + (build-expression->derivation store name builder + #:inputs inputs + #:system system + #:modules imported-modules + #:outputs outputs + #:guile-for-build guile-for-build)) + +(define renpy-build-system + (build-system + (name 'renpy) + (description "The Ren'py build system") + (lower lower))) diff --git a/guix/build/renpy-build-system.scm b/guix/build/renpy-build-system.scm new file mode 100644 index 0000000000..464fc97b13 --- /dev/null +++ b/guix/build/renpy-build-system.scm @@ -0,0 +1,99 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2021 Leo Prikler +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix build renpy-build-system) + #:use-module ((guix build gnu-build-system) #:prefix gnu:) + #:use-module ((guix build python-build-system) #:prefix python:) + #:use-module (guix build json) + #:use-module (guix build utils) + #:use-module (ice-9 match) + #:use-module (ice-9 ftw) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:export (%standard-phases + renpy-build)) + +(define* (build #:key game #:allow-other-keys) + (for-each make-file-writable + (find-files game (lambda (pred stat) + (eq? (stat:type stat) 'directory)))) + (invoke "renpy" + "--json-dump" (string-append game "/renpy-build.json") + game + ;; should be "compile", but renpy wants to compile itself really + ;; badly if we do + "quit") + #t) + +(define* (install #:key outputs game (output "out") #:allow-other-keys) + (let* ((out (assoc-ref outputs output)) + (json-dump (call-with-input-file (string-append game + "/renpy-build.json") + read-json)) + (build (assoc-ref json-dump "build")) + (executable-name (assoc-ref build "executable_name")) + (directory-name (assoc-ref build "directory_name"))) + (let ((launcher (string-append out "/bin/" executable-name)) + (data (string-append out "/share/renpy/" directory-name))) + (mkdir-p (string-append out "/bin")) + (copy-recursively game data) + ;; We don't actually want the metadata to be dumped in the output + ;; directory + (delete-file (string-append data "/renpy-build.json")) + (call-with-output-file launcher + (lambda (port) + (format port "#!~a~%~a ~a \"$@\"" + (which "bash") + (which "renpy") + data))) + (chmod launcher #o755))) + #t) + +(define* (install-desktop-file #:key outputs game (output "out") + #:allow-other-keys) + (let* ((out (assoc-ref outputs output)) + (json-dump (call-with-input-file (string-append game + "/renpy-build.json") + read-json)) + (build (assoc-ref json-dump "build")) + (directory-name (assoc-ref build "directory_name")) + (executable-name (assoc-ref build "executable_name"))) + (make-desktop-entry-file + (string-append out "/share/applications/" executable-name ".desktop") + #:name (assoc-ref json-dump "name") + #:generic-name (assoc-ref build "display_name") + #:exec (string-append (which "renpy") " " + out "/share/renpy/" directory-name) + #:categories '("Game" "Visual Novel"))) + #t) + +(define %standard-phases + (modify-phases gnu:%standard-phases + (add-after 'unpack 'enable-bytecode-determinism + (assoc-ref python:%standard-phases 'enable-bytecode-determinism)) + (delete 'bootstrap) + (delete 'configure) + (replace 'build build) + (delete 'check) + (replace 'install install) + (add-after 'install 'install-desktop-file install-desktop-file))) + +(define* (renpy-build #:key inputs (phases %standard-phases) + #:allow-other-keys #:rest args) + "Build the given Ren'py package, applying all of PHASES in order." + (apply gnu:gnu-build #:inputs inputs #:phases phases args)) -- 2.30.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 07 09:29:20 2021 Received: (at 46053-done) by debbugs.gnu.org; 7 Feb 2021 14:29:20 +0000 Received: from localhost ([127.0.0.1]:47218 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l8l3v-0008At-85 for submit@debbugs.gnu.org; Sun, 07 Feb 2021 09:29:20 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:47346) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l8l3q-0008Aa-T4; Sun, 07 Feb 2021 09:29:16 -0500 Received: from nijino.local (217-149-173-242.nat.highway.telekom.at [217.149.173.242]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4DYWkG1kjXz1LBMx; Sun, 7 Feb 2021 15:29:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4DYWkG1kjXz1LBMx DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1612708150; bh=8CdYFj7IiZtgFH+nWu4A3cs/iOxskF3gpHa5qij70eg=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=iZ7UOMSS6o4sfLXJS7GqRluWR1Uq0226KqSDbMTpq10utjCfcLeQiPJGNJFcY3sWW jUEmHlN682hDgrBrdDNwT2+SybgI+HhxMSRtpfR4PWW+PD/WdVMELcwwLQyq73710L hd5uFvlmQxgYp4OpPGuzgSS6gk1DTCPEfd0gifhY= Message-ID: <2e82cd8cb0882ac3fde3b52b9ae897bb27ed32ba.camel@student.tugraz.at> Subject: Re: [bug#46053] [PATCH 0/2] Add Ren'py build system From: Leo Prikler To: Nicolas Goaziou Date: Sun, 07 Feb 2021 15:29:09 +0100 In-Reply-To: <87czxuen33.fsf@nicolasgoaziou.fr> References: <6bf051d15833939d09f190d11cdbbf7954fdc3c0.camel@student.tugraz.at> <87czxuen33.fsf@nicolasgoaziou.fr> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 46053-done Cc: 46053-done@debbugs.gnu.org, 45736-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello, Am Sonntag, den 24.01.2021, 09:49 +0100 schrieb Nicolas Goaziou: > LGTM, in addition to #45736. I've now pushed both this (well, v2 of it) and #45736. > It should also be documented in the manual. Documentation is present in v2, which I've pushed. I hope it's sufficient. Regards, Leo. From unknown Sat Aug 09 04:52:54 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 08 Mar 2021 12:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator