From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 73989@debbugs.gnu.org
Cc: "Maxim Cournoyer" <maxim.cournoyer@gmail.com>,
"Maxim Cournoyer" <maxim.cournoyer@gmail.com>,
"Adam Faiz" <adam.faiz@disroot.org>,
"Liliana Marie Prikler" <liliana.prikler@gmail.com>,
宋文武 <iyzsong@envs.net>
Subject: [bug#73989] [PATCH 2/2] gnu: Add torcs.
Date: Fri, 25 Oct 2024 01:04:05 +0900 [thread overview]
Message-ID: <46b8369068d2a07dc772cff47e0143e2714e4edb.1729785827.git.maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <08aef5dc3850e87fff8bc084facca2fee9b7b04b.1729785827.git.maxim.cournoyer@gmail.com>
* gnu/packages/games.scm (torcs): New variable.
Change-Id: I1e55fc65ff303c309fed50f2071de0eaf4266d57
---
gnu/local.mk | 3 +
gnu/packages/games.scm | 123 ++++++++++++++++++
.../patches/torcs-glibc-default-source.patch | 25 ++++
gnu/packages/patches/torcs-isnan.patch | 15 +++
gnu/packages/patches/torcs-nullptr.patch | 14 ++
5 files changed, 180 insertions(+)
create mode 100644 gnu/packages/patches/torcs-glibc-default-source.patch
create mode 100644 gnu/packages/patches/torcs-isnan.patch
create mode 100644 gnu/packages/patches/torcs-nullptr.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 911af88627..5ddbcec9f4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2221,6 +2221,9 @@ dist_patch_DATA = \
%D%/packages/patches/tla2tools-build-xml.patch \
%D%/packages/patches/tlf-support-hamlib-4.2+.patch \
%D%/packages/patches/tofi-32bit-compat.patch \
+ %D%/packages/patches/torcs-glibc-default-source.patch \
+ %D%/packages/patches/torcs-isnan.patch \
+ %D%/packages/patches/torcs-nullptr.patch \
%D%/packages/patches/tpetra-remove-duplicate-using.patch \
%D%/packages/patches/transcode-ffmpeg.patch \
%D%/packages/patches/transmission-4.0.6-fix-build.patch \
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 64b6b0941a..17c418c5d6 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -7702,6 +7702,129 @@ (define-public tome4
abilities and powers.")
(license license:gpl3+)))
+(define-public torcs
+ (package
+ (name "torcs")
+ (version "1.3.7")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://sourceforge.net/projects/" name
+ "/files/all-in-one/" version "/"
+ name "-" version ".tar.bz2/download"))
+ (sha256
+ (base32
+ "0kdq0sc7dsfzlr0ggbxggcbkivc6yp30nqwjwcaxg9295s3b06wa"))
+ (patches (search-patches "torcs-isnan.patch"
+ "torcs-nullptr.patch"
+ "torcs-glibc-default-source.patch"))
+ (snippet
+ '(begin
+ (use-modules (guix build utils)
+ (ice-9 ftw)
+ (ice-9 regex)
+ (srfi srfi-26))
+ ;; Delete Windows-specific sources and pre-built binaries.
+ (delete-file-recursively "src/windows")
+ ;; The license of the kw-* and pw-* car models includes a
+ ;; non-commercial clause, hence does not comply with the GNU FSDG.
+ (with-directory-excursion "data/cars/models"
+ (for-each delete-file-recursively
+ (scandir "." (cut string-match "^(kc|pw)-" <>))))
+ ;; Delete extraneous CVS directories.
+ (for-each delete-file-recursively
+ (find-files "." (lambda (file stat)
+ (and (eq? 'directory (stat:type stat))
+ (string=? "CVS" (basename file))))
+ #:directories? #t))))))
+ (build-system gnu-build-system)
+ (arguments
+ ;; Building in parallel fails due to a race where include files have not
+ ;; yet been generated, with errors such as "controlconfig.cpp:30:10:
+ ;; fatal error: tgfclient.h: No such file or directory". The issue was
+ ;; reported to the 'torcs-devel' mailing list (see:
+ ;; https://sourceforge.net/p/torcs/mailman/torcs-devel/).
+ (list #:modules `(,@%default-gnu-modules (srfi srfi-26))
+ #:parallel-build? #f
+ #:tests? #f ;no test suite
+ ;; Ensure the binaries find libraries provided by this very package
+ ;; (see: https://issues.guix.gnu.org/73979).
+ #:configure-flags
+ #~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output
+ "/lib/torcs/lib"))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-commands
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "src/linux/torcs.in"
+ (("/bin/bash")
+ (search-input-file inputs "bin/bash")))))
+ (add-after 'install 'install-data
+ (lambda _
+ (invoke "make" "datainstall")))
+ (add-after 'install-data 'install-doc
+ (lambda _
+ (let ((docdir (string-append #$output "/share/doc/torcs/"))
+ (man6 (string-append #$output "/share/man/man6")))
+ (for-each (cut install-file <> man6)
+ (find-files "doc/man" "\\.6$"))
+ (install-file "doc/userman/how_to_drive.html" docdir)
+ (install-file "doc/faq/faq.html" docdir)
+ (copy-recursively "doc/userman/images"
+ (string-append docdir "/images")))))
+ (add-after 'install 'install-freedesktop-entry
+ (lambda _
+ (let ((iconsdir (string-append #$output "/share/icons/hicolor/"
+ "48x48/apps")))
+ (mkdir-p iconsdir)
+ (copy-file "Ticon.png" (string-append iconsdir "/torcs.png")))
+ (install-file "torcs.desktop"
+ (string-append #$output
+ "/share/applications/"))))
+ (add-after 'install 'fix-permissions
+ ;; XXX: Otherwise, the guix daemon reports: "suspicious
+ ;; ownership or permission on /gnu/store/xxx-torcs-1.3.7',
+ ;; rejecting this build output".
+ (lambda _
+ (chmod #$output #o744))))))
+ (inputs
+ (list bash-minimal
+ freealut
+ freeglut
+ libice
+ libpng
+ libsm
+ libvorbis
+ libxi
+ libxmu
+ libxrandr
+ libxrender
+ libxt
+ mesa
+ openal
+ plib
+ zlib))
+ (home-page "https://sourceforge.net/projects/torcs/")
+ (synopsis "Car racing simulator")
+ (description "TORCS stands for The Open Racing Car Simulator. It can be
+used as an ordinary car racing game, as an artificial intelligence (AI) racing
+game, or as a research platform. The game has features such as:
+@itemize
+@item Input support for a driving wheel, joystick, keyboard or mouse
+@item More than 30 car models
+@item 30 tracks
+@item 50 opponents to race against
+@item Lighting, smoke, skidmarks and glowing brake disks graphics
+@item Simple damage model and collisions
+@item Tire and wheel properties (springs, dampers, stiffness, etc.)
+@item Aerodynamics (ground effect, spoilers, etc.)
+@end itemize
+The difficulty level can be configured, impacting how much damage is caused by
+collisions and the level of traction the car has on the track, which makes the
+game fun for both novice and experts.")
+ (license (list license:gpl2+ ;source and most assets
+ license:fdl1.2+)))) ;how_to_drive.html, faq.html
+
(define-public quakespasm
(package
(name "quakespasm")
diff --git a/gnu/packages/patches/torcs-glibc-default-source.patch b/gnu/packages/patches/torcs-glibc-default-source.patch
new file mode 100644
index 0000000000..eb74cfd4ce
--- /dev/null
+++ b/gnu/packages/patches/torcs-glibc-default-source.patch
@@ -0,0 +1,25 @@
+From: Aurelien Jarno <aurelien@aurel32.net>
+Date: Mon, 1 May 2017 15:58:31 +0200
+Subject: glibc default source
+
+_SVID_SOURCE and _BSD_SOURCE are deprecated, using _DEFAULT_SOURCE
+instead.
+
+Forwarded: https://sourceforge.net/p/torcs/mailman/message/35831161/
+---
+ Make-config.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Make-config.in b/Make-config.in
+index f0e0a12..8041327 100644
+--- a/Make-config.in
++++ b/Make-config.in
+@@ -48,7 +48,7 @@ INSTALL_DATA = @INSTALL_DATA@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+
+-CFLAGSD = -D_SVID_SOURCE -D_BSD_SOURCE -DSHM -DHAVE_CONFIG_H
++CFLAGSD = -D_DEFAULT_SOURCE -DSHM -DHAVE_CONFIG_H
+ CXXFLAGS = @CXXFLAGS@ @CPPFLAGS@ ${CFLAGSD}
+ CFLAGS = @CFLAGS@ ${CFLAGSD}
+
diff --git a/gnu/packages/patches/torcs-isnan.patch b/gnu/packages/patches/torcs-isnan.patch
new file mode 100644
index 0000000000..2ec0c4e1c1
--- /dev/null
+++ b/gnu/packages/patches/torcs-isnan.patch
@@ -0,0 +1,15 @@
+Source: https://src.fedoraproject.org/rpms/torcs/raw/rawhide/f/torcs-1.3.7-isnan.patch
+Upstream-status: https://sourceforge.net/p/torcs/mailman/torcs-devel/thread/0bd466b7-e158-471b-13ad-504167587d01%40embecosm.com/#msg35836767
+
+diff -up torcs-1.3.7/src/drivers/olethros/geometry.cpp.orig torcs-1.3.7/src/drivers/olethros/geometry.cpp
+--- torcs-1.3.7/src/drivers/olethros/geometry.cpp.orig 2016-06-07 19:49:11.347896827 +0100
++++ torcs-1.3.7/src/drivers/olethros/geometry.cpp 2016-06-07 19:49:46.532894257 +0100
+@@ -27,6 +27,8 @@
+ #ifdef WIN32
+ #include <float.h>
+ #define isnan _isnan
++#else
++#define isnan std::isnan
+ #endif
+
+
diff --git a/gnu/packages/patches/torcs-nullptr.patch b/gnu/packages/patches/torcs-nullptr.patch
new file mode 100644
index 0000000000..a002c48169
--- /dev/null
+++ b/gnu/packages/patches/torcs-nullptr.patch
@@ -0,0 +1,14 @@
+Source: https://src.fedoraproject.org/rpms/torcs/raw/rawhide/f/torcs-1.3.7-nullptr.patch
+Upstream-status: https://sourceforge.net/p/torcs/mailman/message/36490328/
+
+--- torcs-1.3.7/src/libs/musicplayer/OpenALMusicPlayer.cpp.orig 2014-02-05 10:54:43.000000000 +0100
++++ torcs-1.3.7/src/libs/musicplayer/OpenALMusicPlayer.cpp 2018-07-09 20:56:42.521607205 +0100
+@@ -161,7 +161,7 @@
+ {
+ char pcm[BUFFERSIZE];
+ int size = 0;
+- const char* error = '\0';
++ const char* error = nullptr;
+
+ if (!stream->read(pcm, BUFFERSIZE, &size, &error)) {
+ GfError("OpenALMusicPlayer: Stream read error: %s\n", error);
--
2.46.0
next prev parent reply other threads:[~2024-10-24 16:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 15:45 [bug#73989] [PATCH games-team 0/2] Add TORCS Maxim Cournoyer
2024-10-24 16:04 ` [bug#73989] [PATCH 1/2] gnu: plib: Build with -fPIC Maxim Cournoyer
2024-10-24 16:04 ` Maxim Cournoyer [this message]
2024-11-06 20:40 ` [bug#73989] [PATCH games-team 0/2] Add TORCS Rodion Goritskov
2024-11-12 11:49 ` bug#73989: " Maxim Cournoyer
2024-11-13 2:57 ` [bug#73989] " Maxim Cournoyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46b8369068d2a07dc772cff47e0143e2714e4edb.1729785827.git.maxim.cournoyer@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=73989@debbugs.gnu.org \
--cc=adam.faiz@disroot.org \
--cc=iyzsong@envs.net \
--cc=liliana.prikler@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).