Subject: [bug#74517] [PATCH 3/8] gnu: Add zbar-minimal.

From: Maxim Cournoyer <[email-masked]>
Date: Mon, 25 Nov 2024 12:08:12 +0900

Hi Nicolas,

Nicolas Graves <[email-masked]> writes:

> * gnu/packages/aidc.scm (zbar-minimal): New variable.
> ---
>  gnu/packages/aidc.scm | 27 ++++++++++++++++++++++++++-
>  1 file changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/aidc.scm b/gnu/packages/aidc.scm
> index 281f87dc78..58b5b9a6f6 100644
> --- a/gnu/packages/aidc.scm
> +++ b/gnu/packages/aidc.scm
> @@ -46,7 +46,8 @@ (define-module (gnu packages aidc)
>    #:use-module (gnu packages video)
>    #:use-module (guix build-system cmake)
>    #:use-module (guix build-system gnu)
> -  #:use-module (guix build-system glib-or-gtk))
> +  #:use-module (guix build-system glib-or-gtk)
> +  #:use-module (guix build-system trivial))
>  
>  (define-public zxing-cpp
>    ;; Use the master branch as it includes unreleased build system improvements
> @@ -277,6 +278,30 @@ (define (move-output-file target file)
>      (home-page "https://github.com/mchehab/zbar")
>      (license license:lgpl2.1+)))
>  
> +(define-public zbar-minimal
> +  (package
> +    (inherit zbar)
> +    (source #f)
> +    (name "zbar-minimal")
> +    (build-system trivial-build-system)
> +    (arguments
> +     (list
> +      #:builder
> +      (with-imported-modules '((guix build utils))
> +        #~(begin
> +            (use-modules (guix build utils))
> +            (copy-recursively #$(this-package-native-input "zbar")
> +                              #$output)
> +            (substitute* (string-append #$output "/lib/pkgconfig/zbar.pc")
> +              (("^prefix=.*")
> +               (string-append "prefix=" #$output "\n")))))))
> +    (outputs '("out"))
> +    (native-inputs (modify-inputs (package-native-inputs zbar)
> +                     (prepend zbar)))
> +    (inputs (modify-inputs (package-inputs zbar)
> +              (delete "qtx11extras")))
> +    (propagated-inputs '())))

I see; the previous commit neatly organized dependencies on gtk/qt in
separate outputs, and this variant ensures any reference to these output
is severed, without any rebuild.  It's a researched approach, but I'm a
bit worried about long term maintenance/correctness; I feel a classic
variant rebuilt without the problematic inputs would be both easier to
understand and maintain in the long term.

Also, same earlier comments hold about package/inherit and using
#:disallowed-reference along with an explanatory comment.

-- 
Thanks,
Maxim