[PATCH] Add raylib.

  • Done
  • quality assurance status badge
Details
4 participants
  • Jelle Licht
  • Jakub K?dzio?ka
  • Ludovic Courtès
  • trymonv
Owner
unassigned
Submitted by
trymonv
Severity
normal
T
T
trymonv wrote on 15 Jul 2020 16:25
(address . guix-patches@gnu.org)
b3fbaa92526e1df45675cc52115e0714@cock.li
gnu/packages/game-development.scm | 34 +++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

Toggle diff (51 lines)
diff --git a/gnu/packages/game-development.scm
b/gnu/packages/game-development.scm
index e45980e7a0..cba9b5bd45 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -2489,3 +2489,37 @@ fully dynamic omnidirectional shadows, global
illumination, HDR lighting,
deferred shading, morphological / temporal / multisample anti-aliasing,
and
much more.")
(license license:zlib))))
+
+(define-public raylib
+ (package
+ (name "raylib")
+ (version "3.0.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/raysan5/raylib/")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+
"1chj7sril4l2dxh7flp5ndddydbbf1fhnqlydaysm4m6waxidxmr"))))
+ (build-system cmake-build-system)
+ (arguments '(#:configure-flags `("-DSHARED=OFF" "-DSTATIC=ON")
+ #:tests? #f))
+ (inputs `())
+ (native-inputs `(("alsa-lib", alsa-lib)
+ ("glu", glu)
+ ("libx11", libx11)
+ ("libxrandr", libxrandr)
+ ("libxi", libxi)
+ ("libxinerama", libxinerama)
+ ("libxcursor", libxcursor)
+ ("mesa", mesa)
+ ("pkg-config", pkg-config)))
+ (synopsis "C library for videogame programming")
+ (description "raylib is a library which defines many data
structures and
+methods useful for programming small video games or video game
prototypes in
+plain C. It tries to provide simple bindings for OpenGL in an attempt
to
+conceal technical complexities behind an easy-to-use interface.")
+ (home-page "https://www.raylib.com/")
+ (license license:zlib)))
--
2.27.0
J
J
Jakub K?dzio?ka wrote on 18 Jul 2020 14:02
(address . trymonv@cock.li)(address . guix-patches@gnu.org)
20200718120210.d23vaoormh6uev2s@gravity
On Wed, Jul 15, 2020 at 04:25:21PM +0200, trymonv@cock.li wrote:
Toggle quote (3 lines)
> gnu/packages/game-development.scm | 34 +++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)

Thanks for the patch! Note that this blob got included as the commit
message, which isn't really desirable. Instead of `git diff', I'd
recommend `git commit', followed by `git format-patch' and/or `git
send-email' (the latter is available as git:send-email - the send-email
output of the git package).

Toggle quote (6 lines)
> diff --git a/gnu/packages/game-development.scm
> b/gnu/packages/game-development.scm
> index e45980e7a0..cba9b5bd45 100644
> --- a/gnu/packages/game-development.scm
> +++ b/gnu/packages/game-development.scm

Could you add a Copyright line for yourself?

Toggle quote (17 lines)
> +(define-public raylib
> + (package
> + (name "raylib")
> + (version "3.0.0")
> + (source (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/raysan5/raylib/")
> + (commit version)))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "1chj7sril4l2dxh7flp5ndddydbbf1fhnqlydaysm4m6waxidxmr"))))
> + (build-system cmake-build-system)
> + (arguments '(#:configure-flags `("-DSHARED=OFF" "-DSTATIC=ON")
> + #:tests? #f))

If you have to disable tests, put a small explanation in a comment.
However, in this case I managed to get the test suite to pass like this:

(arguments
`(#:configure-flags `("-DSHARED=OFF" "-DSTATIC=ON")
#:phases
(modify-phases %standard-phases
;; check needs to run after install
(delete 'check)
(add-after 'install 'check (assoc-ref %standard-phases 'check))
(add-before 'check 'set-CC
(lambda _
(setenv "CC" ,(cc-for-target))
#t)))))

Toggle quote (11 lines)
> + (inputs `())
> + (native-inputs `(("alsa-lib", alsa-lib)
> + ("glu", glu)
> + ("libx11", libx11)
> + ("libxrandr", libxrandr)
> + ("libxi", libxi)
> + ("libxinerama", libxinerama)
> + ("libxcursor", libxcursor)
> + ("mesa", mesa)
> + ("pkg-config", pkg-config)))

I don't think these should be native-inputs. native-inputs are for
things that are ran during compilation, like the compiler itself or
pkg-config. The rest is clearly going to run at runtime, so they should
go in inputs. This distinction is necessary for cross-compilation. If
all your dependencies supported it, you could test it with

guix build --target=aarch64-linux-gnu

but unfortunately mesa's buildsystem refuses to cross-compile. It's
still a good idea to put the inputs in their proper categories, though.

One good heuristic is to run 'guix size raylib' and see which packages
are referenced. Speaking of which - alsa-lib doesn't show up in 'guix
size', and removing it from the inputs doesn't trigger any errors. Are
you sure it's being used? Maybe you're missing some configuration flag?

Also, the source for raylib includes its own copies of many libraries
which are already packaged separately in Guix, such as glfw or stb.
Could you configure raylib to use Guix-provided versions of these
libraries? A good way to make sure it works is to remove the bundled
sources. The preferred way of doing so is a 'snippet', you can find an
example in the rust-curl-sys-0.4 package in gnu/packages/crates-io.scm.

Regards,
Jakub K?dzio?ka
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl8S5MIACgkQ4xWnWEYT
FWRnqA/9GoYFRTlPANYAlQerleJAZgGVMad7EbRHK4Uma/YdSlI/EBLxXJbqKG8Q
q0isScFUCDap/DxUCn9HMTz5+1pT0I4HOIoDJVqzvC7J29QtLDvXI11H2bO2I97h
dj+Y2Uds4x1dYQL8HeafIHlCAgRLSssjd9d7TFIewPjBMKIzdqGaWwFOt6HS2aUZ
9gbBQHZOQR4mdJCk4n44DoqbOikCCsYQGKdQQmIi6aqMCPKgz/GgVzf3ZTamuuJQ
f9fUJ3cnDPcox/c4w1yC1Q1NlmuIMUUDrSZKmiV61Yt6gFtS30XGA2UBXGLycsXN
KVmAIgRhQhRQLqJhoN2lUmmT0OyTEbBpYBKvSzUFPKCmbCY7MIWSZFqhwAeyx14r
juLU2ANxbzdx0TYosQdmqpyONBPyVqwYEJyMnGiswgnvr4w99o0MjH477WuFxUTz
/HKzWe2OuOkt8moYWbovfI1ZnuNl9rx8ipcw+8CS37rtmFhiANu4H4bRbDeA28Sf
eMVFeINPIR3uaJENAYA+ZT2oKNR8GEGIA2M/A4YhcEZIfn0v1C4qDIuTFdQaRdk2
jvGGVw5lzWZczsYe0qwffCU6p7aTz4y6nm2E4hhAP74NAv+KYNbyfOITRGbYVetM
oikpm2+EAwJbPyHhjhyIE8OCY59C7L/n9ig1wqjG/biDjjjiV/k=
=1/5l
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 24 Sep 2020 17:45
Re: [bug#42376] [PATCH] Add raylib.
(name . Jakub K?dzio?ka)(address . kuba@kadziolka.net)
87v9g35gc4.fsf@gnu.org
Ping! :-)

Jakub K?dzio?ka <kuba@kadziolka.net> skribis:

Toggle quote (86 lines)
> On Wed, Jul 15, 2020 at 04:25:21PM +0200, trymonv@cock.li wrote:
>> gnu/packages/game-development.scm | 34 +++++++++++++++++++++++++++++++
>> 1 file changed, 34 insertions(+)
>
> Thanks for the patch! Note that this blob got included as the commit
> message, which isn't really desirable. Instead of `git diff', I'd
> recommend `git commit', followed by `git format-patch' and/or `git
> send-email' (the latter is available as git:send-email - the send-email
> output of the git package).
>
>> diff --git a/gnu/packages/game-development.scm
>> b/gnu/packages/game-development.scm
>> index e45980e7a0..cba9b5bd45 100644
>> --- a/gnu/packages/game-development.scm
>> +++ b/gnu/packages/game-development.scm
>
> Could you add a Copyright line for yourself?
>
>> +(define-public raylib
>> + (package
>> + (name "raylib")
>> + (version "3.0.0")
>> + (source (origin
>> + (method git-fetch)
>> + (uri (git-reference
>> + (url "https://github.com/raysan5/raylib/")
>> + (commit version)))
>> + (file-name (git-file-name name version))
>> + (sha256
>> + (base32
>> + "1chj7sril4l2dxh7flp5ndddydbbf1fhnqlydaysm4m6waxidxmr"))))
>> + (build-system cmake-build-system)
>> + (arguments '(#:configure-flags `("-DSHARED=OFF" "-DSTATIC=ON")
>> + #:tests? #f))
>
> If you have to disable tests, put a small explanation in a comment.
> However, in this case I managed to get the test suite to pass like this:
>
> (arguments
> `(#:configure-flags `("-DSHARED=OFF" "-DSTATIC=ON")
> #:phases
> (modify-phases %standard-phases
> ;; check needs to run after install
> (delete 'check)
> (add-after 'install 'check (assoc-ref %standard-phases 'check))
> (add-before 'check 'set-CC
> (lambda _
> (setenv "CC" ,(cc-for-target))
> #t)))))
>
>> + (inputs `())
>> + (native-inputs `(("alsa-lib", alsa-lib)
>> + ("glu", glu)
>> + ("libx11", libx11)
>> + ("libxrandr", libxrandr)
>> + ("libxi", libxi)
>> + ("libxinerama", libxinerama)
>> + ("libxcursor", libxcursor)
>> + ("mesa", mesa)
>> + ("pkg-config", pkg-config)))
>
> I don't think these should be native-inputs. native-inputs are for
> things that are ran during compilation, like the compiler itself or
> pkg-config. The rest is clearly going to run at runtime, so they should
> go in inputs. This distinction is necessary for cross-compilation. If
> all your dependencies supported it, you could test it with
>
> guix build --target=aarch64-linux-gnu
>
> but unfortunately mesa's buildsystem refuses to cross-compile. It's
> still a good idea to put the inputs in their proper categories, though.
>
> One good heuristic is to run 'guix size raylib' and see which packages
> are referenced. Speaking of which - alsa-lib doesn't show up in 'guix
> size', and removing it from the inputs doesn't trigger any errors. Are
> you sure it's being used? Maybe you're missing some configuration flag?
>
> Also, the source for raylib includes its own copies of many libraries
> which are already packaged separately in Guix, such as glfw or stb.
> Could you configure raylib to use Guix-provided versions of these
> libraries? A good way to make sure it works is to remove the bundled
> sources. The preferred way of doing so is a 'snippet', you can find an
> example in the rust-curl-sys-0.4 package in gnu/packages/crates-io.scm.
>
> Regards,
> Jakub K?dzio?ka
J
J
Jelle Licht wrote on 28 May 2023 23:54
Re: bug#42376: [PATCH] Add raylib.
(address . 42376-done@debbugs.gnu.org)
87fs7gp1f7.fsf@fsfe.org
Current master has raylib@4.5.0 packages, so closing.
Closed
?