Subject: [bug#51635] [PATCH 2/2] gnu: openttd: Let the music play.

From: Liliana Prikler <[email-masked]>
Date: Sat, 6 Nov 2021 14:06:58 +0100

* gnu/packages/games.scm (openttd)[inputs]: Remove timidity++.
Add fluidsynth and freepats-gm.
[#:phases]<patch-sources>: New phase.
---
 gnu/packages/games.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 14131fa065..47ed3fc1b4 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -4481,6 +4481,15 @@ (define-public openttd
          (list (string-append "-DCMAKE_INSTALL_BINDIR=" out "/bin")))
        #:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'patch-sources
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "src/music/fluidsynth.cpp"
+               (("default_sf\\[\\] = \\{" all)
+                (string-append all "
+\t/* Guix hardcoded :P */
+\t\"" (string-append (assoc-ref inputs "freepats-gm")
+                     "/share/soundfonts/FreePatsGM.sf2") "\",
+")))))
          (add-before 'check 'install-data
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (for-each
@@ -4489,7 +4498,8 @@ (define-public openttd
                                   (assoc-ref outputs "out")))
               (list "opengfx" "openmsx" "opensfx")))))))
     (inputs
-     `(("timidity++" ,timidity++)
+     `(("fluidsynth" ,fluidsynth)
+       ("freepats-gm" ,freepats-gm)
        ,@(package-inputs openttd-engine)))
     (native-inputs
      `(("opengfx" ,openttd-opengfx)
-- 
2.33.1