From patchwork Mon Oct 28 11:20:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: arnaud.lechevallier@free.fr X-Patchwork-Id: 69592 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id F1A6A27BBE9; Mon, 28 Oct 2024 12:22:21 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED,URIBL_SBL_A autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 9DE6E27BBE2 for ; Mon, 28 Oct 2024 12:22:19 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5Oko-0001vy-Os; Mon, 28 Oct 2024 08:21:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5NoM-0003SQ-Ee for guix-patches@gnu.org; Mon, 28 Oct 2024 07:21:26 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t5NoM-0004rw-5a for guix-patches@gnu.org; Mon, 28 Oct 2024 07:21:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:In-Reply-To:From:Date:To:Subject; bh=aqNXozwvCmJf7sdtcgiWqd8htwZjWUInF5fhkFLfCTA=; b=slRiE7yohz5AqHx2JJY6fuw8TQHqOKWUIpB0mamRYlFqQ97wZ7JwKLlxbC+mH8iMaiYOHPZotd1RyyBx7eTd8vJFg9Wg70v4qkl18cZesBOrWiMw3kHWD8wX+KrTMxbQgtQmjZKlx28z//tWMt1E5RSPLu/mjbjXLsInjn4HfKmeMOolvOVHBRZBF46D6WioA3uzUvONRHAkCftsxYW4xm84tyOVSRK1NZKnqoZjfUs1M27+oaK2UskgPqO6pvK8agINmHiynP4pTmT7JjB8cNO+EgIsGyjq3l3kP+FsBJzRDNUWfNkTCqUEN5gp7eoR3wDMfTBscuOsjvKJlngldg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t5Now-0002iU-3T for guix-patches@gnu.org; Mon, 28 Oct 2024 07:22:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#74059] [PATCH v1] gnu: Add guile-raylib Resent-From: arnaud.lechevallier@free.fr Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 28 Oct 2024 11:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74059 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74059@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.173011447410361 (code B ref -1); Mon, 28 Oct 2024 11:22:01 +0000 Received: (at submit) by debbugs.gnu.org; 28 Oct 2024 11:21:14 +0000 Received: from localhost ([127.0.0.1]:52744 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5No9-0002h2-67 for submit@debbugs.gnu.org; Mon, 28 Oct 2024 07:21:14 -0400 Received: from lists.gnu.org ([209.51.188.17]:58406) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5No2-0002gd-TZ for submit@debbugs.gnu.org; Mon, 28 Oct 2024 07:21:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5NnS-0003Jt-CA for guix-patches@gnu.org; Mon, 28 Oct 2024 07:20:30 -0400 Received: from smtp3-g21.free.fr ([212.27.42.3]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5NnL-0004oQ-4r for guix-patches@gnu.org; Mon, 28 Oct 2024 07:20:30 -0400 Received: from zimbra81-e14.priv.proxad.net (unknown [172.20.243.232]) by smtp3-g21.free.fr (Postfix) with ESMTP id D490613F8A9 for ; Mon, 28 Oct 2024 12:20:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr; s=smtp-20201208; t=1730114415; bh=ns3wnuKjIa1iOU0s3X7o3D9lFMtTPdWjItX6y0vGhDI=; h=Date:From:To:In-Reply-To:Subject:From; b=V+JS7nVRfI3UFGxwHwU6siukmtpqnwG2YK06beEcKh6PPfRSXyZuPXO5VoU+M8Bsx 2PG2EuatXThL+qHl7p2y9GAo9aJsCTXeyZm4IeuzIu8oCV1MHIUSDOXKPTR/ATBGIb LCjf4UK7u1/82nW/1CysrlmgZ9bTU8svKv/6WNCcWeQpSCl3e1xqhg6e/DKAQKYVjv yWHwk+Mdbx7SLLUq8lZnlHg5HnWeHL8/MvuW9Sf8naXBHqJkQ1LF15hXwYbnoVRxWF huS9FkI74BxUIEM/af6/z4AWpwjVFCFaZLEkb0dXP20QsSG84RLKWdIDuzPqf9R9DD p2w5WaXaQ90rw== Date: Mon, 28 Oct 2024 12:20:13 +0100 (CET) From: arnaud.lechevallier@free.fr Message-ID: <1441736188.416406447.1730114413414.JavaMail.root@zimbra81-e14.priv.proxad.net> In-Reply-To: <875056174.416243746.1730112288989.JavaMail.root@zimbra81-e14.priv.proxad.net> MIME-Version: 1.0 X-Originating-IP: [90.70.61.205] X-Mailer: Zimbra 7.2.0-GA2598 (ZimbraWebClient - GC127 (Linux)/7.2.0-GA2598) X-Authenticated-User: arnaud.lechevallier@free.fr Received-SPF: pass client-ip=212.27.42.3; envelope-from=arnaud.lechevallier@free.fr; helo=smtp3-g21.free.fr X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_SBL_A=0.1 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Mon, 28 Oct 2024 08:21:48 -0400 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Hello, This my first attempt to make a more complex definition package for Guix. I've targeted to build a package for a Guile bindings to the Raylib library. Briefly, I built a variant of Raylib named raylib-with-extras (more recent than the current release from Guix). It contains some extra files (API definition) to build the Guile bindings. Those files are not delivered in the current package definition for Raylib. Maybe we can avoid a new variant and merge it inplace ? For the guile-raylib itself, I've added an additional output `examples` to provide code samples. I greatly appreciate a review for this definition package. Best regards, Arnaud. From 514507d84e6d426c183e2a4809ba0a3ad252e93f Mon Sep 17 00:00:00 2001 Message-ID: <514507d84e6d426c183e2a4809ba0a3ad252e93f.1730111243.git.arnaud.lechevallier@free.fr> From: Arnaud Lechevallier Date: Mon, 28 Oct 2024 11:08:02 +0100 Subject: [PATCH v1] gnu: Add guile-raylib * gnu/packages/game-development.scm: (raylib-with-extras) new variable. * gnu/packages/guile-xyz.scm: (guile-raylib) new variable. Change-Id: I7d4b961186249da17a114ce7f1ac2fd93ac7fa08 --- gnu/packages/game-development.scm | 51 +++++++++++++++ gnu/packages/guile-xyz.scm | 102 ++++++++++++++++++++++++++++++ 2 files changed, 153 insertions(+) diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm index 0bae7cfe11..2c9c6a1548 100644 --- a/gnu/packages/game-development.scm +++ b/gnu/packages/game-development.scm @@ -30,6 +30,7 @@ ;;; Copyright © 2022 dan ;;; Copyright © 2023, 2024 John Kehayias ;;; Copyright © 2024 Nicolas Graves +;;; Copyright © 2024 Arnaud Lechevallier ;;; ;;; This file is part of GNU Guix. ;;; @@ -3311,6 +3312,56 @@ (define-public raylib (home-page "https://www.raylib.com/") (license license:zlib))) +(define-public raylib-with-extras + (let ((commit "282d6478baa51a509bf0a4b1d761a0bd7fd8bbf7") + (revision "0")) + (package + (inherit raylib) + (name "raylib") + (version (git-version "5.0" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/raysan5/raylib/") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "03ml6vhn6lsrcl9d5xg310hkkayxdccz660qs2zwfn9dwcsw2rl8")))) + (arguments + (list + #:tests? #f ;no test + #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON" + "-DUSE_EXTERNAL_GLFW=ON" + "-DCMAKE_C_FLAGS=-lpulse") + #:phases #~(modify-phases %standard-phases + (add-before 'configure 'configure-miniaudio + ;; Use PulseAudio as raudio backend. + (lambda _ + (substitute* "src/raudio.c" + (("^#include \"external/miniaudio\\.h\"") + " + #define MA_NO_RUNTIME_LINKING + #define MA_ENABLE_ONLY_SPECIFIC_BACKENDS + #define MA_ENABLE_PULSEAUDIO + #include \"external/miniaudio.h\" + ")))) + (add-before 'install 'install-parser + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((out (string-append (assoc-ref outputs "out") + "/parser/output")) + (src (string-append (assoc-ref inputs "source") + "/parser/output"))) + (mkdir-p out) + (copy-recursively src out))))))) + (inputs (list glfw-3.4 pulseaudio)) + (propagated-inputs (list glfw-3.4)) + (description + "raylib is a high-level library for video game programming. It aims to + abstract away platform and graphics details, allowing you to focus on + writing your game. This package also provides the API in a variety of file +formats to create bindings for many programming languages.")))) + (define-public bbcsdl (package (name "bbcsdl") diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm index 27a30e6622..1743c64e4e 100644 --- a/gnu/packages/guile-xyz.scm +++ b/gnu/packages/guile-xyz.scm @@ -51,6 +51,7 @@ ;;; Copyright © 2024 Artyom Bologov ;;; Copyright © 2024 Felix Lechner ;;; Copyright © 2024 Alec Barreto +;;; Copyright © 2024 Arnaud Lechevallier ;;; ;;; This file is part of GNU Guix. ;;; @@ -84,7 +85,9 @@ (define-module (gnu packages guile-xyz) #:use-module (gnu packages disk) #:use-module (gnu packages emacs) #:use-module (gnu packages emacs-xyz) + #:use-module (gnu packages freedesktop) #:use-module (gnu packages gawk) + #:use-module (gnu packages game-development) #:use-module (gnu packages gettext) #:use-module (gnu packages gl) #:use-module (gnu packages glib) @@ -3549,6 +3552,105 @@ (define-public guile-hoot (home-page "https://spritely.institute/hoot") (license (list license:asl2.0 license:lgpl3+)))) +(define-public guile-raylib + (let ((commit "e6b2ac8a21ac83c426ece993daa90ac04a90d0c2") + (revision "0")) + (package + (name "guile-raylib") + (version (git-version "0.0" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/petelliott/raylib-guile") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "114v2rcwqyczqw80hzm6ij8iqfr93x43kj8qkq8gk7w49wcq8c5c")))) + (build-system gnu-build-system) + (native-inputs (list pkg-config glfw-3.4 wayland)) + (inputs (list guile-3.0 guile-lib)) + (propagated-inputs (list raylib-with-extras)) + (outputs '("out" "examples")) + (arguments + `(#:make-flags '("GUILE_AUTO_COMPILE=0") + #:tests? #f + #:modules ((guix build gnu-build-system) + (guix build utils) + (srfi srfi-1)) + #:imported-modules ((guix build guile-build-system) + ,@%default-gnu-imported-modules) + #:phases (modify-phases %standard-phases + (delete 'configure) + (delete 'strip) ;remove useless warning with go files. + (delete 'install) + (add-before 'build 'retrieve-raylib-api + (lambda* (#:key inputs #:allow-other-keys) + (let ((raylib-version (last (string-split (assoc-ref + inputs + "raylib") + #\-))) + (raylib-xml (string-append (assoc-ref inputs + "raylib") + "/parser/output/raylib_api.xml"))) + (copy-file raylib-xml "raylib_api.xml") #t))) + + (add-after 'unpack 'fix-makefile + (lambda _ + (use-modules (guix build guile-build-system)) + (substitute* "Makefile" + (("--cflags guile-3.0") + (format #f "--cflags guile-~a raylib" + (target-guile-effective-version)))) + (substitute* "Makefile" + (("-lraylib") + "`pkg-config --libs raylib`")) + (substitute* "Makefile" + (("install: all") + "do-not-install:")))) + + (add-after 'fix-makefile 'fix-guile-extensions + (lambda* (#:key inputs outputs #:allow-other-keys) + (use-modules (guix build guile-build-system)) + (substitute* (find-files "." ".*\\.scm") + (("libraylib-guile") + (format #f + "~a/lib/guile/~a/extensions/libraylib-guile" + (assoc-ref outputs "out") + (target-guile-effective-version)))) #t)) + + (add-after 'build 'compile-and-install-guile-raylib + (lambda* (#:key inputs outputs #:allow-other-keys) + (use-modules (guix build guile-build-system)) + (let* ((out (assoc-ref outputs "out")) + (examples (assoc-ref outputs "examples")) + (scm "raylib.scm") + (go "raylib.go") + (lib "libraylib-guile.so") + (effective-version (target-guile-effective-version)) + (lib-out (string-append out "/lib/guile/" + effective-version)) + (share-out (string-append out + "/share/guile/site/" + effective-version))) + ;; get rid off auto-compilation warning + (setenv "GUILE_AUTO_COMPILE" "0") + (invoke "guild" "compile" scm "-o" go) + (install-file scm + (string-append share-out)) + (install-file go + (string-append lib-out "/site-ccache")) + (install-file lib + (string-append lib-out "/extensions")) + (copy-recursively "examples" examples) + #t)))))) + + (home-page "https://github.com/petelliott/raylib-guile") + (synopsis "Guile bindings for raylib library") + (description + "This package provides GNU Guile bindings to the Raylib game development library.") + (license license:zlib)))) + (define-public guile-file-names (package (name "guile-file-names") base-commit: e243b7546d4935e12271eb14e2471a28d7608a3d -- 2.46.0