GNU bug report logs - #38687
[PATCH] gnu: Add libtcod.

Previous Next

Package: guix-patches;

Reported by: Giacomo Leidi <goodoldpaul <at> autistici.org>

Date: Fri, 20 Dec 2019 12:39:02 UTC

Severity: normal

Tags: patch

Done: Marius Bakke <mbakke <at> fastmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38687 in the body.
You can then email your comments to 38687 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#38687; Package guix-patches. (Fri, 20 Dec 2019 12:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Giacomo Leidi <goodoldpaul <at> autistici.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 20 Dec 2019 12:39:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Giacomo Leidi <goodoldpaul <at> autistici.org>
To: guix-patches <at> gnu.org
Cc: Giacomo Leidi <goodoldpaul <at> autistici.org>
Subject: [PATCH] gnu: Add libtcod.
Date: Fri, 20 Dec 2019 13:37:39 +0100
* gnu/packages/game-development.scm (libtcod): New variable.
---
 gnu/packages/game-development.scm | 39 +++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index febe15fa57..b5c4ff9ca7 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2019 Pierre Neidhardt <mail <at> ambrevar.xyz>
 ;;; Copyright © 2019 Leo Prikler <leo.prikler <at> student.tugraz.at>
 ;;; Copyright © 2019 Jethro Cao <jethrocao <at> gmail.com>
+;;; Copyright © 2019 Giacomo Leidi <goodoldpaul <at> autistici.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1904,3 +1905,41 @@ projects.")
 hardware from multiple vendors without requiring that applications have
 specific knowledge of the hardware they are targeting.")
     (license license:bsd-3)))
+
+(define-public libtcod
+  (package
+    (name "libtcod")
+    (version "1.15.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/libtcod/libtcod.git")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0pzr8ajmbqvh43ldjajx962xirj3rf8ayh344p6mqlrmb8gxrfr5"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'change-to-build-dir
+           (lambda _
+             (chdir "buildsys/autotools")
+             (patch-shebang "get_version.py")
+             #t)))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("python" ,python)
+       ("pkg-config" ,pkg-config)
+       ("sdl2" ,sdl2)
+       ("zlib" ,zlib)))
+    (home-page "https://github.com/libtcod/libtcod")
+    (synopsis "Library specifically designed for writing roguelikes")
+    (description
+     "libtcod is a free, fast, portable and uncomplicated API for roguelike
+developers providing an advanced true color console, input, and lots of other
+utilities frequently used in roguelikes.")
+    (license license:bsd-3)))
-- 
2.24.1





Information forwarded to guix-patches <at> gnu.org:
bug#38687; Package guix-patches. (Mon, 23 Dec 2019 18:38:01 GMT) Full text and rfc822 format available.

Message #8 received at 38687 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Giacomo Leidi <goodoldpaul <at> autistici.org>
Cc: 38687 <at> debbugs.gnu.org
Subject: Re: [bug#38687] [PATCH] gnu: Add libtcod.
Date: Mon, 23 Dec 2019 19:37:18 +0100
Hi,

Giacomo Leidi <goodoldpaul <at> autistici.org> skribis:

> * gnu/packages/game-development.scm (libtcod): New variable.

Could you (1) add a ‘snippet’ that removes zlib and utf8proc from
src/vendor (assuming it doesn’t break the build system…), and (2) add
utf8proc as an input?

That way we’d make sure we don’t end up using bundled copies of these
packages.

Apart from that it LGTM, thanks!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#38687; Package guix-patches. (Wed, 22 Jan 2020 11:12:02 GMT) Full text and rfc822 format available.

Message #11 received at 38687 <at> debbugs.gnu.org (full text, mbox):

From: goodoldpaul <at> autistici.org
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 38687 <at> debbugs.gnu.org
Subject: Re: [bug#38687] [PATCH] gnu: Add libtcod.
Date: Wed, 22 Jan 2020 11:11:34 +0000
[Message part 1 (text/plain, inline)]
On 2019-12-23 18:37, Ludovic Courtès wrote:
> Hi,
> 
> Giacomo Leidi <goodoldpaul <at> autistici.org> skribis:
> 
>> * gnu/packages/game-development.scm (libtcod): New variable.
> 
> Could you (1) add a ‘snippet’ that removes zlib and utf8proc from
> src/vendor (assuming it doesn’t break the build system…), and (2) add
> utf8proc as an input?
> 
> That way we’d make sure we don’t end up using bundled copies of these
> packages
> 
> Apart from that it LGTM, thanks!
> 
> Ludo’.

Hi Ludo',
Sorry for the delay. I checked and it seems that a lot of vendor library 
paths are hardcoded in the C headers.

I made a new patch with a snippet that deletes zlib sources, but I'm 
unsure about how to approach the hardcoded paths.

grepping for 'vendor' inside the source returns


src/libtcod/sys_sdl_img_png.cpp
41:#include "../vendor/lodepng.h"

src/libtcod/console/printing.cpp
54:#include "../../vendor/utf8proc/utf8proc.h"

src/libtcod/sdl2/gl2_ext_.h
36:#include "../../vendor/glad.h"

src/libtcod/color/canvas.cpp
39:#include "../../vendor/lodepng.h"

src/libtcod/tileset/truetype.cpp
43:#include "../../vendor/stb_truetype.h"

src/libtcod/tileset/tilesheet.cpp
34:#include "../../vendor/lodepng.h"


As far as I understood (I'm no C wizard) lodepng, glad and stb are 
libraries which are designed to be dropped inside a source tree and 
statically built in binaries. Right now I think those are secondary 
problems and the main deal is how to effectively replace the included 
utf8proc.

I'm not sure if replacing every "#include ../../vendor/something.h" with 
"#include <something.h>" ( by including a .patch file or with 
substitute* ? Food for thought :D) and then placing something.h inside a 
path known by the C linker is enough but it's the  I'm not really sure 
where to go from here.

Any advice is very welcome, thanks.

Giacomo
[0001-gnu-Add-libtcod.patch (text/x-diff, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#38687; Package guix-patches. (Wed, 22 Jan 2020 18:58:01 GMT) Full text and rfc822 format available.

Message #14 received at 38687 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: goodoldpaul <at> autistici.org, Ludovic Courtès <ludo <at> gnu.org>
Cc: 38687 <at> debbugs.gnu.org
Subject: Re: [bug#38687] [PATCH] gnu: Add libtcod.
Date: Wed, 22 Jan 2020 19:57:45 +0100
[Message part 1 (text/plain, inline)]
goodoldpaul <at> autistici.org writes:

> As far as I understood (I'm no C wizard) lodepng, glad and stb are 
> libraries which are designed to be dropped inside a source tree and 
> statically built in binaries. Right now I think those are secondary 
> problems and the main deal is how to effectively replace the included 
> utf8proc.
>
> I'm not sure if replacing every "#include ../../vendor/something.h" with 
> "#include <something.h>" ( by including a .patch file or with 
> substitute* ? Food for thought :D) and then placing something.h inside a 
> path known by the C linker is enough but it's the  I'm not really sure 
> where to go from here.

Something like

(substitute* (find-files "src/libtcod" "\\.(h|cpp)$")
  (("\\.\\./\\.\\./vendor/") ""))

Would make all the header paths relative, i.e. looked up in the compiler
search path.  In practice you might need to narrow down the substitution
so that e.g. vendor/utf8proc is preserved, if it turns out to be
difficult to unbundle.

There is currently no stb-truetype package, but it should be trivial to
add it (see gnu/packages/stb.scm).  Lodepng looks fairly easy too.  :-)

Good luck!
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#38687; Package guix-patches. (Thu, 06 Feb 2020 20:18:01 GMT) Full text and rfc822 format available.

Message #17 received at 38687 <at> debbugs.gnu.org (full text, mbox):

From: goodoldpaul <at> autistici.org
To: Marius Bakke <mbakke <at> fastmail.com>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 38687 <at> debbugs.gnu.org
Subject: Re: [bug#38687] [PATCH] gnu: Add libtcod.
Date: Thu, 06 Feb 2020 20:16:57 +0000
Hi Marius and Ludo,
I managed to remove all vendored libraries except for glad.h which seems 
to be some kind of generated glue code for loading OpenGL 
(https://github.com/Dav1dde/glad). In the next two patches I'm adding 
libtcod and it's dependency lodepng.

Guix lint is warning me that lodepng could be affected by 
CVE-2019-17178, but taking a look at 
https://nvd.nist.gov/vuln/detail/CVE-2019-17178 and 
https://nvd.nist.gov/vuln/search/results?adv_search=true&cpe_version=cpe%3a%2fa%3alodev%3alodepng%3a2019-09-28 
seems to indicate that lodepng should  be *not* vulnerable since 
28/09/2019, did I understand correctly?

Please don't hesitate and tell me if anything should done w.r.t. the 
CVE.

Thanks for your patience reviewing this,

Giacomo




Information forwarded to guix-patches <at> gnu.org:
bug#38687; Package guix-patches. (Thu, 06 Feb 2020 20:18:02 GMT) Full text and rfc822 format available.

Message #20 received at 38687 <at> debbugs.gnu.org (full text, mbox):

From: Giacomo Leidi <goodoldpaul <at> autistici.org>
To: 38687 <at> debbugs.gnu.org
Cc: Giacomo Leidi <goodoldpaul <at> autistici.org>
Subject: [PATCH 1/2] gnu: Add lodepng.
Date: Thu,  6 Feb 2020 21:17:12 +0100
* gnu/packages/image.scm (lodepng): New variable.
---
 gnu/packages/image.scm | 58 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 45055858b4..18a51a8773 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -23,6 +23,7 @@
 ;;; Copyright © 2018 Pierre-Antoine Rouby <contact <at> parouby.fr>
 ;;; Copyright © 2018 Alex Vong <alexvong1995 <at> gmail.com>
 ;;; Copyright © 2018 Rutger Helling <rhelling <at> mykolab.com>
+;;; Copyright © 2020 Giacomo Leidi <goodoldpaul <at> autistici.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1841,3 +1842,60 @@ using only text tools.
 SNG is implemented by a compiler/decompiler called sng that
 losslessly translates between SNG and PNG.")
     (license license:zlib)))
+
+(define-public lodepng
+  ;; The project doesn't seem to use any
+  ;; kind of meaningful versioning scheme.
+  (let ((commit "5a0dba103893e6b8084be13945a826663917d00a")
+        (revision "1")
+        (version "0.0.0"))
+    (package
+      (name "lodepng")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/lvandeve/lodepng")
+                      (commit commit)))
+                (sha256
+                 (base32
+                  "0nvlba82mf4n7xfc3rz2g9wwgnrxpjw64p5dsjmj2r06g5m4l38a"))
+                (file-name (git-file-name name version))))
+      (build-system gnu-build-system)
+      (arguments
+       '(#:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           (replace 'build
+             (lambda _
+               (setenv "CXXFLAGS" "-fPIC")
+               (invoke "make" "lodepng.o")
+               (invoke "make" "lodepng_util.o")
+               (invoke "ar" "rv" "liblodepng.a" "lodepng.o" "lodepng_util.o")
+               (invoke "g++" "-fPIC" "-O3"
+                       "-o" "liblodepng.so"
+                       "-shared" "lodepng.o" "lodepng_util.o")
+               #t))
+           (replace 'check
+             (lambda _
+               (invoke "make" "unittest")
+               (invoke "./unittest")
+               #t))
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (doc (string-append out "/share/doc"))
+                      (lib (string-append out "/lib"))
+                      (include (string-append out "/include")))
+                 (install-file "lodepng.h" include)
+                 (install-file "lodepng_util.h" include)
+                 (install-file "liblodepng.a" lib)
+                 (install-file "liblodepng.so" lib)
+                 (install-file "README.md" doc)
+                 #t))))))
+      (home-page "https://lodev.org/lodepng/")
+      (synopsis "PNG encoder and decoder in C and C++, without dependencies")
+      (description "LodePNG is a PNG image decoder and encoder, all in one,
+no dependency or linkage required.  It's made for C (ISO C90), and has a C++
+wrapper with a more convenient interface on top.")
+      (license license:zlib))))
-- 
2.25.0





Information forwarded to guix-patches <at> gnu.org:
bug#38687; Package guix-patches. (Thu, 06 Feb 2020 20:18:02 GMT) Full text and rfc822 format available.

Message #23 received at 38687 <at> debbugs.gnu.org (full text, mbox):

From: Giacomo Leidi <goodoldpaul <at> autistici.org>
To: 38687 <at> debbugs.gnu.org
Cc: Giacomo Leidi <goodoldpaul <at> autistici.org>
Subject: [PATCH 2/2] gnu: Add libtcod.
Date: Thu,  6 Feb 2020 21:17:13 +0100
* gnu/packages/game-development.scm (libtcod): New variable.
---
 gnu/packages/game-development.scm | 76 +++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 6fa4fed74f..ce25620773 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -19,6 +19,7 @@
 ;;; Copyright © 2019 Jethro Cao <jethrocao <at> gmail.com>
 ;;; Copyright © 2020 Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
 ;;; Copyright © 2020 Timotej Lazar <timotej.lazar <at> araneo.si>
+;;; Copyright © 2020 Giacomo Leidi <goodoldpaul <at> autistici.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -88,6 +89,7 @@
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages stb)
   #:use-module (gnu packages texinfo)
+  #:use-module (gnu packages textutils)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages video)
   #:use-module (gnu packages web)
@@ -2086,3 +2088,77 @@ computer games, 3D authoring tools and simulation tools.")
     (description "Chipmunk is a simple, lightweight, fast and portable 2D
 rigid body physics library written in C.")
     (license license:expat)))
+
+(define-public libtcod
+  (package
+    (name "libtcod")
+    (version "1.15.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/libtcod/libtcod.git")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0pzr8ajmbqvh43ldjajx962xirj3rf8ayh344p6mqlrmb8gxrfr5"))
+              (modules '((guix build utils)))
+              (snippet '(begin
+                          (delete-file-recursively "src/vendor/utf8proc")
+                          (delete-file-recursively "src/vendor/zlib")
+                          (delete-file "src/vendor/stb_truetype.h")
+                          (delete-file "src/vendor/stb_sprintf.h")
+                          (delete-file "src/vendor/lodepng.cpp")
+                          (delete-file "src/vendor/lodepng.h")
+                          #t))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags '("--with-gnu-ld"
+                           "LIBS=-lutf8proc -llodepng")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'change-to-build-dir
+           (lambda _
+             (chdir "buildsys/autotools")
+             (patch-shebang "get_version.py")
+             #t))
+         (add-before 'bootstrap 'remove-hardcoded-vendor-paths
+           (lambda _
+             (substitute* "sources.am"
+                 (("\\.\\./\\.\\./src/vendor/lodepng\\.cpp \\\\\n") "")
+                 (("\\.\\./\\.\\./src/vendor/stb\\.c \\\\")
+                  "../../src/vendor/stb.c")
+                 (("\\.\\./\\.\\./src/vendor/utf8proc/utf8proc\\.c") ""))
+
+               (substitute* "../../src/libtcod/sys_sdl_img_png.cpp"
+                 (("\\.\\./vendor/") ""))
+
+               (substitute* '("../../src/libtcod/color/canvas.cpp"
+                              "../../src/libtcod/sys_sdl_img_png.cpp"
+                              "../../src/libtcod/tileset/truetype.cpp"
+                              "../../src/libtcod/tileset/tilesheet.cpp")
+                 (("\\.\\./\\.\\./vendor/") ""))
+
+               (substitute* "../../src/libtcod/console/printing.cpp"
+                 (("\\.\\./\\.\\./vendor/utf8proc/") ""))
+               #t)))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("lodepng" ,lodepng)
+       ("python" ,python)
+       ("pkg-config" ,pkg-config)
+       ("sdl2" ,sdl2)
+       ("stb-sprintf" ,stb-sprintf)
+       ("stb-truetype" ,stb-truetype)))
+    (inputs
+     `(("utf8proc" ,utf8proc)
+       ("zlib" ,zlib)))
+    (home-page "https://github.com/libtcod/libtcod")
+    (synopsis "Library specifically designed for writing roguelikes")
+    (description
+     "libtcod is a free, fast, portable and uncomplicated API for roguelike
+developers providing an advanced true color console, input, and lots of other
+utilities frequently used in roguelikes.")
+    (license license:bsd-3)))
-- 
2.25.0





Information forwarded to guix-patches <at> gnu.org:
bug#38687; Package guix-patches. (Mon, 10 Feb 2020 21:11:01 GMT) Full text and rfc822 format available.

Message #26 received at 38687 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: goodoldpaul <at> autistici.org
Cc: Ludovic Courtès <ludo <at> gnu.org>, 38687 <at> debbugs.gnu.org
Subject: Re: [bug#38687] [PATCH] gnu: Add libtcod.
Date: Mon, 10 Feb 2020 22:10:46 +0100
[Message part 1 (text/plain, inline)]
goodoldpaul <at> autistici.org writes:

> Hi Marius and Ludo,
> I managed to remove all vendored libraries except for glad.h which seems 
> to be some kind of generated glue code for loading OpenGL 
> (https://github.com/Dav1dde/glad). In the next two patches I'm adding 
> libtcod and it's dependency lodepng.

Excellent, thanks for taking the time to get rid of the bundled
dependencies.

> Guix lint is warning me that lodepng could be affected by 
> CVE-2019-17178, but taking a look at 
> https://nvd.nist.gov/vuln/detail/CVE-2019-17178 and 
> https://nvd.nist.gov/vuln/search/results?adv_search=true&cpe_version=cpe%3a%2fa%3alodev%3alodepng%3a2019-09-28 
> seems to indicate that lodepng should  be *not* vulnerable since 
> 28/09/2019, did I understand correctly?
>
> Please don't hesitate and tell me if anything should done w.r.t. the 
> CVE.

The CVE entry points to this commit:

https://github.com/FreeRDP/FreeRDP/commit/9fee4ae076b1ec97b97efb79ece08d1dab4df29a

Which changes something in FreeRDP's bundled version of LodePNG.  The
changes in question do not seem to be in upstream LodePNG:

https://github.com/lvandeve/lodepng/blob/master/lodepng.cpp#L1079

It's not clear to me whether this is a problem with LodePNG, or just
improper use of its API.  It looks like the latter: tree->lengths is
checked just below the changed line, so FreeRDP must be catching the
83 return code and keep going to get the memory leak described in the
CVE entry.

We can either ignore it using the 'lint-hidden-cve' property, and add a
comment that this version of LodePNG should not be used with FreeRDP; or
take the patch from FreeRDP, as it looks innocent enough.  I don't
really have a strong opinion here, nor sufficient expertise, so I'd be
happy if others could chime in.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#38687; Package guix-patches. (Mon, 10 Feb 2020 21:15:02 GMT) Full text and rfc822 format available.

Message #29 received at 38687 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: Giacomo Leidi <goodoldpaul <at> autistici.org>, 38687 <at> debbugs.gnu.org
Cc: Giacomo Leidi <goodoldpaul <at> autistici.org>
Subject: Re: [bug#38687] [PATCH 1/2] gnu: Add lodepng.
Date: Mon, 10 Feb 2020 22:14:48 +0100
[Message part 1 (text/plain, inline)]
Giacomo Leidi <goodoldpaul <at> autistici.org> writes:

> * gnu/packages/image.scm (lodepng): New variable.

[...]

> +(define-public lodepng
> +  ;; The project doesn't seem to use any
> +  ;; kind of meaningful versioning scheme.
> +  (let ((commit "5a0dba103893e6b8084be13945a826663917d00a")
> +        (revision "1")
> +        (version "0.0.0"))

There is a LODEPNG_VERSION_STRING in lodepng.cpp, can you set the
"version" variable here to that?

> +    (package
> +      (name "lodepng")
> +      (version (git-version version revision commit))
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/lvandeve/lodepng")
> +                      (commit commit)))
> +                (sha256
> +                 (base32
> +                  "0nvlba82mf4n7xfc3rz2g9wwgnrxpjw64p5dsjmj2r06g5m4l38a"))
> +                (file-name (git-file-name name version))))
> +      (build-system gnu-build-system)
> +      (arguments
> +       '(#:phases
> +         (modify-phases %standard-phases
> +           (delete 'configure)
> +           (replace 'build
> +             (lambda _
> +               (setenv "CXXFLAGS" "-fPIC")
> +               (invoke "make" "lodepng.o")
> +               (invoke "make" "lodepng_util.o")
> +               (invoke "ar" "rv" "liblodepng.a" "lodepng.o" "lodepng_util.o")
> +               (invoke "g++" "-fPIC" "-O3"
> +                       "-o" "liblodepng.so"
> +                       "-shared" "lodepng.o" "lodepng_util.o")
> +               #t))
> +           (replace 'check
> +             (lambda _
> +               (invoke "make" "unittest")
> +               (invoke "./unittest")
> +               #t))
> +           (replace 'install
> +             (lambda* (#:key outputs #:allow-other-keys)
> +               (let* ((out (assoc-ref outputs "out"))
> +                      (doc (string-append out "/share/doc"))
> +                      (lib (string-append out "/lib"))
> +                      (include (string-append out "/include")))
> +                 (install-file "lodepng.h" include)
> +                 (install-file "lodepng_util.h" include)
> +                 (install-file "liblodepng.a" lib)

We try to avoid static libraries in Guix, so no need to install this
file.

Otherwise LGTM.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#38687; Package guix-patches. (Mon, 10 Feb 2020 21:20:01 GMT) Full text and rfc822 format available.

Message #32 received at 38687 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: Giacomo Leidi <goodoldpaul <at> autistici.org>, 38687 <at> debbugs.gnu.org
Cc: Giacomo Leidi <goodoldpaul <at> autistici.org>
Subject: Re: [bug#38687] [PATCH 2/2] gnu: Add libtcod.
Date: Mon, 10 Feb 2020 22:19:41 +0100
[Message part 1 (text/plain, inline)]
Giacomo Leidi <goodoldpaul <at> autistici.org> writes:

> * gnu/packages/game-development.scm (libtcod): New variable.

[...]

> +         (add-before 'bootstrap 'remove-hardcoded-vendor-paths
> +           (lambda _
> +             (substitute* "sources.am"
> +                 (("\\.\\./\\.\\./src/vendor/lodepng\\.cpp \\\\\n") "")
> +                 (("\\.\\./\\.\\./src/vendor/stb\\.c \\\\")
> +                  "../../src/vendor/stb.c")
> +                 (("\\.\\./\\.\\./src/vendor/utf8proc/utf8proc\\.c") ""))
> +
> +               (substitute* "../../src/libtcod/sys_sdl_img_png.cpp"
> +                 (("\\.\\./vendor/") ""))
> +
> +               (substitute* '("../../src/libtcod/color/canvas.cpp"
> +                              "../../src/libtcod/sys_sdl_img_png.cpp"
> +                              "../../src/libtcod/tileset/truetype.cpp"
> +                              "../../src/libtcod/tileset/tilesheet.cpp")
> +                 (("\\.\\./\\.\\./vendor/") ""))
> +
> +               (substitute* "../../src/libtcod/console/printing.cpp"
> +                 (("\\.\\./\\.\\./vendor/utf8proc/") ""))
> +               #t)))))

Can you move the contents of this phase to the 'snippet' instead?  Since
they are related to the unbundling, and makes 'guix build --source
libtcod' easier to work with.

> +    (native-inputs
> +     `(("autoconf" ,autoconf)
> +       ("automake" ,automake)
> +       ("libtool" ,libtool)
> +       ("lodepng" ,lodepng)
> +       ("python" ,python)
> +       ("pkg-config" ,pkg-config)
> +       ("sdl2" ,sdl2)

sdl2 and lodepng should probably be regular inputs.

> +       ("stb-sprintf" ,stb-sprintf)
> +       ("stb-truetype" ,stb-truetype)))
> +    (inputs
> +     `(("utf8proc" ,utf8proc)
> +       ("zlib" ,zlib)))
> +    (home-page "https://github.com/libtcod/libtcod")
> +    (synopsis "Library specifically designed for writing roguelikes")
> +    (description
> +     "libtcod is a free, fast, portable and uncomplicated API for roguelike

s/free//  (everything in Guix is free software)

Otherwise LGTM!
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#38687; Package guix-patches. (Sun, 16 Feb 2020 21:54:01 GMT) Full text and rfc822 format available.

Message #35 received at 38687 <at> debbugs.gnu.org (full text, mbox):

From: goodoldpaul <at> autistici.org
To: Marius Bakke <mbakke <at> fastmail.com>
Cc: 38687 <at> debbugs.gnu.org
Subject: Re: [bug#38687] gnu: Add libtcod.
Date: Sun, 16 Feb 2020 21:53:05 +0000
[Message part 1 (text/plain, inline)]
Hi Marius,
I updated the patches and upgrading lodepng led the warning from guix 
lint disappear so I guess it should be safe now. I'm sending an updated 
version.

Thank you again for your patience,

Giacomo
[0001-gnu-Add-lodepng.patch (text/x-diff, attachment)]
[0002-gnu-Add-libtcod.patch (text/x-diff, attachment)]

Reply sent to Marius Bakke <mbakke <at> fastmail.com>:
You have taken responsibility. (Mon, 24 Feb 2020 20:57:01 GMT) Full text and rfc822 format available.

Notification sent to Giacomo Leidi <goodoldpaul <at> autistici.org>:
bug acknowledged by developer. (Mon, 24 Feb 2020 20:57:02 GMT) Full text and rfc822 format available.

Message #40 received at 38687-done <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: goodoldpaul <at> autistici.org
Cc: 38687-done <at> debbugs.gnu.org
Subject: Re: [bug#38687] gnu: Add libtcod.
Date: Mon, 24 Feb 2020 21:56:32 +0100
[Message part 1 (text/plain, inline)]
goodoldpaul <at> autistici.org writes:

> Hi Marius,
> I updated the patches and upgrading lodepng led the warning from guix 
> lint disappear so I guess it should be safe now. I'm sending an updated 
> version.

Thanks!  I applied both patches, and added a comment about the lodepng
version number for our future selves.  :-)
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 24 Mar 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 146 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.