GNU bug report logs - #78294
[PATCH 0/4] Add stb-image-resize.

Previous Next

Package: guix-patches;

Reported by: aurtzy <aurtzy <at> gmail.com>

Date: Wed, 7 May 2025 05:53:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 78294 AT debbugs.gnu.org.

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#78294; Package guix-patches. (Wed, 07 May 2025 05:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to aurtzy <aurtzy <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 07 May 2025 05:53:02 GMT) Full text and rfc822 format available.

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

From: aurtzy <aurtzy <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: aurtzy <aurtzy <at> gmail.com>
Subject: [PATCH 0/4] Add stb-image-resize.
Date: Wed,  7 May 2025 01:43:08 -0400
Hi!

This series of patches includes:
- transition to modern packaging style using g-expressions;
- support for description translations to resolve a TODO comment;
- support for packaging libraries that are considered deprecated upstream;
- and the addition of one such package for a deprecated library.


I followed Ludo's tip to use define-word-list-dictionary as an example [1] for
resolving the translation support, but I wasn't able to figure out how to verify
that the patch works.  Is there a way to do this without pushing and searching
on Weblate?

The deprecated stb-image-resize library is used by gamescope [2], which is
incompatible with stb-image-resize2.  I plan to send a v2 patch in an existing
issue [3] to add gamescope soon(tm).

Guix reports about 30 dependent packages:
--8<---------------cut here---------------start------------->8---
$ guix refresh --list-dependent --expression='(@@ (gnu packages stb) stb)'
Building the following 17 packages would ensure 28 dependent packages are rebuilt: openboardview <at> 9.95.0 cura <at> 4.13.1 vv <at> 3.1 libretro-dolphin-emu <at> 5.0-0.89a4df7 dolphin-emu <at> 5.0-13669.f9deb68 slade <at> 3.2.5a csfml <at> 2.5.1 extremetuxracer <at> 0.8.2 schiffbruch <at> 1.2.1-0.e41916d marble-marcher <at> 0-1.e580460 mars <at> 0.7.5-2.84664cd qgis <at> 3.42.1 speed-dreams <at> 2.4.0 stb-rect-pack <at> 1.01 stb-image-resize2 <at> 2.12 python-pyjanitor <at> 0.27.0 libtcod <at> 1.15.1
--8<---------------cut here---------------end--------------->8---

[1] https://issues.guix.gnu.org/issue/32155#6

[2] https://github.com/ValveSoftware/gamescope

[3] https://issues.guix.gnu.org/70493

Cheers,

aurtzy

aurtzy (4):
  gnu: stb: Use modern package style.
  gnu: stb-*: Make it possible to translate descriptions.
  gnu: stb: Support defining deprecated header packages.
  gnu: Add stb-image-resize.

 gnu/packages/stb.scm | 115 ++++++++++++++++++++++++++-----------------
 1 file changed, 69 insertions(+), 46 deletions(-)


base-commit: ec95c71c01144fcae1a3d079e0d0aec6087b9d2a
-- 
2.49.0





Information forwarded to aurtzy <at> gmail.com, guix-patches <at> gnu.org:
bug#78294; Package guix-patches. (Wed, 07 May 2025 06:00:02 GMT) Full text and rfc822 format available.

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

From: aurtzy <aurtzy <at> gmail.com>
To: 78294 <at> debbugs.gnu.org
Cc: aurtzy <aurtzy <at> gmail.com>
Subject: [PATCH 1/4] gnu: stb: Use modern package style.
Date: Wed,  7 May 2025 01:59:08 -0400
* gnu/packages/stb.scm (stb)[arguments]<#:phases>: Use G-Expressions.
(make-stb-header-package): Likewise.

Change-Id: I836ad872e20444dcfb30480bd420cb63e4bb313f
---
 gnu/packages/stb.scm | 56 ++++++++++++++++++++++++--------------------
 1 file changed, 31 insertions(+), 25 deletions(-)

diff --git a/gnu/packages/stb.scm b/gnu/packages/stb.scm
index 90c9fff8cf..64375e7480 100644
--- a/gnu/packages/stb.scm
+++ b/gnu/packages/stb.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Marius Bakke <mbakke <at> fastmail.com>
 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me <at> tobias.gr>
+;;; Copyright © 2025 aurtzy <aurtzy <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -18,6 +19,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages stb)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
@@ -44,25 +46,27 @@ (define stb
                 (file-name (git-file-name name version))))
       (build-system gnu-build-system)
       (arguments
-       `(#:modules ((ice-9 ftw)
+       (list
+        #:modules `((ice-9 ftw)
                     (ice-9 regex)
                     (srfi srfi-26)
                     ,@%default-gnu-modules)
-         #:phases (modify-phases %standard-phases
-                    (delete 'configure)
-                    (delete 'build)
-                    (replace 'check
-                      (lambda _
-                        #f ; (invoke "make" "-C" "tests" "CC=gcc")
-                        ))
-                    (replace 'install
-                      (lambda* (#:key outputs #:allow-other-keys)
-                        (let ((out (assoc-ref outputs "out"))
-                              (files (make-regexp "\\.(c|h|md)$")))
-                          (for-each (lambda (file)
-                                      (install-file file out))
-                                    (scandir "." (cut regexp-exec files <>)))
-                          #t))))))
+        #:phases
+        #~(modify-phases %standard-phases
+            (delete 'configure)
+            (delete 'build)
+            (replace 'check
+              (lambda _
+                #f                     ; (invoke "make" "-C" "tests" "CC=gcc")
+                ))
+            (replace 'install
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let ((out (assoc-ref outputs "out"))
+                      (files (make-regexp "\\.(c|h|md)$")))
+                  (for-each (lambda (file)
+                              (install-file file out))
+                            (scandir "." (cut regexp-exec files <>)))
+                  #t))))))
       (synopsis "Single file libraries for C/C++")
       (description
        "This package contains a variety of small independent libraries for
@@ -79,15 +83,17 @@ (define (make-stb-header-package name version description)
     (inputs (list stb))
     (build-system trivial-build-system)
     (arguments
-     `(#:modules ((guix build utils))
-       #:builder (begin
-                   (use-modules (guix build utils))
-                   (let ((stb (assoc-ref %build-inputs "stb"))
-                         (lib (string-join (string-split ,name #\-) "_"))
-                         (out (assoc-ref %outputs "out")))
-                     (install-file (string-append stb "/" lib ".h")
-                                   (string-append out "/include"))
-                     #t))))
+     (list
+      #:modules '((guix build utils))
+      #:builder
+      #~(begin
+          (use-modules (guix build utils))
+          (let ((stb #$(this-package-input "stb"))
+                (lib (string-join (string-split #$name #\-) "_"))
+                (out #$output))
+            (install-file (string-append stb "/" lib ".h")
+                          (string-append out "/include"))
+            #t))))
     (description description)))
 
 ;; TODO: These descriptions are not translatable!  They should be
-- 
2.49.0





Information forwarded to aurtzy <at> gmail.com, guix-patches <at> gnu.org:
bug#78294; Package guix-patches. (Wed, 07 May 2025 06:00:03 GMT) Full text and rfc822 format available.

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

From: aurtzy <aurtzy <at> gmail.com>
To: 78294 <at> debbugs.gnu.org
Cc: aurtzy <aurtzy <at> gmail.com>
Subject: [PATCH 2/4] gnu: stb-*: Make it possible to translate descriptions.
Date: Wed,  7 May 2025 01:59:09 -0400
* gnu/packages/stb.scm (define-stb-header-package): New macro.
(stb-image, stb-image-resize2, stb-image-write, stb-rect-pack, stb-sprintf,
stb-truetype): Use it.

Change-Id: Ie7da51a2eb2dc91dff8d23e0d3c8397af3eb6d67
---
 gnu/packages/stb.scm | 44 ++++++++++++++++++++++++--------------------
 1 file changed, 24 insertions(+), 20 deletions(-)

diff --git a/gnu/packages/stb.scm b/gnu/packages/stb.scm
index 64375e7480..395959608d 100644
--- a/gnu/packages/stb.scm
+++ b/gnu/packages/stb.scm
@@ -96,39 +96,43 @@ (define (make-stb-header-package name version description)
             #t))))
     (description description)))
 
-;; TODO: These descriptions are not translatable!  They should be
-;; converted to macros as outlined in <https://bugs.gnu.org/32155>.
-(define-public stb-image
-  (make-stb-header-package
-   "stb-image" "2.30"
+(define-syntax define-stb-header-package
+  (syntax-rules (description)
+    ((_ symbol name version (description text))
+     (define-public symbol
+       (make-stb-header-package name version text)))))
+
+(define-stb-header-package stb-image
+  "stb-image" "2.30"
+  (description
    "stb-image is a small and self-contained library for image loading or
 decoding from file or memory.  A variety of formats are supported."))
 
-(define-public stb-image-resize2
-  (make-stb-header-package
-   "stb-image-resize2" "2.12"
+(define-stb-header-package stb-image-resize2
+  "stb-image-resize2" "2.12"
+  (description
    "stb-image-resize2 is a library that supports scaling and translation of
 images."))
 
-(define-public stb-image-write
-  (make-stb-header-package
-   "stb-image-write" "1.16"
+(define-stb-header-package stb-image-write
+  "stb-image-write" "1.16"
+  (description
    "stb-image-write is a small library for writing image files to the
 C <at> tie{}@code{stdio} interface."))
 
-(define-public stb-rect-pack
-  (make-stb-header-package
-   "stb-rect-pack" "1.01"
+(define-stb-header-package stb-rect-pack
+  "stb-rect-pack" "1.01"
+  (description
    "stb-rect-pack is a small rectangle packing library useful for, e.g., packing
 rectangular textures into an atlas.  It does not do rotation."))
 
-(define-public stb-sprintf
-  (make-stb-header-package
-   "stb-sprintf" "1.10"
+(define-stb-header-package stb-sprintf
+  "stb-sprintf" "1.10"
+  (description
    "stb-sprintf implements fast @code{sprintf}, @code{snprintf} for C/C++."))
 
-(define-public stb-truetype
-  (make-stb-header-package
-   "stb-truetype" "1.26"
+(define-stb-header-package stb-truetype
+  "stb-truetype" "1.26"
+  (description
    "stb-truetype is a library for parsing, decoding, and rasterizing
 characters from TrueType fonts."))
-- 
2.49.0





Information forwarded to aurtzy <at> gmail.com, guix-patches <at> gnu.org:
bug#78294; Package guix-patches. (Wed, 07 May 2025 06:00:04 GMT) Full text and rfc822 format available.

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

From: aurtzy <aurtzy <at> gmail.com>
To: 78294 <at> debbugs.gnu.org
Cc: aurtzy <aurtzy <at> gmail.com>
Subject: [PATCH 3/4] gnu: stb: Support defining deprecated header packages.
Date: Wed,  7 May 2025 01:59:10 -0400
* gnu/packages/stb.scm (stb)[arguments]<#:phases>: Modify 'install phase to
include deprecated files in output.
(make-stb-header-package): Support `deprecated?' keyword argument.
(define-stb-header-package): Accept rest arguments and pass them to
make-stb-header-package.

Change-Id: I003dd5786e3bd22d00290d1935e21291e8529914
---
 gnu/packages/stb.scm | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/stb.scm b/gnu/packages/stb.scm
index 395959608d..827cdb85a4 100644
--- a/gnu/packages/stb.scm
+++ b/gnu/packages/stb.scm
@@ -60,12 +60,16 @@ (define stb
                 #f                     ; (invoke "make" "-C" "tests" "CC=gcc")
                 ))
             (replace 'install
-              (lambda* (#:key outputs #:allow-other-keys)
-                (let ((out (assoc-ref outputs "out"))
-                      (files (make-regexp "\\.(c|h|md)$")))
-                  (for-each (lambda (file)
-                              (install-file file out))
-                            (scandir "." (cut regexp-exec files <>)))
+              (lambda _
+                (let* ((files-rx (make-regexp "\\.(c|h|md)$"))
+                       (include-file? (cut regexp-exec files-rx <>))
+                       (deprecated-output (string-append #$output "/deprecated")))
+                  (for-each (cut install-file <> #$output)
+                            (scandir "." include-file?))
+                  (mkdir-p deprecated-output)
+                  (with-directory-excursion "deprecated"
+                    (for-each (cut install-file <> deprecated-output)
+                              (scandir "." include-file?)))
                   #t))))))
       (synopsis "Single file libraries for C/C++")
       (description
@@ -74,7 +78,7 @@ (define stb
       ;; The user can choose either license.
       (license (list expat public-domain)))))
 
-(define (make-stb-header-package name version description)
+(define* (make-stb-header-package name version description #:key deprecated?)
   (package
     (inherit stb)
     (name name)
@@ -88,19 +92,20 @@ (define (make-stb-header-package name version description)
       #:builder
       #~(begin
           (use-modules (guix build utils))
-          (let ((stb #$(this-package-input "stb"))
+          (let ((headers-dir #$(file-append (this-package-input "stb")
+                                            (if deprecated? "/deprecated" "")))
                 (lib (string-join (string-split #$name #\-) "_"))
                 (out #$output))
-            (install-file (string-append stb "/" lib ".h")
+            (install-file (string-append headers-dir "/" lib ".h")
                           (string-append out "/include"))
             #t))))
     (description description)))
 
 (define-syntax define-stb-header-package
   (syntax-rules (description)
-    ((_ symbol name version (description text))
+    ((_ symbol name version (description text) rest ...)
      (define-public symbol
-       (make-stb-header-package name version text)))))
+       (make-stb-header-package name version text rest ...)))))
 
 (define-stb-header-package stb-image
   "stb-image" "2.30"
-- 
2.49.0





Information forwarded to aurtzy <at> gmail.com, guix-patches <at> gnu.org:
bug#78294; Package guix-patches. (Wed, 07 May 2025 06:00:05 GMT) Full text and rfc822 format available.

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

From: aurtzy <aurtzy <at> gmail.com>
To: 78294 <at> debbugs.gnu.org
Cc: aurtzy <aurtzy <at> gmail.com>
Subject: [PATCH 4/4] gnu: Add stb-image-resize.
Date: Wed,  7 May 2025 01:59:11 -0400
* gnu/packages/stb.scm (stb-image-resize): New variable.

Change-Id: Ibaf2cc9e0855843139b55694601b56069cbd3074
---
 gnu/packages/stb.scm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gnu/packages/stb.scm b/gnu/packages/stb.scm
index 827cdb85a4..f3be6a56ec 100644
--- a/gnu/packages/stb.scm
+++ b/gnu/packages/stb.scm
@@ -113,6 +113,14 @@ (define-stb-header-package stb-image
    "stb-image is a small and self-contained library for image loading or
 decoding from file or memory.  A variety of formats are supported."))
 
+(define-stb-header-package stb-image-resize
+  "stb-image-resize" "0.97"
+  (description
+   "stb-image-resize is a library that supports scaling and translation of
+images.  This library is deprecated; @code{stb-image-resize2} should be used
+instead.")
+  #:deprecated? #t)
+
 (define-stb-header-package stb-image-resize2
   "stb-image-resize2" "2.12"
   (description
-- 
2.49.0





This bug report was last modified 8 days ago.

Previous Next


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