[bug#74054,v2,3/3] gnu: Add speed-dreams.

Message ID a5cb320aeaa06fb9d1f2a9cc1c4a2c94bc3ea041.1730096728.git.maxim.cournoyer@gmail.com
State New
Headers
Series [bug#74054,v2,1/3] gnu: Add freesolid. |

Commit Message

Maxim Cournoyer Oct. 28, 2024, 6:26 a.m. UTC
  * gnu/packages/games.scm (speed-dreams): New variable.
(speed-dreams-version, speed-dreams-svn-revision): New variables.
(speed-dreams-source-tarball): New procedure.
(speed-dreams-base-tarball, speed-dreams-more-hq-cars-and-tracks-tarball)
(speed-dreams-wip-cars-and-tracks-tarball)
(speed-dreams-unmaintained-tarball): New variable.

Change-Id: Id14f3556d47a80c508177940f959448520b406fc
---

(no changes since v1)

 gnu/packages/games.scm | 122 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 122 insertions(+)
  

Comments

Liliana Marie Prikler Oct. 28, 2024, 8:12 a.m. UTC | #1
Am Montag, dem 28.10.2024 um 15:26 +0900 schrieb Maxim Cournoyer:
> * gnu/packages/games.scm (speed-dreams): New variable.
> (speed-dreams-version, speed-dreams-svn-revision): New variables.
> (speed-dreams-source-tarball): New procedure.
> (speed-dreams-base-tarball, speed-dreams-more-hq-cars-and-tracks-
> tarball)
> (speed-dreams-wip-cars-and-tracks-tarball)
> (speed-dreams-unmaintained-tarball): New variable.
Typo: missing "s" in New variables.

Also, I don't think we differentiate much between variables and
procedures (procedures *are* variables).

Cheers
  
Maxim Cournoyer Oct. 29, 2024, 12:09 a.m. UTC | #2
Hi,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Montag, dem 28.10.2024 um 15:26 +0900 schrieb Maxim Cournoyer:
>> * gnu/packages/games.scm (speed-dreams): New variable.
>> (speed-dreams-version, speed-dreams-svn-revision): New variables.
>> (speed-dreams-source-tarball): New procedure.
>> (speed-dreams-base-tarball, speed-dreams-more-hq-cars-and-tracks-
>> tarball)
>> (speed-dreams-wip-cars-and-tracks-tarball)
>> (speed-dreams-unmaintained-tarball): New variable.
> Typo: missing "s" in New variables.
>
> Also, I don't think we differentiate much between variables and
> procedures (procedures *are* variables).

In Guix I've mostly seen we differentiate between procedure and
variables in changelog commit messages or documentation, but not between
functions and procedures (these are bunched together).  I think being
more specific as opposed to general helps the reading a bit.

Thanks for the reading.  Did you attempt to build/run it?  It has some
bugs I've reported upstream:

1. (temperature sometimes get set to 'inf' and the driving experience
becomes like ice skating)

2. Occasional crash (segfault) (not reported yet -- couldn't catch a
nice backtrace with GDB).

It's still very much playable though, and upstream is still developing
the game, so hopefully these will get resolved in time.
  
Liliana Marie Prikler Nov. 15, 2024, 8:07 a.m. UTC | #3
Am Dienstag, dem 29.10.2024 um 09:09 +0900 schrieb Maxim Cournoyer:
> Thanks for the reading.  Did you attempt to build/run it?  It has
> some bugs I've reported upstream:
> 
> 1. (temperature sometimes get set to 'inf' and the driving experience
> becomes like ice skating)
> 
> 2. Occasional crash (segfault) (not reported yet -- couldn't catch a
> nice backtrace with GDB).
> 
> It's still very much playable though, and upstream is still
> developing the game, so hopefully these will get resolved in time.
I've built it now, but not yet run it.  Anyhow, I take your word that
it's playable and pushed it – 2/3 was already pushed anyways.

Cheers
  
Maxim Cournoyer Nov. 17, 2024, 4:14 a.m. UTC | #4
Hi Liliana,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Dienstag, dem 29.10.2024 um 09:09 +0900 schrieb Maxim Cournoyer:
>> Thanks for the reading.  Did you attempt to build/run it?  It has
>> some bugs I've reported upstream:
>> 
>> 1. (temperature sometimes get set to 'inf' and the driving experience
>> becomes like ice skating)
>> 
>> 2. Occasional crash (segfault) (not reported yet -- couldn't catch a
>> nice backtrace with GDB).
>> 
>> It's still very much playable though, and upstream is still
>> developing the game, so hopefully these will get resolved in time.
> I've built it now, but not yet run it.  Anyhow, I take your word that
> it's playable and pushed it – 2/3 was already pushed anyways.

Thanks.  I'll have a future update that uses the sources directly as it
fixes an annoying problem with the tire model of the latest release (the
tires get crazy hot and the car becomes uncontrollable); but there's
another serious problem in the unreleased sources where the game appears
to hang on the qualification screen there [0], so it's been on hold
until this gets resolved.

Anyway, thanks for the review/merge.

[0]  https://sourceforge.net/p/speed-dreams/tickets/1295/
  

Patch

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 64b6b0941a..be96ed895b 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -8964,6 +8964,128 @@  (define-public endless-sky
                    license:cc-by-sa4.0
                    license:public-domain))))
 
+(define speed-dreams-version "2.3.0")
+(define speed-dreams-svn-revision "8786")
+(define (speed-dreams-source-tarball name sha256sum)
+  (origin
+    (method url-fetch)
+    (uri (string-append "mirror://sourceforge/speed-dreams/"
+                        speed-dreams-version "/"
+                        "speed-dreams-src-" name "-" speed-dreams-version "-r"
+                        speed-dreams-svn-revision ".tar.xz"))
+    (sha256 (base32 sha256sum))))
+
+;;; We use the release tarballs instead of the SVN repository for their
+;;; reduced weight (the tarballs do not provide the sources of the 3D models
+;;; used, which are heavy, for example).
+(define speed-dreams-base-tarball       ;about 240 MiB
+  (speed-dreams-source-tarball
+   "base" "190480qzkllykl07s6bxd5wdbjgavs7haw6mk0hgdm7bs6rqqk0d"))
+
+(define speed-dreams-hq-cars-and-tracks-tarball ;about 670 MiB
+  (speed-dreams-source-tarball
+   "hq-cars-and-tracks" "16zcgwax3n0gf79hw1dg42lzsyxbnxfw6hjxdi919q5hxgm9cgsr"))
+
+(define speed-dreams-more-hq-cars-and-tracks-tarball ;about 760 MiB
+  (speed-dreams-source-tarball
+   "more-hq-cars-and-tracks"
+   "1acwiacf77qk5azyg3bbxsydk3wsp5fvgwwnhxpk273mwszjkh56"))
+
+;;; Although these are marked as 'WIP', the game throws (non-fatal) errors
+;;; when it fails finding some "drivers" included within this pack.
+(define speed-dreams-wip-cars-and-tracks-tarball ;about 400 MiB
+  (speed-dreams-source-tarball
+   "wip-cars-and-tracks"
+   "0wqd9bpis9bg87rsqk0dyvljax4zrp9h57mz7z3zrn6fayl1nh1q"))
+
+;;; This is to allow selecting the legacy Simu V2 engine (configurable in the
+;;; game options).
+(define speed-dreams-unmaintained-tarball ;about 60 KiB
+  (speed-dreams-source-tarball
+   "unmaintained" "1cxcrjm2508najpz2b65i8gxgvgiq7fcp13xvicpiqp6xhq3hsyi"))
+
+(define-public speed-dreams
+  (package
+    (name "speed-dreams")
+    (version speed-dreams-version)
+    (source speed-dreams-base-tarball)
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:tests? #f                       ;no test suite
+      #:build-type "Release"
+      #:configure-flags
+      #~(list
+         "-DOPTION_OFFICIAL_ONLY=ON"                    ;build with content
+         (string-append "-DSD_BINDIR=" #$output "/bin") ;instead of 'games'
+         (string-append "-DSD_DATADIR=" #$output "/share/speed-dreams-2")
+         ;; Libdir defaults to a 'lib64/games' prefix.
+         (string-append "-DSD_LIBDIR=" #$output "/lib/speed-dreams-2")
+         ;; Use system-provided Expat and FreeSOLID
+         ;; libraries instead of the bundled ones.
+         "-DOPTION_3RDPARTY_EXPAT=ON"
+         "-DOPTION_3RDPARTY_SOLID=ON"
+         ;; Drivers and other shared objects are linked to private/internal
+         ;; shared libraries; have their location on the RUNPATH to satisfy
+         ;; the validate-runpath phase.
+         (string-append "-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-rpath="
+                        #$output "/lib/speed-dreams-2/lib")
+         ;; The following flag is to avoid bogus RUNPATH warnings from the
+         ;; validate-runpath phase; without it, -rpath links referring to the
+         ;; build directory would be baked in driver modules.
+         "-DCMAKE_BUILD_RPATH_USE_ORIGIN=ON")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'extract-cars-and-tracks-data
+            (lambda _
+              ;; XXX: The current working directory is inside the cmake/
+              ;; sudbirectory following the unpack phase, for some reason.
+              (chdir "..")
+              (invoke "tar" "-xvf" #$speed-dreams-hq-cars-and-tracks-tarball)
+              (invoke "tar" "-xvf" #$speed-dreams-more-hq-cars-and-tracks-tarball)
+              (invoke "tar" "-xvf" #$speed-dreams-wip-cars-and-tracks-tarball)
+              (invoke "tar" "-xvf" #$speed-dreams-unmaintained-tarball)))
+          (add-after 'install 'install-desktop-entry
+            (lambda* (#:key outputs #:allow-other-keys)
+              (make-desktop-entry-file
+               (string-append #$output
+                              "/share/applications/speed-dreams.desktop")
+               #:name "Speed Dreams 2"
+               #:comment "3D racing cars simulator"
+               #:exec (search-input-file outputs "bin/speed-dreams-2")
+               #:icon (search-input-file
+                       outputs "share/speed-dreams-2/data/icons/icon.png")
+               #:categories '("Game" "Simulation")))))))
+    (native-inputs
+     (list pkg-config))
+    (inputs
+     (list curl
+           enet
+           expat
+           freeglut
+           freesolid
+           freetype
+           libjpeg-turbo
+           libogg
+           libpng
+           libvorbis
+           openal
+           openscenegraph
+           plib
+           sdl2
+           sdl2-mixer
+           zlib))
+    (home-page "https://sourceforge.net/projects/speed-dreams/")
+    (synopsis "Car racing simulator")
+    (description "Speed Dreams is a car racing simulator featuring
+high-quality 3D graphics and an accurate physics engine, aiming for maximum
+realism.  Initially forked from TORCS, it features improvements to the
+graphics and physics simulation, and supports modern input methods such as
+gamepads by use of the SDL library.  It features more than 20 tracks and more
+than 80 cars to race with.")
+    (license (list license:gpl2+        ;game code
+                   license:lal1.3))))   ;assets
+
 (define-public stepmania
   (package
     (name "stepmania")