diff mbox series

[bug#49090] gnu: Add blastem.

Message ID 20210618145926.6952-1-leo.prikler@student.tugraz.at
State Accepted
Headers show
Series [bug#49090] gnu: Add blastem. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Leo Prikler June 18, 2021, 2:59 p.m. UTC
* gnu/packages/emulators.scm (blastem): New variable.
---
 gnu/packages/emulators.scm | 67 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

Comments

Xinglu Chen June 18, 2021, 6:39 p.m. UTC | #1
On Fri, Jun 18 2021, Leo Prikler wrote:

> +(define-public blastem
> +  (package
> +    (name "blastem")
> +    (version "0.6.2")
> +    (source (origin
> +              (method hg-fetch)
> +              (uri (hg-reference
> +                    (url "https://www.retrodev.com/repos/blastem")
> +                    (changeset (string-append "v" version))))
> +              (file-name (string-append name "-" version "-checkout"))

Nit: (guix hg-download) provides a ‘hg-file-name’ procedure, so you can
just use (hg-file-name name version).

> +              (sha256
> +               (base32
> +                "08ycfisivh9rb9vmijlrpdryaw8spd81ck48960p15cnf8h2535q"))
> +              (modules '((guix build utils)))
> +              (snippet
> +               '(begin
> +                  ;; TODO: Separately package and unbundle nuklear
> +                  (delete-file-recursively "zlib")))))

Why is the zlib directory removed?  Or perhaps, why do they bundle their
own Zlib?
Leo Prikler June 18, 2021, 7:15 p.m. UTC | #2
Am Freitag, den 18.06.2021, 20:39 +0200 schrieb Xinglu Chen:
> On Fri, Jun 18 2021, Leo Prikler wrote:
> 
> > +(define-public blastem
> > +  (package
> > +    (name "blastem")
> > +    (version "0.6.2")
> > +    (source (origin
> > +              (method hg-fetch)
> > +              (uri (hg-reference
> > +                    (url "https://www.retrodev.com/repos/blastem")
> > +                    (changeset (string-append "v" version))))
> > +              (file-name (string-append name "-" version "-
> > checkout"))
> 
> Nit: (guix hg-download) provides a ‘hg-file-name’ procedure, so you
> can just use (hg-file-name name version).
Good to know, I simply used the hg-reference... expansion from
etc/snippets, so that should probably be updated.
> 
> > +              (sha256
> > +               (base32
> > +                "08ycfisivh9rb9vmijlrpdryaw8spd81ck48960p15cnf8h25
> > 35q"))
> > +              (modules '((guix build utils)))
> > +              (snippet
> > +               '(begin
> > +                  ;; TODO: Separately package and unbundle nuklear
> > +                  (delete-file-recursively "zlib")))))
> 
> Why is the zlib directory removed?  Or perhaps, why do they bundle
> their own Zlib?
The have their own PNG implementation, which appears different from
libpng.  So zlib exists as a dependency of that, but it's also
#included elsewhere.
Xinglu Chen June 19, 2021, 8:30 a.m. UTC | #3
On Fri, Jun 18 2021, Leo Prikler wrote:

> Am Freitag, den 18.06.2021, 20:39 +0200 schrieb Xinglu Chen:
>> On Fri, Jun 18 2021, Leo Prikler wrote:
>> 
>> > +(define-public blastem
>> > +  (package
>> > +    (name "blastem")
>> > +    (version "0.6.2")
>> > +    (source (origin
>> > +              (method hg-fetch)
>> > +              (uri (hg-reference
>> > +                    (url "https://www.retrodev.com/repos/blastem")
>> > +                    (changeset (string-append "v" version))))
>> > +              (file-name (string-append name "-" version "-
>> > checkout"))
>> 
>> Nit: (guix hg-download) provides a ‘hg-file-name’ procedure, so you
>> can just use (hg-file-name name version).
> Good to know, I simply used the hg-reference... expansion from
> etc/snippets, so that should probably be updated.

Ah, I guess it time to update etc/snippets then :)

>> > +              (sha256
>> > +               (base32
>> > +                "08ycfisivh9rb9vmijlrpdryaw8spd81ck48960p15cnf8h25
>> > 35q"))
>> > +              (modules '((guix build utils)))
>> > +              (snippet
>> > +               '(begin
>> > +                  ;; TODO: Separately package and unbundle nuklear
>> > +                  (delete-file-recursively "zlib")))))
>> 
>> Why is the zlib directory removed?  Or perhaps, why do they bundle
>> their own Zlib?
> The have their own PNG implementation, which appears different from
> libpng.  So zlib exists as a dependency of that, but it's also
> #included elsewhere.

OK, thanks for the explanation.
Ludovic Courtès June 26, 2021, 8:48 p.m. UTC | #4
Hi Leo,

Looks like this patch should be ready now?

Thanks,
Ludo’.
Leo Prikler June 27, 2021, 9:28 a.m. UTC | #5
Am Samstag, den 26.06.2021, 22:48 +0200 schrieb Ludovic Courtès:
> Hi Leo,
> 
> Looks like this patch should be ready now?
> 
> Thanks,
> Ludo’.
I would say so too.  I've pushed it now.

Thanks,
Leo
diff mbox series

Patch

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index ec8d3d21d6..1f1e726d8d 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -39,6 +39,7 @@ 
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix svn-download)
+  #:use-module (guix hg-download)
   #:use-module (guix utils)
   #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
@@ -141,6 +142,72 @@  C610/C510).  An extra emulator is provided for C64 expanded with the CMD
 SuperCPU.")
     (license license:gpl2+)))
 
+(define-public blastem
+  (package
+    (name "blastem")
+    (version "0.6.2")
+    (source (origin
+              (method hg-fetch)
+              (uri (hg-reference
+                    (url "https://www.retrodev.com/repos/blastem")
+                    (changeset (string-append "v" version))))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "08ycfisivh9rb9vmijlrpdryaw8spd81ck48960p15cnf8h2535q"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; TODO: Separately package and unbundle nuklear
+                  (delete-file-recursively "zlib")))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags (list (string-append "CC=" ,(cc-for-target))
+                          "HOST_ZLIB=1"
+                          "HAS_PROC=-DHAS_PROC"
+                          (string-append "CONFIG_PATH="
+                                         %output "/share/blastem")
+                          (string-append "DATA_PATH="
+                                         %output "/share/blastem"))
+       #:tests? #f ; No check target and custom tests don't seem to build
+       #:imported-modules
+       ((guix build copy-build-system)
+        ,@%gnu-build-system-modules)
+       #:modules
+       (((guix build copy-build-system)
+         #:prefix copy:)
+        (guix build gnu-build-system)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-source
+           (lambda _
+             (substitute* (find-files "." ".*\\.[ch]")
+               (("\"zlib/zlib.h\"") "<zlib.h>"))))
+         (delete 'configure)
+         (replace 'install
+           (lambda* args
+             (apply (assoc-ref copy:%standard-phases 'install)
+                    #:install-plan
+                    '(("." "bin" #:include ("blastem" "vgmplay"))
+                      ("." "share/blastem"
+                       #:include ("default.cfg" "rom.db")
+                       #:exclude ("android"))
+                      ("shaders" "share/blastem/shaders"))
+                    args))))))
+    (inputs
+     `(("glew" ,glew)
+       ("mesa" ,mesa)
+       ("sdl2" ,sdl2)
+       ("zlib" ,zlib)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (home-page "https://www.retrodev.com/blastem/")
+    (synopsis "Genesis/Mega Drive emulator")
+    (description "Blastem is an emulator for the Sega Genesis/Mega Drive
+console.")
+    (license license:gpl3+)))
+
 (define-public desmume
   (package
     (name "desmume")