unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Nicolas Graves via Guix-patches via <guix-patches@gnu.org>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: 74517@debbugs.gnu.org
Subject: [bug#74517] [PATCH 2/8] gnu: zbar: Split outputs.
Date: Mon, 25 Nov 2024 08:42:43 +0100	[thread overview]
Message-ID: <87wmgrsqrw.fsf@ngraves.fr> (raw)
In-Reply-To: <87bjy4m2t4.fsf@gmail.com>

On 2024-11-25 12:04, Maxim Cournoyer wrote:

> Hi,
>
> Nicolas Graves <ngraves@ngraves.fr> writes:
>
>> * gnu/packages/aidc.scm (zbar): Split outputs.
>> [build-system]: Switch to glib-or-gtk-build-system.
>> [arguments]<#:configure-flags>: Add --disable-static.
>> <#:modules>: Use srfi-26 and gremlin's file-runpath.
>> <#:phases>: Add phase 'split-outputs.
>> [native-inputs]: Improve style.
>> [inputs]: Improve style. Replace v4l-utils by v4l-utils-minimal.
>> ---
>>  gnu/packages/aidc.scm | 94 +++++++++++++++++++++++++++++++++----------
>>  1 file changed, 73 insertions(+), 21 deletions(-)
>
> [...]
>
>>  (define-public zxing-cpp
>>    ;; Use the master branch as it includes unreleased build system improvements
>> @@ -184,32 +187,81 @@ (define-public zbar
>>           (commit version)))
>>         (file-name (git-file-name name version))
>>         (sha256
>> -        (base32
>> -         "0rf3i7lx0fqzxsngird6l4d4dnl612nr32rm8sib699qqx67px8n"))))
>> -    (build-system gnu-build-system)
>> +        (base32 "0rf3i7lx0fqzxsngird6l4d4dnl612nr32rm8sib699qqx67px8n"))))
>> +    (build-system glib-or-gtk-build-system)
>> +    ;; XXX: qt output is broken: zbarcam-qt fails with segmentation fault, but
>> +    ;; this error happened before the output split.
>
> As an alternative to packaging broken outputs, perhaps we could simply
> tell the build system to not build with Qt, or wholly remove it from the
> inputs?
>
>> +    (outputs '("out" "gtk" "qt"))
>>      (arguments
>> -     '(#:configure-flags (list "--with-gtk=auto"
>> +     (list
>> +      #:configure-flags '(list "--disable-static"
>> +                               "--with-gtk=auto"
>>                                 "--with-python=auto"
>>                                 (string-append "--with-dbusconfdir="
>>                                                (assoc-ref %outputs "out")
>> -                                              "/etc"))))
>> +                                              "/etc"))
>> +      #:modules `(((guix build gremlin) #:select (file-runpath))
>> +                  (srfi srfi-26)
>> +                  ,@%glib-or-gtk-build-system-modules)
>> +      #:phases
>> +      #~(modify-phases %standard-phases
>> +          (add-after 'install 'split-outputs
>> +            (lambda* (#:key outputs #:allow-other-keys)
>> +              (let ((out (assoc-ref outputs "out"))
>> +                    (gtk (assoc-ref outputs "gtk")))
>
> This can be rewritten using the gexp variabls #$output and #$output:gtk.
>> +
>> +                ;; XXX: Using set-file-runpath leads to runpath-too-long-error
>> +                (define (prepend-to-runpath path file)
>> +                  (invoke "patchelf" "--set-rpath"
>> +                          (string-join (cons* path (file-runpath file)) ":")
>> +                          file))
>> +
>> +                (define (move-output-file target file)
>> +                  (let* ((source (string-append out file))
>> +                         (destination (string-append target file)))
>> +                    (mkdir-p (dirname destination))
>> +                    (rename-file source destination)
>> +                    (when (and (eq? (stat:type (lstat destination)) 'regular)
>> +                               (elf-file? destination))
>> +                      (prepend-to-runpath
>> +                       (string-append out "/lib:" target "/lib")
>> +                       destination))))
>> +
>> +                (for-each
>> +                 (lambda (kind)
>> +                   (for-each
>> +                    (cut move-output-file (assoc-ref outputs kind) <>)
>> +                    (cons*
>> +                     (string-append "/lib/pkgconfig/zbar-" kind ".pc")
>> +                     (string-append "/bin/zbarcam-" kind)
>> +                     (map (cut string-drop <> 1)
>> +                          (with-directory-excursion out
>> +                            (find-files
>> +                             "./lib"
>> +                             (string-append "lib.*" kind "\\.so.*")))))))
>> +                 '("gtk" "qt"))
>> +
>> +                (for-each
>> +                 (cut move-output-file gtk <>)
>> +                 '("/share/gir-1.0" "/lib/girepository-1.0"))))))))
>
> That is clever, perhaps too clever (in comparison to the simple brute
> force approach of using a distinct minimal package variant built without
> the extra inputs) :-).

Yes, but I think the output split is desirable independently of the
minimal variant (for when we won't have to carry the propagated-inputs
anymore), and thus it makes sense to keep it.  WDYT?

I could also try to package :
- one minimal version
- one gtk version in its own package, trying not to rebuild but to link
if not too complex
- not try to package a qt version (I'm not able to debug this).

-- 
Best regards,
Nicolas Graves




  reply	other threads:[~2024-11-25  7:43 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-24 22:09 [bug#74517] [PATCH 0/8] Remove gtk@4 input dependency on qtbase@5 Nicolas Graves via Guix-patches via
2024-11-24 22:29 ` [bug#74517] [PATCH 1/8] gnu: Add v4l-utils-minimal Nicolas Graves via Guix-patches via
2024-11-24 22:29   ` [bug#74517] [PATCH 2/8] gnu: zbar: Split outputs Nicolas Graves via Guix-patches via
2024-11-25  3:04     ` Maxim Cournoyer
2024-11-25  7:42       ` Nicolas Graves via Guix-patches via [this message]
2024-11-24 22:29   ` [bug#74517] [PATCH 3/8] gnu: Add zbar-minimal Nicolas Graves via Guix-patches via
2024-11-25  3:08     ` Maxim Cournoyer
2024-11-24 22:29   ` [bug#74517] [PATCH 4/8] gnu: libde265: Remove unused qtbase-5 input Nicolas Graves via Guix-patches via
2024-11-25  3:08     ` Maxim Cournoyer
2024-11-24 22:29   ` [bug#74517] [PATCH 5/8] gnu: libde265: Update to 1.0.14 Nicolas Graves via Guix-patches via
2024-11-25  3:09     ` Maxim Cournoyer
2024-11-24 22:29   ` [bug#74517] [PATCH 6/8] gnu: libdc1394: Replace v4l-utils by v4l-utils-minimal Nicolas Graves via Guix-patches via
2024-11-24 22:29   ` [bug#74517] [PATCH 7/8] gnu: gst-plugins-bad: Replace inputs with -minimal variants Nicolas Graves via Guix-patches via
2024-11-24 22:29   ` [bug#74517] [PATCH 8/8] gnu: gst-plugins-good: Replace v4l-utils by v4l-utils-minimal Nicolas Graves via Guix-patches via
2024-11-25  2:54   ` [bug#74517] [PATCH 1/8] gnu: Add v4l-utils-minimal Maxim Cournoyer
2024-11-25  2:56   ` Maxim Cournoyer
2024-11-25  2:38 ` [bug#74517] [PATCH 0/8] Remove gtk@4 input dependency on qtbase@5 Maxim Cournoyer
2024-11-25  3:11 ` Maxim Cournoyer
2024-11-25  7:47   ` Nicolas Graves via Guix-patches via
2024-11-25  9:43 ` [bug#74517] [PATCH v2 01/10] gnu: Add v4l-utils-minimal Nicolas Graves via Guix-patches via
2024-11-25  9:43   ` [bug#74517] [PATCH v2 02/10] gnu: zbar: Improve style Nicolas Graves via Guix-patches via
2024-11-25  9:43   ` [bug#74517] [PATCH v2 03/10] gnu: zbar: Disable static and qt build Nicolas Graves via Guix-patches via
2024-11-25  9:43   ` [bug#74517] [PATCH v2 04/10] gnu: zbar: Update to 0.23.92 Nicolas Graves via Guix-patches via
2024-11-25  9:43   ` [bug#74517] [PATCH v2 05/10] gnu: Add zbar-minimal Nicolas Graves via Guix-patches via
2024-11-25  9:43   ` [bug#74517] [PATCH v2 06/10] gnu: libde265: Remove unused qtbase-5 input Nicolas Graves via Guix-patches via
2024-11-25  9:43   ` [bug#74517] [PATCH v2 07/10] gnu: libde265: Update to 1.0.14 Nicolas Graves via Guix-patches via
2024-11-25  9:43   ` [bug#74517] [PATCH v2 08/10] gnu: libdc1394: Replace v4l-utils by v4l-utils-minimal Nicolas Graves via Guix-patches via
2024-11-25  9:43   ` [bug#74517] [PATCH v2 09/10] gnu: gst-plugins-bad: Replace inputs with -minimal variants Nicolas Graves via Guix-patches via
2024-11-25  9:43   ` [bug#74517] [PATCH v2 10/10] gnu: gst-plugins-good: Replace v4l-utils by v4l-utils-minimal Nicolas Graves via Guix-patches via
2024-11-25  9:52 ` [bug#74517] [PATCH v3 01/10] gnu: Add v4l-utils-minimal Nicolas Graves via Guix-patches via
2024-11-25  9:52   ` [bug#74517] [PATCH v3 02/10] gnu: zbar: Improve style Nicolas Graves via Guix-patches via
2024-11-25  9:52   ` [bug#74517] [PATCH v3 03/10] gnu: zbar: Disable static and qt build Nicolas Graves via Guix-patches via
2024-11-25  9:52   ` [bug#74517] [PATCH v3 04/10] gnu: zbar: Update to 0.23.92 Nicolas Graves via Guix-patches via
2024-11-25  9:52   ` [bug#74517] [PATCH v3 05/10] gnu: Add zbar-minimal Nicolas Graves via Guix-patches via
2024-11-25  9:52   ` [bug#74517] [PATCH v3 06/10] gnu: libde265: Remove unused qtbase-5 input Nicolas Graves via Guix-patches via
2024-11-25  9:52   ` [bug#74517] [PATCH v3 07/10] gnu: libde265: Update to 1.0.14 Nicolas Graves via Guix-patches via
2024-11-25  9:52   ` [bug#74517] [PATCH v3 08/10] gnu: libdc1394: Replace v4l-utils by v4l-utils-minimal Nicolas Graves via Guix-patches via
2024-11-25  9:52   ` [bug#74517] [PATCH v3 09/10] gnu: gst-plugins-bad: Replace inputs with -minimal variants Nicolas Graves via Guix-patches via
2024-11-25  9:52   ` [bug#74517] [PATCH v3 10/10] gnu: gst-plugins-good: Replace v4l-utils by v4l-utils-minimal Nicolas Graves via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wmgrsqrw.fsf@ngraves.fr \
    --to=guix-patches@gnu.org \
    --cc=74517@debbugs.gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    --cc=ngraves@ngraves.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).