Subject: Re: [bug#78131] [PATCH electronics-team] gnu: Add libfst.

From: Maxim Cournoyer <[email-masked]>
Date: Fri, 16 May 2025 22:03:21 +0900

Hi Cayetano,

Cayetano Santos <[email-masked]> writes:

> * gnu/packages/fpga.scm (libfst): New variable.
>
> Change-Id: Idff52e52114877e0a0259c8df98b3c1bfa20c521
> ---
>  gnu/packages/fpga.scm | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
>
> diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
> index 4fcd6a47a6..e299da75c5 100644
> --- a/gnu/packages/fpga.scm
> +++ b/gnu/packages/fpga.scm
> @@ -37,6 +37,7 @@ (define-module (gnu packages fpga)
>    #:use-module (guix build-system glib-or-gtk)
>    #:use-module (guix build-system gnu)
>    #:use-module (guix build-system cmake)
> +  #:use-module (guix build-system meson)
>    #:use-module (guix build-system python)
>    #:use-module (guix build-system pyproject)
>    #:use-module (guix build-system qt)
> @@ -336,6 +337,35 @@ (define-public icestorm
>  files.")
>        (license license:isc))))
>  
> +(define-public libfst
> +  ;; no releases
> +  (let ((commit "6a52070cd62ec65c29832bc95e7db493504aa7ac")
> +        (revision "0"))
> +    (package
> +      (name "libfst")
> +      (version (git-version "1.0.0" revision commit))
> +      (source
> +       (origin
> +         (method git-fetch)
> +         (uri (git-reference
> +               (url "https://github.com/gtkwave/libfst/")
> +               (commit commit)))
> +         (file-name (git-file-name name version))
> +         (sha256
> +          (base32 "0b1r660m5aib316jjl4nhs10y7vhhqy2mvxjip3ynahig3hpi46z"))))
> +      (build-system meson-build-system)
> +      (native-inputs (list
> +                      cmake-minimal
> +                      zlib
> +                      gobject-introspection
> +                      pkg-config))
> +      (synopsis
> +       "Library to manipulate Fast Signal Trace (FST) format waveforms")
> +      (description "Libfst is a small library used to read and write Fast Signal
> +Trace (FST) format waveforms.")
> +      (home-page "https://github.com/gtkwave/libfst/")
> +      (license (list license:expat license:bsd-3)))))
> +

I've applied it, with the following changes:

--8<---------------cut here---------------start------------->8---
modified   gnu/packages/fpga.scm
@@ -378,14 +378,15 @@ (define-public libfst
          (sha256
           (base32 "0b1r660m5aib316jjl4nhs10y7vhhqy2mvxjip3ynahig3hpi46z"))))
       (build-system meson-build-system)
-      (native-inputs (list cmake-minimal zlib gobject-introspection pkg-config))
-      (synopsis
-       "Library to manipulate Fast Signal Trace (FST) format waveforms")
-      (description
-       "Libfst is a small library used to read and write Fast Signal
-Trace (FST) format waveforms.")
+      (native-inputs (list gobject-introspection pkg-config))
+      (inputs (list bzip2))
+      (propagated-inputs (list zlib))  ;in Requires.private of libfst.pc
+      (synopsis "Fast Signal Trace (FST) format waveforms library")
+      (description "Libfst is a small library used to read and write
+@acronym{FST, Fast Signal Trace} format waveforms.")
       (home-page "https://github.com/gtkwave/libfst/")
-      (license (list license:expat license:bsd-3)))))
+      (license (list license:expat      ;libfst and fastlz-derived sources
+                     license:bsd-2))))) ;for lz4-derived sources
 
 (define-public nextpnr
   (package
--8<---------------cut here---------------end--------------->8---

zlib being linked to, it should appear in inputs (used at runtime).
Since it's also listed as a Required package in the pkg-config file
(libfst.pc), it has to even be in propagated-inputs.

the lz4 license is bsd-2, not bsd-3

I've added bzip2 as an input.

The rest is just some cosmetic sugar.

-- 
Thanks,
Maxim