unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / Atom feed
* [bug#44039] [PATCH] gnu: Add slade.
@ 2020-10-16 18:43 James Smith
  2020-10-16 21:07 ` Tobias Geerinckx-Rice via Guix-patches via
  0 siblings, 1 reply; 4+ messages in thread
From: James Smith @ 2020-10-16 18:43 UTC (permalink / raw)
  To: 44039; +Cc: James Smith

* gnu/packages/game-development.scm (slade): New variable.
---
 gnu/packages/game-development.scm | 56 ++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 96ed2f9da4..55d60d03a3 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
+;;; Copyright © 2020 James Smith <jsubuntuxp@disroot.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -37,7 +38,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages game-development)
-  #:use-module (srfi srfi-1)
+  #:use-module ((srfi srfi-1) #:hide (zip))
   #:use-module (ice-9 match)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
@@ -94,6 +95,7 @@
   #:use-module (gnu packages tls)
   #:use-module (gnu packages video)
   #:use-module (gnu packages web)
+  #:use-module (gnu packages wxwidgets)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
@@ -2505,3 +2507,55 @@ fully dynamic omnidirectional shadows, global illumination, HDR lighting,
 deferred shading, morphological / temporal / multisample anti-aliasing, and
 much more.")
       (license license:zlib))))
+
+(define-public slade
+  (package
+    (name "slade")
+    (version "3.1.12a")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/sirjuddington/SLADE")
+             (commit version)))
+       (sha256 (base32 "1q37pqibnrbdd7zjx7h2kfi0q9nc63cc96q9ya4x3fvsrf64n6yd"))
+       (file-name (git-file-name name version))))
+    (build-system cmake-build-system)
+    (arguments
+     '(#:configure-flags
+       (list "-DWX_GTK3=ON" "-DNO_WEBVIEW=ON"
+             (string-append "-DWITH_WXPATH="
+                            (assoc-ref %build-inputs "wxwidgets") "/bin")
+             (string-append "-DwxWidgets_LIBRARIES="
+                            (assoc-ref %build-inputs "wxwidgets") "/lib"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'patch-gdk-backend
+           ;; Set GDK_BACKEND to x11 to prevent crash on Wayland.
+           ;; See https://github.com/sirjuddington/SLADE/issues/1097 for details.
+           (lambda* _
+             (wrap-program
+                 (string-append (assoc-ref %outputs "out") "/bin/slade")
+               `("GDK_BACKEND" "" = (,"x11")))
+             #t)))
+       #:tests? #f))
+    (inputs
+     `(("curl" ,curl)
+       ("fluidsynth" ,fluidsynth)
+       ("freeimage" ,freeimage)
+       ("ftgl" ,ftgl)
+       ("glew" ,glew)
+       ("gtk+" ,gtk+)
+       ("sfml" ,sfml)
+       ("wxwidgets" ,wxwidgets-3.1)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("which" ,which)
+       ("zip" ,zip)))
+    (home-page "https://slade.mancubus.net")
+    (synopsis "Doom game data editor")
+    (description "SLADE3 is a modern editor for Doom-engine based games and
+source ports.  It has the ability to view, modify, and write many different game-
+specific formats, and even convert between some of them, or from/to other generic
+formats such as PNG.")
+    (license license:gpl2)))
-- 
2.28.0





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#44039] [PATCH] gnu: Add slade.
  2020-10-16 18:43 [bug#44039] [PATCH] gnu: Add slade James Smith
@ 2020-10-16 21:07 ` Tobias Geerinckx-Rice via Guix-patches via
  2020-10-16 21:14   ` Tobias Geerinckx-Rice via Guix-patches via
  2020-10-17  0:41   ` James Smith
  0 siblings, 2 replies; 4+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-10-16 21:07 UTC (permalink / raw)
  To: James Smith; +Cc: 44039

[-- Attachment #1: Type: text/plain, Size: 2980 bytes --]

James,

Thanks for the patch!

James Smith 写道:
> +(define-public slade

Let's keep modules vaguely alphabetical.  Could you move this 
above ‘tiled’?

> +         (add-after 'install 'patch-gdk-backend

Nitpick: it's not patching anything.

> +           ;; Set GDK_BACKEND to x11 to prevent crash on 
> Wayland.
> +           ;; See 
> https://github.com/sirjuddington/SLADE/issues/1097 for details.
> +           (lambda* _

No need for lambda* over lambda when you're not using any of its 
extended features....

> +                 (string-append (assoc-ref %outputs "out") 
> "/bin/slade")

...however, you *could* use its keyword arguments to get rid of 
this ugly %outputs pseudo-global.  See below.

> +               `("GDK_BACKEND" "" = (,"x11")))

This works but the "" and , are redundant.

All in all, the phase can be rewritten as:

         (add-after 'install 'wrap-with-x11-gdk-backend
           ;; Set GDK_BACKEND to x11 to prevent crash on Wayland. 
           See
           ;; https://github.com/sirjuddington/SLADE/issues/1097 
           for details.
           (lambda* (#:key outputs #:allow-other-keys)
             (wrap-program
                 (string-append (assoc-ref outputs "out") 
                 "/bin/slade")
               '("GDK_BACKEND" = ("x11")))
             #t)))

> +       #:tests? #f))

Are there no tests at all?  If so, note in a comment:

       #:tests? #f))                    ; no test suite

Same if there are tests but they're broken or pointless (linting 
etc.).

There's one more problem:

  set(ZIP_COMMAND "${ZIPTOOL_ZIP_EXECUTABLE}" -X -UN=UTF8 -9 -r \
    "${CMAKE_BINARY_DIR}/slade.pk3" .)

Even zip -X won't create an identical archive on every run.  There 
doesn't seem to be an option to do so.  The result:

  --- /gnu/store/aaa-slade-3.1.12a/share/slade3/slade.pk3
  +++ /gnu/store/bbb-slade-3.1.12a/share/slade3/slade.pk3
   Zip file size: 3624588 bytes, number of entries: 768
  -drwxr-xr-x  3.0 unx  0 b- stor 20-Oct-16 19:17 html/
  -drwxr-xr-x  3.0 unx  0 b- stor 20-Oct-16 19:17 config/
  -drwxr-xr-x  3.0 unx  0 b- stor 20-Oct-16 19:17 config/colours/
  +drwxr-xr-x  3.0 unx  0 b- stor 20-Oct-16 19:31 html/
  +drwxr-xr-x  3.0 unx  0 b- stor 20-Oct-16 19:31 config/
  +drwxr-xr-x  3.0 unx  0 b- stor 20-Oct-16 19:31 config/colours/

This is not ideal: Guix aims for reproducible builds.

The following made multiple builds on one machine identical, but 
was not consistent between file systems, probably due to readdir 
order:

+ (add-before 'build 'reset-slade.pk3-timestamps
+   ;; This appears sufficient to make slade.pk3 reproducible.
+   (lambda _
+     (invoke "find" "../source/dist/res" "-exec" "touch"
+             "--no-dereference" "-t" "197001010000.00" "{}" 
"+")))

I suppose I could try using find to sort the files before invoking 
zip, or something.  Thoughts?

Kind regards,

T G-R

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#44039] [PATCH] gnu: Add slade.
  2020-10-16 21:07 ` Tobias Geerinckx-Rice via Guix-patches via
@ 2020-10-16 21:14   ` Tobias Geerinckx-Rice via Guix-patches via
  2020-10-17  0:41   ` James Smith
  1 sibling, 0 replies; 4+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-10-16 21:14 UTC (permalink / raw)
  To: 44039; +Cc: jsubuntuxp


[-- Attachment #1.1: Type: text/plain, Size: 112 bytes --]

Tobias Geerinckx-Rice via Guix-patches via 写道:
> All in all, the phase can be rewritten as:

Grumble:

[-- Attachment #1.2: Type: text/plain, Size: 454 bytes --]

         (add-after 'install 'patch-gdk-backend
           ;; Set GDK_BACKEND to x11 to prevent crash on Wayland. 
           See
           ;; https://github.com/sirjuddington/SLADE/issues/1097 
           for details.
           (lambda* (#:key outputs #:allow-other-keys)
             (wrap-program
                 (string-append (assoc-ref outputs "out") 
                 "/bin/slade")
               '("GDK_BACKEND" = ("x11")))
             #t)))

[-- Attachment #1.3: Type: text/plain, Size: 22 bytes --]


Kind regards,

T G-R

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#44039] [PATCH] gnu: Add slade.
  2020-10-16 21:07 ` Tobias Geerinckx-Rice via Guix-patches via
  2020-10-16 21:14   ` Tobias Geerinckx-Rice via Guix-patches via
@ 2020-10-17  0:41   ` James Smith
  1 sibling, 0 replies; 4+ messages in thread
From: James Smith @ 2020-10-17  0:41 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: 44039, jsubuntuxp

[-- Attachment #1: Type: text/plain, Size: 3032 bytes --]

Tobias,

On Fri, 16 Oct 2020 14:07:46 -0700,
Tobias Geerinckx-Rice wrote:

>  
>> +(define-public slade
>> 
> Let's keep modules vaguely alphabetical.  Could you move this above
> 
> ‘tiled’?
> 
Sure thing, I didn't see anything in the manual about sorting alphabetically and
other definitions weren't in order either.

>  
>> +         (add-after 'install 'patch-gdk-backend
>> 
> Nitpick: it's not patching anything.
> 
Now that you point that out, patch wasn't the word I was looking for.

>  
>> +               `("GDK_BACKEND" "" = (,"x11")))
>> 
> This works but the "" and , are redundant.
> 
Thanks for pointing that out, I didn't see any existing examples doing it that
way.

> All in all, the phase can be rewritten as:
> 
> (add-after 'install 'wrap-with-x11-gdk-backend
> 
> ;; Set GDK_BACKEND to x11 to prevent crash on Wayland.
> 
> See
> 
> ;; https://github.com/sirjuddington/SLADE/issues/1097
> 
> for details.
> 
> (lambda* (#:key outputs #:allow-other-keys)
> 
> (wrap-program
> 
> (string-append (assoc-ref outputs "out")
> 
> "/bin/slade")
> 
> '("GDK_BACKEND" = ("x11")))
> 
> #t)))
> 
Done.

>  
>> +       #:tests? #f))
>> 
> Are there no tests at all?  If so, note in a comment:
> 
> #:tests? #f))                    ; no test suite
> 
Yeah, no tests.

> There's one more problem:
> 
> set(ZIP_COMMAND "${ZIPTOOL_ZIP_EXECUTABLE}" -X -UN=UTF8 -9 -r \
> 
> "${CMAKE_BINARY_DIR}/slade.pk3" .)
> 
> Even zip -X won't create an identical archive on every run.  There
> 
> doesn't seem to be an option to do so.  The result:
> 
> --- /gnu/store/aaa-slade-3.1.12a/share/slade3/slade.pk3
> 
> +++ /gnu/store/bbb-slade-3.1.12a/share/slade3/slade.pk3
> 
> Zip file size: 3624588 bytes, number of entries: 768
> 
> -drwxr-xr-x  3.0 unx  0 b- stor 20-Oct-16 19:17 html/
> 
> -drwxr-xr-x  3.0 unx  0 b- stor 20-Oct-16 19:17 config/
> 
> -drwxr-xr-x  3.0 unx  0 b- stor 20-Oct-16 19:17 config/colours/
> 
> +drwxr-xr-x  3.0 unx  0 b- stor 20-Oct-16 19:31 html/
> 
> +drwxr-xr-x  3.0 unx  0 b- stor 20-Oct-16 19:31 config/
> 
> +drwxr-xr-x  3.0 unx  0 b- stor 20-Oct-16 19:31 config/colours/
> 
> This is not ideal: Guix aims for reproducible builds.
> 
I didn't think to check zip-compressed files.

> The following made multiple builds on one machine identical, but was
> 
> not consistent between file systems, probably due to readdir order:
> 
> + (add-before 'build 'reset-slade.pk3-timestamps
> 
> +   ;; This appears sufficient to make slade.pk3 reproducible.
> 
> +   (lambda _
> 
> +     (invoke "find" "../source/dist/res" "-exec" "touch"
> 
> +             "--no-dereference" "-t" "197001010000.00" "{}" "+")))
> 
> I suppose I could try using find to sort the files before invoking
> 
> zip, or something.  Thoughts?
> 
Unless there's a better way, let's do that.

Thanks for your help,

James Smith


[-- Attachment #2: v2-0001-gnu-Add-slade.patch --]
[-- Type: text/plain, Size: 4167 bytes --]

From 5035bc25a050ce6f81538000b59df05fb02b7e65 Mon Sep 17 00:00:00 2001
From: James Smith <jsubuntuxp@disroot.org>
Date: Fri, 16 Oct 2020 11:24:14 -0700
Subject: [PATCH v2] gnu: Add slade.

* gnu/packages/game-development.scm (slade): New variable.
---
 gnu/packages/game-development.scm | 63 ++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 96ed2f9da4..807b37b4e6 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
+;;; Copyright © 2020 James Smith <jsubuntuxp@disroot.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -37,7 +38,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages game-development)
-  #:use-module (srfi srfi-1)
+  #:use-module ((srfi srfi-1) #:hide (zip))
   #:use-module (ice-9 match)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
@@ -94,6 +95,7 @@
   #:use-module (gnu packages tls)
   #:use-module (gnu packages video)
   #:use-module (gnu packages web)
+  #:use-module (gnu packages wxwidgets)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
@@ -441,6 +443,65 @@ GUI toolkit, lighting and physics frameworks and @code{Tiled} TMX format
 support.")
     (license license:gpl3+)))
 
+(define-public slade
+  (package
+    (name "slade")
+    (version "3.1.12a")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/sirjuddington/SLADE")
+             (commit version)))
+       (sha256 (base32 "1q37pqibnrbdd7zjx7h2kfi0q9nc63cc96q9ya4x3fvsrf64n6yd"))
+       (file-name (git-file-name name version))))
+    (build-system cmake-build-system)
+    (arguments
+     '(#:configure-flags
+       (list "-DWX_GTK3=ON" "-DNO_WEBVIEW=ON"
+             (string-append "-DWITH_WXPATH="
+                            (assoc-ref %build-inputs "wxwidgets") "/bin")
+             (string-append "-DwxWidgets_LIBRARIES="
+                            (assoc-ref %build-inputs "wxwidgets") "/lib"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'reset-slade.pk3-timestamps
+           ;; This appears sufficient to make slade.pk3 reproducible.
+           (lambda _
+             (invoke "find" "../source/dist/res" "-exec" "touch"
+                     "--no-dereference" "-t" "197001010000.00" "{}"
+                     "+")))
+         (add-after 'install 'wrap-with-x11-gdk-backend
+           ;; Set GDK_BACKEND to x11 to prevent crash on Wayland.
+           ;; See https://github.com/sirjuddington/SLADE/issues/1097 for details.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (wrap-program
+                 (string-append (assoc-ref outputs "out")
+                                "/bin/slade")
+               '("GDK_BACKEND" = ("x11")))
+             #t)))
+       #:tests? #f)) ;; No test suite.
+    (inputs
+     `(("curl" ,curl)
+       ("fluidsynth" ,fluidsynth)
+       ("freeimage" ,freeimage)
+       ("ftgl" ,ftgl)
+       ("glew" ,glew)
+       ("gtk+" ,gtk+)
+       ("sfml" ,sfml)
+       ("wxwidgets" ,wxwidgets-3.1)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("which" ,which)
+       ("zip" ,zip)))
+    (home-page "https://slade.mancubus.net")
+    (synopsis "Doom game data editor")
+    (description "SLADE3 is a modern editor for Doom-engine based games and
+source ports.  It has the ability to view, modify, and write many different game-
+specific formats, and even convert between some of them, or from/to other generic
+formats such as PNG.")
+    (license license:gpl2)))
+
 (define-public tiled
   (package
     (name "tiled")
-- 
2.28.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-17  0:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16 18:43 [bug#44039] [PATCH] gnu: Add slade James Smith
2020-10-16 21:07 ` Tobias Geerinckx-Rice via Guix-patches via
2020-10-16 21:14   ` Tobias Geerinckx-Rice via Guix-patches via
2020-10-17  0:41   ` James Smith

unofficial mirror of guix-patches@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-patches/1 guix-patches/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-patches guix-patches/ https://yhetil.org/guix-patches \
		guix-patches@gnu.org
	public-inbox-index guix-patches

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.patches


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git