From patchwork Thu Oct 24 16:04:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 32461 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8D81227BBEA; Thu, 24 Oct 2024 17:07:03 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B5D7927BBE2 for ; Thu, 24 Oct 2024 17:07:02 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t40MN-00068c-1A; Thu, 24 Oct 2024 12:06:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t40M6-00067b-4q for guix-patches@gnu.org; Thu, 24 Oct 2024 12:06:35 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t40M3-0005Z4-Rs for guix-patches@gnu.org; Thu, 24 Oct 2024 12:06:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=3bP2GqGljUUl2aaBHRLfnbaVWeMH14wP9fOG9CVGApE=; b=Bz7hsRsHr1GQ5z2knvzRlK3sVvOL0UjWf8Uf9zRvGJlGVbtlnqdrm+0Ag7hyq5vrFWYVf1AGnTzCyBM+EVROSI8SEjdnMvVyFnP/TG53dXj2rFQEwxunFzepxg8tMehb4+B3uS7ejVV/G6p0LNEE3QNP262LKrn/TnIjRHmPCgH+rJld62y2Uyz2KPCCidcFxdxWiY7Rz8048Oldst2DTWy10I2S+dwyOZAY26BEjb1BAZGemIuF81UpCbrEYyfrBobUc1c3Cel34kfHkGHfHZXmx7ikx3zchDdK8BDZS7agYidLqZOafy8pCGFfrQM0H//mYXEjqgvwL0n4M3GpEA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t40MY-0003EQ-3m; Thu, 24 Oct 2024 12:07:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73989] [PATCH 2/2] gnu: Add torcs. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, adam.faiz@disroot.org, liliana.prikler@gmail.com, iyzsong@envs.net, guix-patches@gnu.org Resent-Date: Thu, 24 Oct 2024 16:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73989 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73989@debbugs.gnu.org Cc: Maxim Cournoyer , Maxim Cournoyer , Adam Faiz , Liliana Marie Prikler , =?utf-8?b?5a6L5paH5q2m?= X-Debbugs-Original-Xcc: Maxim Cournoyer , Adam Faiz , Liliana Marie Prikler , =?utf-8?b?5a6L5paH5q2m?= Received: via spool by 73989-submit@debbugs.gnu.org id=B73989.172978596412341 (code B ref 73989); Thu, 24 Oct 2024 16:07:02 +0000 Received: (at 73989) by debbugs.gnu.org; 24 Oct 2024 16:06:04 +0000 Received: from localhost ([127.0.0.1]:35973 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t40Lb-0003Cu-4R for submit@debbugs.gnu.org; Thu, 24 Oct 2024 12:06:04 -0400 Received: from mail-pl1-f181.google.com ([209.85.214.181]:53574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t40LX-0003C3-UP for 73989@debbugs.gnu.org; Thu, 24 Oct 2024 12:06:01 -0400 Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-20ca7fc4484so7451615ad.3 for <73989@debbugs.gnu.org>; Thu, 24 Oct 2024 09:05:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729785863; x=1730390663; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3bP2GqGljUUl2aaBHRLfnbaVWeMH14wP9fOG9CVGApE=; b=XWklUqYvzJyNqNHxx8m/+IQsbxgHiKWsI8B7ub+lD2UKsWbbi01UsDbJGsChAUHWa5 XG4afDgS++YiIfUiA/G1WJYLam47ECmvv691cW3gMta0IPPRUIf2VYZluqufeC4X1ZdH OjwQSgZFAOPZUuGV9Y06+y9akUdtaYEsSVazV632hgU9Roqhvahq+d4xEMv/9dJGFOtt bMf7a5nrldEpFiVWFi0AcDtpCOH0tXZZn9cqK04lI8/BT76NRiFXbAwcRWSg3rnuch4X Eiu9rxHhjPqxborBZNYlCtNzNctWE+daXuNNXXb8150sjNrPm9tzMuxw4a93HDreqmFj EzAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729785863; x=1730390663; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3bP2GqGljUUl2aaBHRLfnbaVWeMH14wP9fOG9CVGApE=; b=lBeSjFGEiYv9cliiiraEgSo1ttHjW5iZAxAwYFqZHIKUC9mIs9T7ZEt+xWN1QnyJPG 467IpLFkVZyGZ4Zr7reK5Q20E5sUVhGMmfdVkOCZyeOaITR0jeGaVATf+Tr/PlUv5aUD 0MNQNLD0iFJsRIwhwbc0fES7jGNi6QcbT7+vyPy1HGhZf0DOQCRY4pcLFQ/7WVbSlqiS Qxu63mKUHh6O/cBFL9EJsCP+3t96c2pedbeerIRjbNWpXxCvPz8b/vo9iCjR3KGc4Rhp CiWiLi5gjbQO+J4fUnzuOGnR1MvSFz3+CvBLjmvI7VgMeD3blTUXVy+S626pLLjd3K5l 8CfA== X-Gm-Message-State: AOJu0YxfNN/ZaJHX7F/mk0OqI+AqclxP+/61KKO67nzVr5sZVkhxINNe oc6MgR5rWIsXqDmvdTB6TMIiZJVO9GfccNV/7xp9OZlG9gkGfh4ckVup9A== X-Google-Smtp-Source: AGHT+IFhjBTPTO0OgrSV1v/VvtcQZrzalUNKUOo4M/FlJ0rEfshEboA75T0/z3AcE7SdHNqj49aq5Q== X-Received: by 2002:a17:903:1cb:b0:20f:c094:b80f with SMTP id d9443c01a7336-20fc094bce6mr5220305ad.49.1729785862597; Thu, 24 Oct 2024 09:04:22 -0700 (PDT) Received: from localhost.localdomain ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20e7f0bd561sm74128375ad.179.2024.10.24.09.04.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 09:04:22 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 25 Oct 2024 01:04:05 +0900 Message-ID: <46b8369068d2a07dc772cff47e0143e2714e4edb.1729785827.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <08aef5dc3850e87fff8bc084facca2fee9b7b04b.1729785827.git.maxim.cournoyer@gmail.com> References: <08aef5dc3850e87fff8bc084facca2fee9b7b04b.1729785827.git.maxim.cournoyer@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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 +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 + #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);