[PATCH 0/3] Add ericw-tools and TrenchBroom.

  • Open
  • quality assurance status badge
Details
2 participants
  • James Smith
  • Liliana Marie Prikler
Owner
unassigned
Submitted by
James Smith
Severity
normal
J
J
James Smith wrote on 16 Sep 04:10 +0200
(address . guix-patches@gnu.org)(name . James Smith)(address . jsubuntuxp@disroot.org)
cover.1726445374.git.jsubuntuxp@disroot.org
This series adds the TrenchBroom map editor along with ericw-tools, which is a
set of map compilers that works with it. Ericw-tools does need a couple of
commits backported from upstream (in the form of patches) to build, so
hopefully I included the patches properly.

James Smith (3):
gnu: Add embree-2.
gnu: Add ericw-tools.
gnu: Add trenchbroom.

gnu/local.mk | 3 +
gnu/packages/game-development.scm | 168 ++++++++++++++++++
gnu/packages/graphics.scm | 22 +++
...tools-add-check-for-sse2-in-light.cc.patch | 31 ++++
...-tools-gcc-11-pass-const-to-offsetof.patch | 87 +++++++++
5 files changed, 311 insertions(+)
create mode 100644 gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch
create mode 100644 gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch


base-commit: 83698b6fa037aa1f3adc38f474be41bac7622ed8
--
2.46.0
J
J
James Smith wrote on 16 Sep 04:16 +0200
[PATCH 1/3] gnu: Add embree-2.
(address . 73287@debbugs.gnu.org)(name . James Smith)(address . jsubuntuxp@disroot.org)
523f56c5bce617aba865a0d6cb7497caed06d249.1726445374.git.jsubuntuxp@disroot.org
* gnu/packages/graphics.scm: (embree-2): New variable.

Change-Id: I2b2143b4d93c402ba940d408280ef1b37ab552ea
---
gnu/packages/graphics.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

Toggle diff (42 lines)
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 3d03802245..d893c9dfee 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -37,6 +37,7 @@
;;; Copyright © 2023 David Thompson <dthompson2@worcester.edu>
;;; Copyright © 2023 Eric Bavier <bavier@posteo.net>
;;; Copyright © 2023, 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com>
+;;; Copyright © 2024 James Smith <jsubuntuxp@disroot.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -490,6 +491,27 @@ (define-public embree-3
(base32
"1kcvz7g6j56anv9zjyd3gidxl46vipw0gg82lns12m45cd43iwxm"))))))
+(define-public embree-2
+ (package/inherit embree
+ (version "2.17.7")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference (url "https://github.com/RenderKit/embree")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name (package-name embree) version))
+ (sha256
+ (base32 "19v60zdfix33c772x6dzmhsarhafsns8qy7c2ysqr7a9j16whgql"))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments embree)
+ ((#:configure-flags configure-flags)
+ #~(append (list "-DEMBREE_TUTORIALS=OFF") #$configure-flags))))
+ (inputs (modify-inputs (package-inputs embree)
+ (replace "tbb" tbb-2020)))
+ ;; Tries to build with SSE2 and AVX support on ARM, so disable building for
+ ;; those systems.
+ (supported-systems (list "i686-linux" "x86_64-linux"))))
+
(define-public openvdb
(package
(name "openvdb")
--
2.46.0
J
J
James Smith wrote on 16 Sep 04:16 +0200
[PATCH 2/3] gnu: Add ericw-tools.
(address . 73287@debbugs.gnu.org)(name . James Smith)(address . jsubuntuxp@disroot.org)
77a59889d3bed9a7629b49da7b033846cb195715.1726445374.git.jsubuntuxp@disroot.org
* gnu/packages/game-development.scm: (ericw-tools): New variable.
* gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch: New file.
* gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch: New file.
* gnu/local.mk: Register patch files.

Change-Id: I896b8f781054442e4db4a7220d526b8f2878873c
---
gnu/local.mk | 3 +
gnu/packages/game-development.scm | 75 ++++++++++++++++
...tools-add-check-for-sse2-in-light.cc.patch | 31 +++++++
...-tools-gcc-11-pass-const-to-offsetof.patch | 87 +++++++++++++++++++
4 files changed, 196 insertions(+)
create mode 100644 gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch
create mode 100644 gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch

Toggle diff (239 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index fcdf174099..bb7ec9960c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -67,6 +67,7 @@
# Copyright © 2024 David Elsing <david.elsing@posteo.net>
# Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se>
# Copyright © 2024 Fabio Natali <me@fabionatali.com>
+# Copyright © 2024 James Smith <jsubuntuxp@disroot.org>
#
# This file is part of GNU Guix.
#
@@ -1200,6 +1201,8 @@ dist_patch_DATA = \
%D%/packages/patches/epiphany-fix-encoding-test.patch \
%D%/packages/patches/ergodox-firmware-fix-json-target.patch \
%D%/packages/patches/ergodox-firmware-fix-numpad.patch \
+ %D%/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch \
+ %D%/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch \
%D%/packages/patches/erlang-man-path.patch \
%D%/packages/patches/esmini-use-pkgconfig.patch \
%D%/packages/patches/esmtp-add-lesmtp.patch \
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index efbbabaaf5..d61b4d633a 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -2394,6 +2394,81 @@ (define-public entt
(license (list license:expat ; code
license:cc-by4.0)))) ; documentation
+(define-public ericw-tools
+ (package
+ (name "ericw-tools")
+ (version "0.18.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference (url "https://github.com/ericwa/ericw-tools")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "11sap7qv0rlhw8q25azvhgjcwiql3zam09q0gim3i04cg6fkh0vp"))
+ (patches
+ (search-patches "ericw-tools-add-check-for-sse2-in-light.cc.patch"
+ "ericw-tools-gcc-11-pass-const-to-offsetof.patch"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list #:configure-flags #~(list "-DENABLE_LIGHTPREVIEW=OFF")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'disable-copying-embree-files
+ (lambda _
+ ;; Tries to copy files from embree, disable it.
+ (substitute* "light/CMakeLists.txt"
+ (("install\\\(FILES \\$\\{EMBREE")
+ "#install(FILES ${EMBREE"))))
+ (add-after 'install 'rename-binaries
+ (lambda _
+ ;; Rename binaries to prevent collisions with other
+ ;; packages.
+ (rename-file (string-append #$output "/bin/bspinfo")
+ (string-append #$output "/bin/qbspinfo"))
+ (rename-file (string-append #$output "/bin/bsputil")
+ (string-append #$output "/bin/qbsputil"))
+ (rename-file (string-append #$output "/bin/light")
+ (string-append #$output "/bin/qlight"))
+ (rename-file (string-append #$output "/bin/vis")
+ (string-append #$output "/bin/qvis"))))
+ (add-after 'install-license-files 'clean-up-bin-directory
+ (lambda _
+ ;; Install target copies text documents to #$output/bin, move
+ ;; them to #$output/share/doc.
+ (delete-file (string-append #$output "/bin/gpl_v3.txt"))
+ (rename-file
+ (string-append #$output "/bin/changelog.txt")
+ (string-append #$output "/share/doc/"
+ #$(package-name this-package) "-"
+ #$(package-version this-package)
+ "/changelog.txt"))
+ (rename-file
+ (string-append #$output "/bin/README.md")
+ (string-append #$output "/share/doc/"
+ #$(package-name this-package) "-"
+ #$(package-version this-package)
+ "/README.md")))))
+ #:tests? #f)) ; No tests
+ (inputs (list embree-2))
+ (home-page "https://ericwa.github.io/ericw-tools/")
+ (synopsis "Quake/Hexen 2 map compiling tools")
+ (description "Collection of command line utilities for building Quake levels
+and working with various Quake file formats. A brief description of the tools
+are listed below.
+
+Included utilities:
+
+@itemize @bullet
+@item qbsp - Used for turning a .map file into a playable .bsp file.
+@item qlight - Used for lighting a level after the bsp stage. This util was
+previously known as TyrLite.
+@item qvis - Creates the potentially visible set (PVS) for a bsp.
+@item qbspinfo - Print stats about the data contained in a bsp file.
+@item qbsputil - Simple tool for manipulation of bsp file data.
+@end itemize")
+ (license license:gpl2+)))
+
(define-public eureka
(package
(name "eureka")
diff --git a/gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch b/gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch
new file mode 100644
index 0000000000..4c95b8570d
--- /dev/null
+++ b/gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch
@@ -0,0 +1,31 @@
+From 982ef5276bb231ded12c45a686b0875594175774 Mon Sep 17 00:00:00 2001
+From: Bryan Haley <bryanmhaley@gmail.com>
+Date: Mon, 28 Mar 2022 22:05:28 -0700
+Subject: [PATCH] Add check for SSE2 in light.cc (#328)
+
+---
+ light/light.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/light/light.cc b/light/light.cc
+index 7e23d040f..c00844643 100644
+--- a/light/light.cc
++++ b/light/light.cc
+@@ -33,7 +33,7 @@
+ #include <common/polylib.hh>
+ #include <common/bsputils.hh>
+
+-#ifdef HAVE_EMBREE
++#if defined(HAVE_EMBREE) && defined (__SSE2__)
+ #include <xmmintrin.h>
+ //#include <pmmintrin.h>
+ #endif
+@@ -255,7 +255,7 @@ LightThread(void *arg)
+ {
+ const mbsp_t *bsp = (const mbsp_t *)arg;
+
+-#ifdef HAVE_EMBREE
++#if defined(HAVE_EMBREE) && defined (__SSE2__)
+ _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
+ // _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
+ #endif
diff --git a/gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch b/gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch
new file mode 100644
index 0000000000..6da4179a9e
--- /dev/null
+++ b/gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch
@@ -0,0 +1,87 @@
+From c9570260fa895dde5a21272d76f9a3b05d59efdd Mon Sep 17 00:00:00 2001
+From: Eric Wasylishen <ewasylishen@gmail.com>
+Date: Sun, 30 May 2021 23:12:17 -0600
+Subject: [PATCH] gcc 11: pass constant to offsetof
+
+---
+ common/polylib.cc | 5 ++++-
+ qbsp/util.cc | 5 ++++-
+ qbsp/winding.cc | 4 +++-
+ vis/vis.cc | 10 ++++++++--
+ 4 files changed, 19 insertions(+), 5 deletions(-)
+
+diff --git a/common/polylib.cc b/common/polylib.cc
+index 6397b3107..c8e1afbff 100644
+--- a/common/polylib.cc
++++ b/common/polylib.cc
+@@ -230,7 +230,10 @@ polylib::CopyWinding(const winding_t * w)
+ int size;
+ winding_t *c;
+
+- size = offsetof(winding_t, p[w->numpoints]);
++ //size = offsetof(winding_t, p[w->numpoints]);
++ size = offsetof(winding_t, p[0]);
++ size += w->numpoints * sizeof(w->p[0]);
++
+ c = static_cast<winding_t *>(malloc(size));
+ memcpy(c, w, size);
+ return c;
+diff --git a/qbsp/util.cc b/qbsp/util.cc
+index e8baf7205..16c9077f1 100644
+--- a/qbsp/util.cc
++++ b/qbsp/util.cc
+@@ -53,7 +53,10 @@ AllocMem(int Type, int cElements, bool fZero)
+ if (cElements > MAX_POINTS_ON_WINDING)
+ Error("Too many points (%d) on winding (%s)", cElements, __func__);
+
+- cSize = offsetof(winding_t, points[cElements]) + sizeof(int);
++ //cSize = offsetof(winding_t, points[cElements]) + sizeof(int);
++ cSize = offsetof(winding_t, points[0]);
++ cSize += cElements * sizeof(static_cast<winding_t*>(nullptr)->points[0]);
++ cSize += sizeof(int);
+
+ // Set cElements to 1 so bookkeeping works OK
+ cElements = 1;
+diff --git a/qbsp/winding.cc b/qbsp/winding.cc
+index 1af1d096c..6e286c387 100644
+--- a/qbsp/winding.cc
++++ b/qbsp/winding.cc
+@@ -106,7 +106,9 @@ CopyWinding(const winding_t *w)
+ winding_t *c;
+
+ c = (winding_t *)AllocMem(WINDING, w->numpoints, false);
+- size = offsetof(winding_t, points[w->numpoints]);
++ //size = offsetof(winding_t, points[w->numpoints]);
++ size = offsetof(winding_t, points[0]);
++ size += w->numpoints * sizeof(w->points[0]);
+ memcpy(c, w, size);
+
+ return c;
+diff --git a/vis/vis.cc b/vis/vis.cc
+index 9fb0ea9ea..ec43a8a5f 100644
+--- a/vis/vis.cc
++++ b/vis/vis.cc
+@@ -127,7 +127,10 @@ NewWinding(int points)
+ if (points > MAX_WINDING)
+ Error("%s: %i points", __func__, points);
+
+- size = offsetof(winding_t, points[points]);
++ //size = offsetof(winding_t, points[points]);
++ size = offsetof(winding_t, points[0]);
++ size += points * sizeof(w->points[0]);
++
+ w = static_cast<winding_t *>(malloc(size));
+ memset(w, 0, size);
+
+@@ -178,7 +181,10 @@ CopyWinding(const winding_t * w)
+ int size;
+ winding_t *c;
+
+- size = offsetof(winding_t, points[w->numpoints]);
++ //size = offsetof(winding_t, points[w->numpoints]);
++ size = offsetof(winding_t, points[0]);
++ size += w->numpoints * sizeof(w->points[0]);
++
+ c = static_cast<winding_t *>(malloc(size));
+ memcpy(c, w, size);
+ return c;
--
2.46.0
J
J
James Smith wrote on 16 Sep 04:16 +0200
[PATCH 3/3] gnu: Add trenchbroom.
(address . 73287@debbugs.gnu.org)(name . James Smith)(address . jsubuntuxp@disroot.org)
bac910d5f79fb436a1cf2a7feeea5a58dc8f5c1a.1726445374.git.jsubuntuxp@disroot.org
* gnu/packages/game-development.scm: (trenchbroom): New variable.

Change-Id: I50691b1db2010cd8c2c7f04bdfd80278b9e14aed
---
gnu/packages/game-development.scm | 93 +++++++++++++++++++++++++++++++
1 file changed, 93 insertions(+)

Toggle diff (133 lines)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index d61b4d633a..abc144f535 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -91,12 +91,14 @@ (define-module (gnu packages game-development)
#:use-module (gnu packages graphviz)
#:use-module (gnu packages gtk)
#:use-module (gnu packages guile)
+ #:use-module (gnu packages haskell-xyz)
#:use-module (gnu packages icu4c)
#:use-module (gnu packages image)
#:use-module (gnu packages linux)
#:use-module (gnu packages llvm)
#:use-module (gnu packages lua)
#:use-module (gnu packages m4)
+ #:use-module (gnu packages maths)
#:use-module (gnu packages mp3)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages music)
@@ -104,6 +106,7 @@ (define-module (gnu packages game-development)
#:use-module (gnu packages networking)
#:use-module (gnu packages pcre)
#:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages pretty-print)
#:use-module (gnu packages pulseaudio)
#:use-module (gnu packages python)
#:use-module (gnu packages python-crypto)
@@ -121,6 +124,7 @@ (define-module (gnu packages game-development)
#:use-module (gnu packages texinfo)
#:use-module (gnu packages textutils)
#:use-module (gnu packages tls)
+ #:use-module (gnu packages version-control)
#:use-module (gnu packages video)
#:use-module (gnu packages vulkan)
#:use-module (gnu packages web)
@@ -674,6 +678,95 @@ (define-public tiled
;; under BSD-2.
(license license:gpl2+)))
+(define-public trenchbroom
+ (package
+ (name "trenchbroom")
+ (version "2024.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/TrenchBroom/TrenchBroom")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1xysz7rkjy11wp9sshdqllmlw8qb65f1zlljpw3q22483szwzxnb"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list #:configure-flags
+ #~(list "-DCMAKE_BUILD_TYPE=Release" "-G" "Unix Makefiles"
+ "-DCMAKE_PREFIX_PATH=cmake/packages"
+ (string-append "-DFREEIMAGE_INCLUDE_PATH="
+ #$freeimage "/include")
+ (string-append "-DFREEIMAGE_LIBRARY="
+ #$freeimage "/lib/libfreeimage.so")
+ (string-append "-Dfreetype_INCLUDE_DIR="
+ #$freetype "/include/freetype2")
+ (string-append "-Dfreetype_LIBRARY="
+ #$freetype "/lib/libfreetype.so"))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'fix-build-system
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ (("set\\(CMAKE_TOOLCHAIN_FILE")
+ "#set(CMAKE_TOOLCHAIN_FILE"))
+ (substitute* "app/CMakeLists.txt"
+ (("/usr") #$output))))
+ (add-before 'build 'set-environment-variables
+ (lambda _
+ ;; Set home so fontconfig can write cache.
+ (setenv "HOME" (getenv "TEMP"))
+ ;; Set QT platform for offscreen rendering.
+ (setenv "QT_QPA_PLATFORM" "offscreen")
+ (setenv "XDG_RUNTIME_DIR" (getenv "TEMP"))))
+ (add-after 'install 'wrap-trenchbroom
+ (lambda _
+ (wrap-program (string-append #$output "/bin/trenchbroom")
+ ;; TrenchBroom needs $XDG_DATA_DIRS set to find game
+ ;; configs.
+ `("XDG_DATA_DIRS" ":" prefix
+ (,(string-append #$output "/share")))
+ ;; TrenchBroom also doesn't work well with Wayland backend.
+ '("QT_QPA_PLATFORM" = ("xcb")))))
+ (add-after 'install 'install-desktop-file
+ (lambda _
+ (make-desktop-entry-file
+ (string-append #$output "/share/applications/"
+ #$(package-name this-package) ".desktop")
+ #:name "TrenchBroom"
+ #:comment #$(package-synopsis this-package)
+ #:exec #$name
+ #:icon #$name
+ #:categories '("Development")
+ #:keywords '("quake" "level" "editor")))))
+ #:tests? #f)) ; No tests.
+ (inputs
+ (list assimp
+ bash-minimal
+ catch2
+ fmt
+ freeglut
+ freeimage
+ freetype
+ glew
+ glm
+ glu
+ libxxf86vm
+ mesa
+ miniz
+ qtbase-5
+ qtsvg-5
+ tinyxml2))
+ (native-inputs (list git pandoc python p7zip))
+ (home-page "https://kristianduske.com/trenchbroom/")
+ (synopsis "Cross-platform level editor for Quake-engine based games")
+ (description "TrenchBroom is a cross-platform level editor for Quake-engine
+based games. It supports Quake, Quake 2, and Hexen 2. TrenchBroom is easy and
+provides many simple and advanced tools to create complex and interesting levels
+with ease.")
+ (license license:gpl3+)))
+
(define-public tsukundere
(package
(name "tsukundere")
--
2.46.0
L
L
Liliana Marie Prikler wrote on 20 Sep 09:58 +0200
Re: [PATCH 1/3] gnu: Add embree-2.
b87c0a58d935e0a3aee802d2db745f8f4345be7f.camel@gmail.com
Am Sonntag, dem 15.09.2024 um 19:16 -0700 schrieb James Smith:
Toggle quote (48 lines)
> * gnu/packages/graphics.scm: (embree-2): New variable.
>
> Change-Id: I2b2143b4d93c402ba940d408280ef1b37ab552ea
> ---
>  gnu/packages/graphics.scm | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
> index 3d03802245..d893c9dfee 100644
> --- a/gnu/packages/graphics.scm
> +++ b/gnu/packages/graphics.scm
> @@ -37,6 +37,7 @@
>  ;;; Copyright © 2023 David Thompson <dthompson2@worcester.edu>
>  ;;; Copyright © 2023 Eric Bavier <bavier@posteo.net>
>  ;;; Copyright © 2023, 2024 Artyom V. Poptsov
> <poptsov.artyom@gmail.com>
> +;;; Copyright © 2024 James Smith <jsubuntuxp@disroot.org>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -490,6 +491,27 @@ (define-public embree-3
>                 (base32
>                 
> "1kcvz7g6j56anv9zjyd3gidxl46vipw0gg82lns12m45cd43iwxm"))))))
>  
> +(define-public embree-2
> +  (package/inherit embree
> +    (version "2.17.7")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference (url
> "https://github.com/RenderKit/embree")
> +                           (commit (string-append "v" version))))
> +       (file-name (git-file-name (package-name embree) version))
> +       (sha256
> +        (base32
> "19v60zdfix33c772x6dzmhsarhafsns8qy7c2ysqr7a9j16whgql"))))
> +    (arguments
> +     (substitute-keyword-arguments (package-arguments embree)
> +       ((#:configure-flags configure-flags)
> +        #~(append (list "-DEMBREE_TUTORIALS=OFF") #$configure-
> flags))))
> +    (inputs (modify-inputs (package-inputs embree)
> +              (replace "tbb" tbb-2020)))
> +    ;; Tries to build with SSE2 and AVX support on ARM, so disable
> building for
> +    ;; those systems.
Comments should be full sentences. Also, this is a hint that it uses
SSE2 and AVX on the platforms below too – we should disable them, as
they won't work with every CPU.
Toggle quote (3 lines)
> +    (supported-systems (list "i686-linux" "x86_64-linux"))))
> +

Cheers
L
L
Liliana Marie Prikler wrote on 20 Sep 10:02 +0200
Re: [bug#73287] [PATCH 3/3] gnu: Add trenchbroom.
a282def5d99351584056120879fb6a000dbbb34d.camel@gmail.com
Am Sonntag, dem 15.09.2024 um 19:16 -0700 schrieb James Smith:
Toggle quote (146 lines)
> * gnu/packages/game-development.scm: (trenchbroom): New variable.
>
> Change-Id: I50691b1db2010cd8c2c7f04bdfd80278b9e14aed
> ---
>  gnu/packages/game-development.scm | 93
> +++++++++++++++++++++++++++++++
>  1 file changed, 93 insertions(+)
>
> diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-
> development.scm
> index d61b4d633a..abc144f535 100644
> --- a/gnu/packages/game-development.scm
> +++ b/gnu/packages/game-development.scm
> @@ -91,12 +91,14 @@ (define-module (gnu packages game-development)
>    #:use-module (gnu packages graphviz)
>    #:use-module (gnu packages gtk)
>    #:use-module (gnu packages guile)
> +  #:use-module (gnu packages haskell-xyz)
>    #:use-module (gnu packages icu4c)
>    #:use-module (gnu packages image)
>    #:use-module (gnu packages linux)
>    #:use-module (gnu packages llvm)
>    #:use-module (gnu packages lua)
>    #:use-module (gnu packages m4)
> +  #:use-module (gnu packages maths)
>    #:use-module (gnu packages mp3)
>    #:use-module (gnu packages multiprecision)
>    #:use-module (gnu packages music)
> @@ -104,6 +106,7 @@ (define-module (gnu packages game-development)
>    #:use-module (gnu packages networking)
>    #:use-module (gnu packages pcre)
>    #:use-module (gnu packages pkg-config)
> +  #:use-module (gnu packages pretty-print)
>    #:use-module (gnu packages pulseaudio)
>    #:use-module (gnu packages python)
>    #:use-module (gnu packages python-crypto)
> @@ -121,6 +124,7 @@ (define-module (gnu packages game-development)
>    #:use-module (gnu packages texinfo)
>    #:use-module (gnu packages textutils)
>    #:use-module (gnu packages tls)
> +  #:use-module (gnu packages version-control)
>    #:use-module (gnu packages video)
>    #:use-module (gnu packages vulkan)
>    #:use-module (gnu packages web)
> @@ -674,6 +678,95 @@ (define-public tiled
>      ;; under BSD-2.
>      (license license:gpl2+)))
>  
> +(define-public trenchbroom
> +  (package
> +    (name "trenchbroom")
> +    (version "2024.1")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/TrenchBroom/TrenchBroom")
> +             (commit (string-append "v" version))))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32
> "1xysz7rkjy11wp9sshdqllmlw8qb65f1zlljpw3q22483szwzxnb"))))
> +    (build-system cmake-build-system)
> +    (arguments
> +     (list #:configure-flags
> +           #~(list "-DCMAKE_BUILD_TYPE=Release" "-G" "Unix
> Makefiles"
> +                   "-DCMAKE_PREFIX_PATH=cmake/packages"
> +                   (string-append "-DFREEIMAGE_INCLUDE_PATH="
> +                                  #$freeimage "/include")
> +                   (string-append "-DFREEIMAGE_LIBRARY="
> +                                  #$freeimage
> "/lib/libfreeimage.so")
> +                   (string-append "-Dfreetype_INCLUDE_DIR="
> +                                  #$freetype "/include/freetype2")
> +                   (string-append "-Dfreetype_LIBRARY="
> +                                  #$freetype "/lib/libfreetype.so"))
> +           #:phases
> +           #~(modify-phases %standard-phases
> +               (add-after 'unpack 'fix-build-system
> +                 (lambda _
> +                   (substitute* "CMakeLists.txt"
> +                     (("set\\(CMAKE_TOOLCHAIN_FILE")
> +                      "#set(CMAKE_TOOLCHAIN_FILE"))
> +                   (substitute* "app/CMakeLists.txt"
> +                     (("/usr") #$output))))
> +               (add-before 'build 'set-environment-variables
> +                 (lambda _
> +                   ;; Set home so fontconfig can write cache.
> +                   (setenv "HOME" (getenv "TEMP"))
> +                   ;; Set QT platform for offscreen rendering.
> +                   (setenv "QT_QPA_PLATFORM" "offscreen")
> +                   (setenv "XDG_RUNTIME_DIR" (getenv "TEMP"))))
> +               (add-after 'install 'wrap-trenchbroom
> +                 (lambda _
> +                   (wrap-program (string-append #$output
> "/bin/trenchbroom")
> +                     ;; TrenchBroom needs $XDG_DATA_DIRS set to find
> game
> +                     ;; configs.
> +                     `("XDG_DATA_DIRS" ":" prefix
> +                       (,(string-append #$output "/share")))
> +                     ;; TrenchBroom also doesn't work well with
> Wayland backend.
> +                     '("QT_QPA_PLATFORM" = ("xcb")))))
> +               (add-after 'install 'install-desktop-file
> +                 (lambda _
> +                   (make-desktop-entry-file
> +                    (string-append #$output "/share/applications/"
> +                                   #$(package-name this-package)
> ".desktop")
> +                    #:name "TrenchBroom"
> +                    #:comment #$(package-synopsis this-package)
> +                    #:exec #$name
> +                    #:icon #$name
> +                    #:categories '("Development")
> +                    #:keywords '("quake" "level" "editor")))))
> +           #:tests? #f)) ; No tests.
> +    (inputs
> +     (list assimp
> +           bash-minimal
> +           catch2
> +           fmt
> +           freeglut
> +           freeimage
> +           freetype
> +           glew
> +           glm
> +           glu
> +           libxxf86vm
> +           mesa
> +           miniz
> +           qtbase-5
> +           qtsvg-5
> +           tinyxml2))
> +    (native-inputs (list git pandoc python p7zip))
> +    (home-page "https://kristianduske.com/trenchbroom/")
> +    (synopsis "Cross-platform level editor for Quake-engine based
> games")
> +    (description "TrenchBroom is a cross-platform level editor for
> Quake-engine
> +based games.  It supports Quake, Quake 2, and Hexen 2.  TrenchBroom
> is easy and
> +provides many simple and advanced tools to create complex and
> interesting levels
> +with ease.")
"Easy with ease"… less marketing speech is advisable :)
L
L
Liliana Marie Prikler wrote on 20 Sep 10:04 +0200
Re: [bug#73287] [PATCH 2/3] gnu: Add ericw-tools.
6fe9f674e894c9cb20a51b9e60cd319f0efe3954.camel@gmail.com
Am Sonntag, dem 15.09.2024 um 19:16 -0700 schrieb James Smith:
Toggle quote (127 lines)
> * gnu/packages/game-development.scm: (ericw-tools): New variable.
> * gnu/packages/patches/ericw-tools-add-check-for-sse2-in-
> light.cc.patch: New file.
> * gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-
> offsetof.patch: New file.
> * gnu/local.mk: Register patch files.
>
> Change-Id: I896b8f781054442e4db4a7220d526b8f2878873c
> ---
>  gnu/local.mk                                  |  3 +
>  gnu/packages/game-development.scm             | 75 ++++++++++++++++
>  ...tools-add-check-for-sse2-in-light.cc.patch | 31 +++++++
>  ...-tools-gcc-11-pass-const-to-offsetof.patch | 87
> +++++++++++++++++++
>  4 files changed, 196 insertions(+)
>  create mode 100644 gnu/packages/patches/ericw-tools-add-check-for-
> sse2-in-light.cc.patch
>  create mode 100644 gnu/packages/patches/ericw-tools-gcc-11-pass-
> const-to-offsetof.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index fcdf174099..bb7ec9960c 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -67,6 +67,7 @@
>  # Copyright © 2024 David Elsing <david.elsing@posteo.net>
>  # Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se>
>  # Copyright © 2024 Fabio Natali <me@fabionatali.com>
> +# Copyright © 2024 James Smith <jsubuntuxp@disroot.org>
>  #
>  # This file is part of GNU Guix.
>  #
> @@ -1200,6 +1201,8 @@ dist_patch_DATA
> =                                         \
>    %D%/packages/patches/epiphany-fix-encoding-test.patch        \
>    %D%/packages/patches/ergodox-firmware-fix-json-target.patch  \
>    %D%/packages/patches/ergodox-firmware-fix-numpad.patch       \
> +  %D%/packages/patches/ericw-tools-add-check-for-sse2-in-
> light.cc.patch        \
> +  %D%/packages/patches/ericw-tools-gcc-11-pass-const-to-
> offsetof.patch \
>    %D%/packages/patches/erlang-man-path.patch                   \
>    %D%/packages/patches/esmini-use-pkgconfig.patch              \
>    %D%/packages/patches/esmtp-add-lesmtp.patch          \
> diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-
> development.scm
> index efbbabaaf5..d61b4d633a 100644
> --- a/gnu/packages/game-development.scm
> +++ b/gnu/packages/game-development.scm
> @@ -2394,6 +2394,81 @@ (define-public entt
>      (license (list license:expat        ; code
>                     license:cc-by4.0)))) ; documentation
>  
> +(define-public ericw-tools
> +  (package
> +    (name "ericw-tools")
> +    (version "0.18.1")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference (url
> "https://github.com/ericwa/ericw-tools")
> +                           (commit (string-append "v" version))))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32
> "11sap7qv0rlhw8q25azvhgjcwiql3zam09q0gim3i04cg6fkh0vp"))
> +       (patches
> +        (search-patches "ericw-tools-add-check-for-sse2-in-
> light.cc.patch"
> +                        "ericw-tools-gcc-11-pass-const-to-
> offsetof.patch"))))
> +    (build-system cmake-build-system)
> +    (arguments
> +     (list #:configure-flags #~(list "-DENABLE_LIGHTPREVIEW=OFF")
> +           #:phases
> +           #~(modify-phases %standard-phases
> +               (add-after 'unpack 'disable-copying-embree-files
> +                 (lambda _
> +                   ;; Tries to copy files from embree, disable it.
> +                   (substitute* "light/CMakeLists.txt"
> +                     (("install\\\(FILES \\$\\{EMBREE")
> +                      "#install(FILES ${EMBREE"))))
> +               (add-after 'install 'rename-binaries
> +                 (lambda _
> +                   ;; Rename binaries to prevent collisions with
> other
> +                   ;; packages.
> +                   (rename-file (string-append #$output
> "/bin/bspinfo")
> +                                (string-append #$output
> "/bin/qbspinfo"))
> +                   (rename-file (string-append #$output
> "/bin/bsputil")
> +                                (string-append #$output
> "/bin/qbsputil"))
> +                   (rename-file (string-append #$output
> "/bin/light")
> +                                (string-append #$output
> "/bin/qlight"))
> +                   (rename-file (string-append #$output "/bin/vis")
> +                                (string-append #$output
> "/bin/qvis"))))
> +               (add-after 'install-license-files 'clean-up-bin-
> directory
> +                 (lambda _
> +                   ;; Install target copies text documents to
> #$output/bin, move
> +                   ;; them to #$output/share/doc.
> +                   (delete-file (string-append #$output
> "/bin/gpl_v3.txt"))
> +                   (rename-file
> +                    (string-append #$output "/bin/changelog.txt")
> +                    (string-append #$output "/share/doc/"
> +                                   #$(package-name this-package) "-"
> +                                   #$(package-version this-package)
> +                                   "/changelog.txt"))
> +                   (rename-file
> +                    (string-append #$output "/bin/README.md")
> +                    (string-append #$output "/share/doc/"
> +                                   #$(package-name this-package) "-"
> +                                   #$(package-version this-package)
> +                                   "/README.md")))))
> +           #:tests? #f)) ; No tests
> +    (inputs (list embree-2))
> +    (home-page "https://ericwa.github.io/ericw-tools/")
> +    (synopsis "Quake/Hexen 2 map compiling tools")
I'd swap that around: Map compiling tools for Quake/Hexen 2
Toggle quote (18 lines)
> +    (description "Collection of command line utilities for building
> Quake levels
> +and working with various Quake file formats.  A brief description of
> the tools
> +are listed below.
> +
> +Included utilities:
> +
> +@itemize @bullet
> +@item qbsp - Used for turning a .map file into a playable .bsp file.
> +@item qlight - Used for lighting a level after the bsp stage.  This
> util was
> +previously known as TyrLite.
> +@item qvis - Creates the potentially visible set (PVS) for a bsp.
> +@item qbspinfo - Print stats about the data contained in a bsp file.
> +@item qbsputil - Simple tool for manipulation of bsp file data.
> +@end itemize")
> +    (license license:gpl2+)))
Descriptions should consist of complete sentences. I think the
included utilities are better summarized than explained bullet point by
bullet point, but that's just my own bias.

Cheers
J
J
James Smith wrote on 21 Sep 02:35 +0200
Re: [PATCH 1/3] gnu: Add embree-2.
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 73287@debbugs.gnu.org)
86r09dhmi2.fsf@disroot.org
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (7 lines)
> Am Sonntag, dem 15.09.2024 um 19:16 -0700 schrieb James Smith:
>> +    ;; Tries to build with SSE2 and AVX support on ARM, so disable
>> building for
>> +    ;; those systems.
> Comments should be full sentences. Also, this is a hint that it uses
> SSE2 and AVX on the platforms below too – we should disable them, as
> they won't work with every CPU.
I've investigated on disabling them, but it seems that embree 2 (and 3
for that matter) has a hard requirement for SSE2 and have updated the
comment as such. I've gone ahead and implemented your suggestions for
the other patches though and will be sending them shortly.
Toggle quote (4 lines)
>> +    (supported-systems (list "i686-linux" "x86_64-linux"))))
>> +
>
> Cheers
J
J
James Smith wrote on 21 Sep 02:38 +0200
[PATCH v2 1/3] gnu: Add embree-2.
(address . 73287@debbugs.gnu.org)(name . James Smith)(address . jsubuntuxp@disroot.org)
eeb7a4981f3393045f781e33851101ea81b52d15.1726879062.git.jsubuntuxp@disroot.org
* gnu/packages/graphics.scm: (embree-2): New variable.

Change-Id: I2b2143b4d93c402ba940d408280ef1b37ab552ea
---
gnu/packages/graphics.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

Toggle diff (44 lines)
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index edaa905c7a..171cbce24d 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -37,6 +37,7 @@
;;; Copyright © 2023 David Thompson <dthompson2@worcester.edu>
;;; Copyright © 2023 Eric Bavier <bavier@posteo.net>
;;; Copyright © 2023, 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com>
+;;; Copyright © 2024 James Smith <jsubuntuxp@disroot.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -490,6 +491,27 @@ (define-public embree-3
(base32
"1kcvz7g6j56anv9zjyd3gidxl46vipw0gg82lns12m45cd43iwxm"))))))
+(define-public embree-2
+ (package/inherit embree
+ (version "2.17.7")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference (url "https://github.com/RenderKit/embree")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name (package-name embree) version))
+ (sha256
+ (base32 "19v60zdfix33c772x6dzmhsarhafsns8qy7c2ysqr7a9j16whgql"))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments embree)
+ ((#:configure-flags configure-flags)
+ #~(append (list "-DEMBREE_MAX_ISA=NONE" "-DEMBREE_TUTORIALS=OFF")
+ #$configure-flags))))
+ (inputs (modify-inputs (package-inputs embree)
+ (replace "tbb" tbb-2020)))
+ ;; Embree requires SSE2 support, so build only for x86-based architectures.
+ (supported-systems (list "i686-linux" "x86_64-linux"))))
+
(define-public openvdb
(package
(name "openvdb")

base-commit: e9d903f146865db5948abd271a5c7e763681b4e9
--
2.46.0
J
J
James Smith wrote on 21 Sep 02:38 +0200
[PATCH v2 2/3] gnu: Add ericw-tools.
(address . 73287@debbugs.gnu.org)(name . James Smith)(address . jsubuntuxp@disroot.org)
a1ab67515ed40a088f8ae0fe33c1f077d6ff9692.1726879062.git.jsubuntuxp@disroot.org
* gnu/packages/game-development.scm: (ericw-tools): New variable.
* gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch: New file.
* gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch: New file.
* gnu/local.mk: Register patch files.

Change-Id: I896b8f781054442e4db4a7220d526b8f2878873c
---
gnu/local.mk | 3 +
gnu/packages/game-development.scm | 67 ++++++++++++++
...tools-add-check-for-sse2-in-light.cc.patch | 31 +++++++
...-tools-gcc-11-pass-const-to-offsetof.patch | 87 +++++++++++++++++++
4 files changed, 188 insertions(+)
create mode 100644 gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch
create mode 100644 gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch

Toggle diff (231 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index a092122d22..616af50410 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -67,6 +67,7 @@
# Copyright © 2024 David Elsing <david.elsing@posteo.net>
# Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se>
# Copyright © 2024 Fabio Natali <me@fabionatali.com>
+# Copyright © 2024 James Smith <jsubuntuxp@disroot.org>
#
# This file is part of GNU Guix.
#
@@ -1201,6 +1202,8 @@ dist_patch_DATA = \
%D%/packages/patches/epiphany-fix-encoding-test.patch \
%D%/packages/patches/ergodox-firmware-fix-json-target.patch \
%D%/packages/patches/ergodox-firmware-fix-numpad.patch \
+ %D%/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch \
+ %D%/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch \
%D%/packages/patches/erlang-man-path.patch \
%D%/packages/patches/esmini-use-pkgconfig.patch \
%D%/packages/patches/esmtp-add-lesmtp.patch \
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 0bae7cfe11..0b3171d1a8 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -2394,6 +2394,73 @@ (define-public entt
(license (list license:expat ; code
license:cc-by4.0)))) ; documentation
+(define-public ericw-tools
+ (package
+ (name "ericw-tools")
+ (version "0.18.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference (url "https://github.com/ericwa/ericw-tools")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "11sap7qv0rlhw8q25azvhgjcwiql3zam09q0gim3i04cg6fkh0vp"))
+ (patches
+ (search-patches "ericw-tools-add-check-for-sse2-in-light.cc.patch"
+ "ericw-tools-gcc-11-pass-const-to-offsetof.patch"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list #:configure-flags #~(list "-DENABLE_LIGHTPREVIEW=OFF")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'disable-copying-embree-files
+ (lambda _
+ ;; Tries to copy files from embree, disable it.
+ (substitute* "light/CMakeLists.txt"
+ (("install\\\(FILES \\$\\{EMBREE")
+ "#install(FILES ${EMBREE"))))
+ (add-after 'install 'rename-binaries
+ (lambda _
+ ;; Rename binaries to prevent collisions with other
+ ;; packages.
+ (rename-file (string-append #$output "/bin/bspinfo")
+ (string-append #$output "/bin/qbspinfo"))
+ (rename-file (string-append #$output "/bin/bsputil")
+ (string-append #$output "/bin/qbsputil"))
+ (rename-file (string-append #$output "/bin/light")
+ (string-append #$output "/bin/qlight"))
+ (rename-file (string-append #$output "/bin/vis")
+ (string-append #$output "/bin/qvis"))))
+ (add-after 'install-license-files 'clean-up-bin-directory
+ (lambda _
+ ;; Install target copies text documents to #$output/bin, move
+ ;; them to #$output/share/doc.
+ (delete-file (string-append #$output "/bin/gpl_v3.txt"))
+ (rename-file
+ (string-append #$output "/bin/changelog.txt")
+ (string-append #$output "/share/doc/"
+ #$(package-name this-package) "-"
+ #$(package-version this-package)
+ "/changelog.txt"))
+ (rename-file
+ (string-append #$output "/bin/README.md")
+ (string-append #$output "/share/doc/"
+ #$(package-name this-package) "-"
+ #$(package-version this-package)
+ "/README.md")))))
+ #:tests? #f)) ; No tests
+ (inputs (list embree-2))
+ (home-page "https://ericwa.github.io/ericw-tools/")
+ (synopsis "Map compiling tools for Quake/Hexen 2")
+ (description "A collection of command line utilities used for building
+Quake maps as well as working with various Quake file formats. The utilities
+include @command{qbsp} for building the geometry, @command{qvis} for
+calculating visibility, @command{qlight} for lighting, @command{bspinfo} for
+getting information, and @command{bsputil} for basic editing of data in a map
+file.")
+ (license license:gpl2+)))
+
(define-public eureka
(package
(name "eureka")
diff --git a/gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch b/gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch
new file mode 100644
index 0000000000..4c95b8570d
--- /dev/null
+++ b/gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch
@@ -0,0 +1,31 @@
+From 982ef5276bb231ded12c45a686b0875594175774 Mon Sep 17 00:00:00 2001
+From: Bryan Haley <bryanmhaley@gmail.com>
+Date: Mon, 28 Mar 2022 22:05:28 -0700
+Subject: [PATCH] Add check for SSE2 in light.cc (#328)
+
+---
+ light/light.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/light/light.cc b/light/light.cc
+index 7e23d040f..c00844643 100644
+--- a/light/light.cc
++++ b/light/light.cc
+@@ -33,7 +33,7 @@
+ #include <common/polylib.hh>
+ #include <common/bsputils.hh>
+
+-#ifdef HAVE_EMBREE
++#if defined(HAVE_EMBREE) && defined (__SSE2__)
+ #include <xmmintrin.h>
+ //#include <pmmintrin.h>
+ #endif
+@@ -255,7 +255,7 @@ LightThread(void *arg)
+ {
+ const mbsp_t *bsp = (const mbsp_t *)arg;
+
+-#ifdef HAVE_EMBREE
++#if defined(HAVE_EMBREE) && defined (__SSE2__)
+ _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
+ // _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
+ #endif
diff --git a/gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch b/gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch
new file mode 100644
index 0000000000..6da4179a9e
--- /dev/null
+++ b/gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch
@@ -0,0 +1,87 @@
+From c9570260fa895dde5a21272d76f9a3b05d59efdd Mon Sep 17 00:00:00 2001
+From: Eric Wasylishen <ewasylishen@gmail.com>
+Date: Sun, 30 May 2021 23:12:17 -0600
+Subject: [PATCH] gcc 11: pass constant to offsetof
+
+---
+ common/polylib.cc | 5 ++++-
+ qbsp/util.cc | 5 ++++-
+ qbsp/winding.cc | 4 +++-
+ vis/vis.cc | 10 ++++++++--
+ 4 files changed, 19 insertions(+), 5 deletions(-)
+
+diff --git a/common/polylib.cc b/common/polylib.cc
+index 6397b3107..c8e1afbff 100644
+--- a/common/polylib.cc
++++ b/common/polylib.cc
+@@ -230,7 +230,10 @@ polylib::CopyWinding(const winding_t * w)
+ int size;
+ winding_t *c;
+
+- size = offsetof(winding_t, p[w->numpoints]);
++ //size = offsetof(winding_t, p[w->numpoints]);
++ size = offsetof(winding_t, p[0]);
++ size += w->numpoints * sizeof(w->p[0]);
++
+ c = static_cast<winding_t *>(malloc(size));
+ memcpy(c, w, size);
+ return c;
+diff --git a/qbsp/util.cc b/qbsp/util.cc
+index e8baf7205..16c9077f1 100644
+--- a/qbsp/util.cc
++++ b/qbsp/util.cc
+@@ -53,7 +53,10 @@ AllocMem(int Type, int cElements, bool fZero)
+ if (cElements > MAX_POINTS_ON_WINDING)
+ Error("Too many points (%d) on winding (%s)", cElements, __func__);
+
+- cSize = offsetof(winding_t, points[cElements]) + sizeof(int);
++ //cSize = offsetof(winding_t, points[cElements]) + sizeof(int);
++ cSize = offsetof(winding_t, points[0]);
++ cSize += cElements * sizeof(static_cast<winding_t*>(nullptr)->points[0]);
++ cSize += sizeof(int);
+
+ // Set cElements to 1 so bookkeeping works OK
+ cElements = 1;
+diff --git a/qbsp/winding.cc b/qbsp/winding.cc
+index 1af1d096c..6e286c387 100644
+--- a/qbsp/winding.cc
++++ b/qbsp/winding.cc
+@@ -106,7 +106,9 @@ CopyWinding(const winding_t *w)
+ winding_t *c;
+
+ c = (winding_t *)AllocMem(WINDING, w->numpoints, false);
+- size = offsetof(winding_t, points[w->numpoints]);
++ //size = offsetof(winding_t, points[w->numpoints]);
++ size = offsetof(winding_t, points[0]);
++ size += w->numpoints * sizeof(w->points[0]);
+ memcpy(c, w, size);
+
+ return c;
+diff --git a/vis/vis.cc b/vis/vis.cc
+index 9fb0ea9ea..ec43a8a5f 100644
+--- a/vis/vis.cc
++++ b/vis/vis.cc
+@@ -127,7 +127,10 @@ NewWinding(int points)
+ if (points > MAX_WINDING)
+ Error("%s: %i points", __func__, points);
+
+- size = offsetof(winding_t, points[points]);
++ //size = offsetof(winding_t, points[points]);
++ size = offsetof(winding_t, points[0]);
++ size += points * sizeof(w->points[0]);
++
+ w = static_cast<winding_t *>(malloc(size));
+ memset(w, 0, size);
+
+@@ -178,7 +181,10 @@ CopyWinding(const winding_t * w)
+ int size;
+ winding_t *c;
+
+- size = offsetof(winding_t, points[w->numpoints]);
++ //size = offsetof(winding_t, points[w->numpoints]);
++ size = offsetof(winding_t, points[0]);
++ size += w->numpoints * sizeof(w->points[0]);
++
+ c = static_cast<winding_t *>(malloc(size));
+ memcpy(c, w, size);
+ return c;
--
2.46.0
J
J
James Smith wrote on 21 Sep 02:38 +0200
[PATCH v2 3/3] gnu: Add trenchbroom.
(address . 73287@debbugs.gnu.org)(name . James Smith)(address . jsubuntuxp@disroot.org)
a6d105c2064d8e4a1cfd9a4c675deb00876da5ad.1726879062.git.jsubuntuxp@disroot.org
* gnu/packages/game-development.scm: (trenchbroom): New variable.

Change-Id: I50691b1db2010cd8c2c7f04bdfd80278b9e14aed
---
gnu/packages/game-development.scm | 93 +++++++++++++++++++++++++++++++
1 file changed, 93 insertions(+)

Toggle diff (133 lines)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 0b3171d1a8..4e03734072 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -91,12 +91,14 @@ (define-module (gnu packages game-development)
#:use-module (gnu packages graphviz)
#:use-module (gnu packages gtk)
#:use-module (gnu packages guile)
+ #:use-module (gnu packages haskell-xyz)
#:use-module (gnu packages icu4c)
#:use-module (gnu packages image)
#:use-module (gnu packages linux)
#:use-module (gnu packages llvm)
#:use-module (gnu packages lua)
#:use-module (gnu packages m4)
+ #:use-module (gnu packages maths)
#:use-module (gnu packages mp3)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages music)
@@ -104,6 +106,7 @@ (define-module (gnu packages game-development)
#:use-module (gnu packages networking)
#:use-module (gnu packages pcre)
#:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages pretty-print)
#:use-module (gnu packages pulseaudio)
#:use-module (gnu packages python)
#:use-module (gnu packages python-crypto)
@@ -121,6 +124,7 @@ (define-module (gnu packages game-development)
#:use-module (gnu packages texinfo)
#:use-module (gnu packages textutils)
#:use-module (gnu packages tls)
+ #:use-module (gnu packages version-control)
#:use-module (gnu packages video)
#:use-module (gnu packages vulkan)
#:use-module (gnu packages web)
@@ -674,6 +678,95 @@ (define-public tiled
;; under BSD-2.
(license license:gpl2+)))
+(define-public trenchbroom
+ (package
+ (name "trenchbroom")
+ (version "2024.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/TrenchBroom/TrenchBroom")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1xysz7rkjy11wp9sshdqllmlw8qb65f1zlljpw3q22483szwzxnb"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list #:configure-flags
+ #~(list "-DCMAKE_BUILD_TYPE=Release" "-G" "Unix Makefiles"
+ "-DCMAKE_PREFIX_PATH=cmake/packages"
+ (string-append "-DFREEIMAGE_INCLUDE_PATH="
+ #$freeimage "/include")
+ (string-append "-DFREEIMAGE_LIBRARY="
+ #$freeimage "/lib/libfreeimage.so")
+ (string-append "-Dfreetype_INCLUDE_DIR="
+ #$freetype "/include/freetype2")
+ (string-append "-Dfreetype_LIBRARY="
+ #$freetype "/lib/libfreetype.so"))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'fix-build-system
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ (("set\\(CMAKE_TOOLCHAIN_FILE")
+ "#set(CMAKE_TOOLCHAIN_FILE"))
+ (substitute* "app/CMakeLists.txt"
+ (("/usr") #$output))))
+ (add-before 'build 'set-environment-variables
+ (lambda _
+ ;; Set home so fontconfig can write cache.
+ (setenv "HOME" (getenv "TEMP"))
+ ;; Set QT platform for offscreen rendering.
+ (setenv "QT_QPA_PLATFORM" "offscreen")
+ (setenv "XDG_RUNTIME_DIR" (getenv "TEMP"))))
+ (add-after 'install 'wrap-trenchbroom
+ (lambda _
+ (wrap-program (string-append #$output "/bin/trenchbroom")
+ ;; TrenchBroom needs $XDG_DATA_DIRS set to find game
+ ;; configs.
+ `("XDG_DATA_DIRS" ":" prefix
+ (,(string-append #$output "/share")))
+ ;; TrenchBroom also doesn't work well with Wayland backend.
+ '("QT_QPA_PLATFORM" = ("xcb")))))
+ (add-after 'install 'install-desktop-file
+ (lambda _
+ (make-desktop-entry-file
+ (string-append #$output "/share/applications/"
+ #$(package-name this-package) ".desktop")
+ #:name "TrenchBroom"
+ #:comment #$(package-synopsis this-package)
+ #:exec #$name
+ #:icon #$name
+ #:categories '("Development")
+ #:keywords '("quake" "level" "editor")))))
+ #:tests? #f)) ; No tests.
+ (inputs
+ (list assimp
+ bash-minimal
+ catch2
+ fmt
+ freeglut
+ freeimage
+ freetype
+ glew
+ glm
+ glu
+ libxxf86vm
+ mesa
+ miniz
+ qtbase-5
+ qtsvg-5
+ tinyxml2))
+ (native-inputs (list git pandoc python p7zip))
+ (home-page "https://kristianduske.com/trenchbroom/")
+ (synopsis "Cross-platform level editor for Quake-engine based games")
+ (description "TrenchBroom is a cross-platform level editor for
+Quake-engine based games. It supports Quake, Quake 2, Hexen 2, as well as
+other games. TrenchBroom provides many simple and advanced tools to create
+complex and interesting levels.")
+ (license license:gpl3+)))
+
(define-public tsukundere
(package
(name "tsukundere")
--
2.46.0
J
J
James Smith wrote on 27 Oct 15:30 +0100
Re: [PATCH 0/3] Add ericw-tools and TrenchBroom.
(address . 73287@debbugs.gnu.org)
86msipd3es.fsf@disroot.org
Hi,

I've waited about a month after sending a v2 and have gotten no
responses. Are there any more changes I need to make for a v3, or do I
just need to rebase onto current master?

Currently, the blocker I'm aware of is Embree 2 has a hard requirement
for SSE2. I'm thinking about mentioning it in the description when
sending v3, but I'd like to get a second opinion.

Thanks,

James
J
J
James Smith wrote 4 days ago
[PATCH v3 1/3] gnu: Add embree-2.
(address . 73287@debbugs.gnu.org)(name . James Smith)(address . jsubuntuxp@disroot.org)
d0c100ed967044d204abbdc627bb8f66d95e7304.1730611534.git.jsubuntuxp@disroot.org
* gnu/packages/graphics.scm: (embree-2): New variable.

Change-Id: I2b2143b4d93c402ba940d408280ef1b37ab552ea
---
gnu/packages/graphics.scm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

Toggle diff (45 lines)
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 8686cac7f7..b794c14cd8 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -37,6 +37,7 @@
;;; Copyright © 2023 David Thompson <dthompson2@worcester.edu>
;;; Copyright © 2023 Eric Bavier <bavier@posteo.net>
;;; Copyright © 2023, 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com>
+;;; Copyright © 2024 James Smith <jsubuntuxp@disroot.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -490,6 +491,30 @@ (define-public embree-3
(base32
"1kcvz7g6j56anv9zjyd3gidxl46vipw0gg82lns12m45cd43iwxm"))))))
+(define-public embree-2
+ (package/inherit embree
+ (version "2.17.7")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference (url "https://github.com/RenderKit/embree")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name (package-name embree) version))
+ (sha256
+ (base32 "19v60zdfix33c772x6dzmhsarhafsns8qy7c2ysqr7a9j16whgql"))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments embree)
+ ((#:configure-flags configure-flags)
+ #~(append (list "-DEMBREE_MAX_ISA=NONE" "-DEMBREE_TUTORIALS=OFF")
+ #$configure-flags))))
+ (inputs (modify-inputs (package-inputs embree)
+ (replace "tbb" tbb-2020)))
+ ;; Embree requires SSE2 support, so build only for x86-based architectures.
+ (supported-systems (list "i686-linux" "x86_64-linux"))
+ (description (string-append (package-description embree) "
+
+Please note that this version requires a processor with SSE2 support."))))
+
(define-public openvdb
(package
(name "openvdb")
--
2.46.0
J
J
James Smith wrote 4 days ago
[PATCH v3 2/3] gnu: Add ericw-tools.
(address . 73287@debbugs.gnu.org)(name . James Smith)(address . jsubuntuxp@disroot.org)
f35aec2d570691aac2a7074c2b39756452829f91.1730611534.git.jsubuntuxp@disroot.org
* gnu/packages/game-development.scm: (ericw-tools): New variable.
* gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch: New file.
* gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch: New file.
* gnu/local.mk: Register patch files.

Change-Id: I896b8f781054442e4db4a7220d526b8f2878873c
---
gnu/local.mk | 3 +
gnu/packages/game-development.scm | 67 ++++++++++++++
...tools-add-check-for-sse2-in-light.cc.patch | 31 +++++++
...-tools-gcc-11-pass-const-to-offsetof.patch | 87 +++++++++++++++++++
4 files changed, 188 insertions(+)
create mode 100644 gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch
create mode 100644 gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch

Toggle diff (231 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 5b28de35f2..f2a620ffdd 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -67,6 +67,7 @@
# Copyright © 2024 David Elsing <david.elsing@posteo.net>
# Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se>
# Copyright © 2024 Fabio Natali <me@fabionatali.com>
+# Copyright © 2024 James Smith <jsubuntuxp@disroot.org>
#
# This file is part of GNU Guix.
#
@@ -1208,6 +1209,8 @@ dist_patch_DATA = \
%D%/packages/patches/epiphany-fix-encoding-test.patch \
%D%/packages/patches/ergodox-firmware-fix-json-target.patch \
%D%/packages/patches/ergodox-firmware-fix-numpad.patch \
+ %D%/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch \
+ %D%/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch \
%D%/packages/patches/erlang-man-path.patch \
%D%/packages/patches/esmini-use-pkgconfig.patch \
%D%/packages/patches/esmtp-add-lesmtp.patch \
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index ee869c9cc5..7d168151d2 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -2399,6 +2399,73 @@ (define-public entt
(license (list license:expat ; code
license:cc-by4.0)))) ; documentation
+(define-public ericw-tools
+ (package
+ (name "ericw-tools")
+ (version "0.18.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference (url "https://github.com/ericwa/ericw-tools")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "11sap7qv0rlhw8q25azvhgjcwiql3zam09q0gim3i04cg6fkh0vp"))
+ (patches
+ (search-patches "ericw-tools-add-check-for-sse2-in-light.cc.patch"
+ "ericw-tools-gcc-11-pass-const-to-offsetof.patch"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list #:configure-flags #~(list "-DENABLE_LIGHTPREVIEW=OFF")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'disable-copying-embree-files
+ (lambda _
+ ;; Tries to copy files from embree, disable it.
+ (substitute* "light/CMakeLists.txt"
+ (("install\\\(FILES \\$\\{EMBREE")
+ "#install(FILES ${EMBREE"))))
+ (add-after 'install 'rename-binaries
+ (lambda _
+ ;; Rename binaries to prevent collisions with other
+ ;; packages.
+ (rename-file (string-append #$output "/bin/bspinfo")
+ (string-append #$output "/bin/qbspinfo"))
+ (rename-file (string-append #$output "/bin/bsputil")
+ (string-append #$output "/bin/qbsputil"))
+ (rename-file (string-append #$output "/bin/light")
+ (string-append #$output "/bin/qlight"))
+ (rename-file (string-append #$output "/bin/vis")
+ (string-append #$output "/bin/qvis"))))
+ (add-after 'install-license-files 'clean-up-bin-directory
+ (lambda _
+ ;; Install target copies text documents to #$output/bin, move
+ ;; them to #$output/share/doc.
+ (delete-file (string-append #$output "/bin/gpl_v3.txt"))
+ (rename-file
+ (string-append #$output "/bin/changelog.txt")
+ (string-append #$output "/share/doc/"
+ #$(package-name this-package) "-"
+ #$(package-version this-package)
+ "/changelog.txt"))
+ (rename-file
+ (string-append #$output "/bin/README.md")
+ (string-append #$output "/share/doc/"
+ #$(package-name this-package) "-"
+ #$(package-version this-package)
+ "/README.md")))))
+ #:tests? #f)) ; No tests
+ (inputs (list embree-2))
+ (home-page "https://ericwa.github.io/ericw-tools/")
+ (synopsis "Map compiling tools for Quake/Hexen 2")
+ (description "A collection of command line utilities used for building
+Quake maps as well as working with various Quake file formats. The utilities
+include @command{qbsp} for building the geometry, @command{qvis} for
+calculating visibility, @command{qlight} for lighting, @command{bspinfo} for
+getting information, and @command{bsputil} for basic editing of data in a map
+file.")
+ (license license:gpl2+)))
+
(define-public eureka
(package
(name "eureka")
diff --git a/gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch b/gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch
new file mode 100644
index 0000000000..4c95b8570d
--- /dev/null
+++ b/gnu/packages/patches/ericw-tools-add-check-for-sse2-in-light.cc.patch
@@ -0,0 +1,31 @@
+From 982ef5276bb231ded12c45a686b0875594175774 Mon Sep 17 00:00:00 2001
+From: Bryan Haley <bryanmhaley@gmail.com>
+Date: Mon, 28 Mar 2022 22:05:28 -0700
+Subject: [PATCH] Add check for SSE2 in light.cc (#328)
+
+---
+ light/light.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/light/light.cc b/light/light.cc
+index 7e23d040f..c00844643 100644
+--- a/light/light.cc
++++ b/light/light.cc
+@@ -33,7 +33,7 @@
+ #include <common/polylib.hh>
+ #include <common/bsputils.hh>
+
+-#ifdef HAVE_EMBREE
++#if defined(HAVE_EMBREE) && defined (__SSE2__)
+ #include <xmmintrin.h>
+ //#include <pmmintrin.h>
+ #endif
+@@ -255,7 +255,7 @@ LightThread(void *arg)
+ {
+ const mbsp_t *bsp = (const mbsp_t *)arg;
+
+-#ifdef HAVE_EMBREE
++#if defined(HAVE_EMBREE) && defined (__SSE2__)
+ _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
+ // _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
+ #endif
diff --git a/gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch b/gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch
new file mode 100644
index 0000000000..6da4179a9e
--- /dev/null
+++ b/gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch
@@ -0,0 +1,87 @@
+From c9570260fa895dde5a21272d76f9a3b05d59efdd Mon Sep 17 00:00:00 2001
+From: Eric Wasylishen <ewasylishen@gmail.com>
+Date: Sun, 30 May 2021 23:12:17 -0600
+Subject: [PATCH] gcc 11: pass constant to offsetof
+
+---
+ common/polylib.cc | 5 ++++-
+ qbsp/util.cc | 5 ++++-
+ qbsp/winding.cc | 4 +++-
+ vis/vis.cc | 10 ++++++++--
+ 4 files changed, 19 insertions(+), 5 deletions(-)
+
+diff --git a/common/polylib.cc b/common/polylib.cc
+index 6397b3107..c8e1afbff 100644
+--- a/common/polylib.cc
++++ b/common/polylib.cc
+@@ -230,7 +230,10 @@ polylib::CopyWinding(const winding_t * w)
+ int size;
+ winding_t *c;
+
+- size = offsetof(winding_t, p[w->numpoints]);
++ //size = offsetof(winding_t, p[w->numpoints]);
++ size = offsetof(winding_t, p[0]);
++ size += w->numpoints * sizeof(w->p[0]);
++
+ c = static_cast<winding_t *>(malloc(size));
+ memcpy(c, w, size);
+ return c;
+diff --git a/qbsp/util.cc b/qbsp/util.cc
+index e8baf7205..16c9077f1 100644
+--- a/qbsp/util.cc
++++ b/qbsp/util.cc
+@@ -53,7 +53,10 @@ AllocMem(int Type, int cElements, bool fZero)
+ if (cElements > MAX_POINTS_ON_WINDING)
+ Error("Too many points (%d) on winding (%s)", cElements, __func__);
+
+- cSize = offsetof(winding_t, points[cElements]) + sizeof(int);
++ //cSize = offsetof(winding_t, points[cElements]) + sizeof(int);
++ cSize = offsetof(winding_t, points[0]);
++ cSize += cElements * sizeof(static_cast<winding_t*>(nullptr)->points[0]);
++ cSize += sizeof(int);
+
+ // Set cElements to 1 so bookkeeping works OK
+ cElements = 1;
+diff --git a/qbsp/winding.cc b/qbsp/winding.cc
+index 1af1d096c..6e286c387 100644
+--- a/qbsp/winding.cc
++++ b/qbsp/winding.cc
+@@ -106,7 +106,9 @@ CopyWinding(const winding_t *w)
+ winding_t *c;
+
+ c = (winding_t *)AllocMem(WINDING, w->numpoints, false);
+- size = offsetof(winding_t, points[w->numpoints]);
++ //size = offsetof(winding_t, points[w->numpoints]);
++ size = offsetof(winding_t, points[0]);
++ size += w->numpoints * sizeof(w->points[0]);
+ memcpy(c, w, size);
+
+ return c;
+diff --git a/vis/vis.cc b/vis/vis.cc
+index 9fb0ea9ea..ec43a8a5f 100644
+--- a/vis/vis.cc
++++ b/vis/vis.cc
+@@ -127,7 +127,10 @@ NewWinding(int points)
+ if (points > MAX_WINDING)
+ Error("%s: %i points", __func__, points);
+
+- size = offsetof(winding_t, points[points]);
++ //size = offsetof(winding_t, points[points]);
++ size = offsetof(winding_t, points[0]);
++ size += points * sizeof(w->points[0]);
++
+ w = static_cast<winding_t *>(malloc(size));
+ memset(w, 0, size);
+
+@@ -178,7 +181,10 @@ CopyWinding(const winding_t * w)
+ int size;
+ winding_t *c;
+
+- size = offsetof(winding_t, points[w->numpoints]);
++ //size = offsetof(winding_t, points[w->numpoints]);
++ size = offsetof(winding_t, points[0]);
++ size += w->numpoints * sizeof(w->points[0]);
++
+ c = static_cast<winding_t *>(malloc(size));
+ memcpy(c, w, size);
+ return c;
--
2.46.0
J
J
James Smith wrote 4 days ago
[PATCH v3 3/3] gnu: Add trenchbroom.
(address . 73287@debbugs.gnu.org)(name . James Smith)(address . jsubuntuxp@disroot.org)
03e5be8ee5905376f9caa04c117de8edb9a41aa8.1730611534.git.jsubuntuxp@disroot.org
* gnu/packages/game-development.scm: (trenchbroom): New variable.

Change-Id: I50691b1db2010cd8c2c7f04bdfd80278b9e14aed
---
gnu/packages/game-development.scm | 93 +++++++++++++++++++++++++++++++
1 file changed, 93 insertions(+)

Toggle diff (133 lines)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 7d168151d2..1c40fac0e2 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -91,12 +91,14 @@ (define-module (gnu packages game-development)
#:use-module (gnu packages graphviz)
#:use-module (gnu packages gtk)
#:use-module (gnu packages guile)
+ #:use-module (gnu packages haskell-xyz)
#:use-module (gnu packages icu4c)
#:use-module (gnu packages image)
#:use-module (gnu packages linux)
#:use-module (gnu packages llvm)
#:use-module (gnu packages lua)
#:use-module (gnu packages m4)
+ #:use-module (gnu packages maths)
#:use-module (gnu packages mp3)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages music)
@@ -104,6 +106,7 @@ (define-module (gnu packages game-development)
#:use-module (gnu packages networking)
#:use-module (gnu packages pcre)
#:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages pretty-print)
#:use-module (gnu packages pulseaudio)
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
@@ -122,6 +125,7 @@ (define-module (gnu packages game-development)
#:use-module (gnu packages texinfo)
#:use-module (gnu packages textutils)
#:use-module (gnu packages tls)
+ #:use-module (gnu packages version-control)
#:use-module (gnu packages video)
#:use-module (gnu packages vulkan)
#:use-module (gnu packages web)
@@ -679,6 +683,95 @@ (define-public tiled
;; under BSD-2.
(license license:gpl2+)))
+(define-public trenchbroom
+ (package
+ (name "trenchbroom")
+ (version "2024.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/TrenchBroom/TrenchBroom")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1xysz7rkjy11wp9sshdqllmlw8qb65f1zlljpw3q22483szwzxnb"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list #:configure-flags
+ #~(list "-DCMAKE_BUILD_TYPE=Release" "-G" "Unix Makefiles"
+ "-DCMAKE_PREFIX_PATH=cmake/packages"
+ (string-append "-DFREEIMAGE_INCLUDE_PATH="
+ #$freeimage "/include")
+ (string-append "-DFREEIMAGE_LIBRARY="
+ #$freeimage "/lib/libfreeimage.so")
+ (string-append "-Dfreetype_INCLUDE_DIR="
+ #$freetype "/include/freetype2")
+ (string-append "-Dfreetype_LIBRARY="
+ #$freetype "/lib/libfreetype.so"))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'fix-build-system
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ (("set\\(CMAKE_TOOLCHAIN_FILE")
+ "#set(CMAKE_TOOLCHAIN_FILE"))
+ (substitute* "app/CMakeLists.txt"
+ (("/usr") #$output))))
+ (add-before 'build 'set-environment-variables
+ (lambda _
+ ;; Set home so fontconfig can write cache.
+ (setenv "HOME" (getenv "TEMP"))
+ ;; Set QT platform for offscreen rendering.
+ (setenv "QT_QPA_PLATFORM" "offscreen")
+ (setenv "XDG_RUNTIME_DIR" (getenv "TEMP"))))
+ (add-after 'install 'wrap-trenchbroom
+ (lambda _
+ (wrap-program (string-append #$output "/bin/trenchbroom")
+ ;; TrenchBroom needs $XDG_DATA_DIRS set to find game
+ ;; configs.
+ `("XDG_DATA_DIRS" ":" prefix
+ (,(string-append #$output "/share")))
+ ;; TrenchBroom also doesn't work well with Wayland backend.
+ '("QT_QPA_PLATFORM" = ("xcb")))))
+ (add-after 'install 'install-desktop-file
+ (lambda _
+ (make-desktop-entry-file
+ (string-append #$output "/share/applications/"
+ #$(package-name this-package) ".desktop")
+ #:name "TrenchBroom"
+ #:comment #$(package-synopsis this-package)
+ #:exec #$name
+ #:icon #$name
+ #:categories '("Development")
+ #:keywords '("quake" "level" "editor")))))
+ #:tests? #f)) ; No tests.
+ (inputs
+ (list assimp
+ bash-minimal
+ catch2
+ fmt
+ freeglut
+ freeimage
+ freetype
+ glew
+ glm
+ glu
+ libxxf86vm
+ mesa
+ miniz
+ qtbase-5
+ qtsvg-5
+ tinyxml2))
+ (native-inputs (list git pandoc python p7zip))
+ (home-page "https://kristianduske.com/trenchbroom/")
+ (synopsis "Cross-platform level editor for Quake-engine based games")
+ (description "TrenchBroom is a cross-platform level editor for
+Quake-engine based games. It supports Quake, Quake 2, Hexen 2, as well as
+other games. TrenchBroom provides many simple and advanced tools to create
+complex and interesting levels.")
+ (license license:gpl3+)))
+
(define-public tsukundere
(package
(name "tsukundere")
--
2.46.0
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 73287@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 73287
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch