all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: guix-devel@gnu.org
Subject: Re: Use and abuse of ‘computed-origin-method’: the ‘rust-ring’ case
Date: Sun, 15 Dec 2024 14:50:22 +0100	[thread overview]
Message-ID: <87ttb5hx7l.fsf@gnu.org> (raw)
In-Reply-To: <Z16WI0gUKM1APIMo@3900XT> (Efraim Flashner's message of "Sun, 15 Dec 2024 10:41:07 +0200")

Hi!

Efraim Flashner <efraim@flashner.co.il> skribis:

>> Anyway, the ‘computed-origin-method’ hack prevents input rewriting from
>> working as expected because the inputs of that big gexp aren’t visible
>> by just traversing the package graph.  That’s a problem.
>
> Are we talking about the inputs used for the computed-origin? (perl,
> nasm, go, etc?)

Yes.

> I'm pretty sure there are 3 options here:
> 1. Stop rebuilding the generated files. This is what we did in the past,
> and it allows rust-ring-0.14 to be used on riscv64-linux.  I haven't
> talked with the Debian folks about it but I'm pretty sure this is what
> they currently do.  I don't like it because we have instructions on how
> to do the rebuild and it's already implemented.  I also really like that
> everything can be regenerated from (nearly) any architecture, which
> makes it a much nicer build than qemu, which needs many cross compilers.

Yeah, we’d rather build from source.

> 2. Use the trivial-build-system instead of a computed-origin-method.
> I'm pretty sure we can use the output of the trivial-build-system (or
> any other package build) as the source for another package.  I
> currently think this is the best option.

Yes, that should work.

> 3. Adjust the build.rs file in rust-ring to call a custom shell script
> which will build all the missing files that we would remove in a
> snippet.  This is probably best from a "the source is ready to hack on"
> perspective, but it means we're carrying around a custom build script
> with no chance of being upstreamed.  It also means that each package
> which uses rust-ring will need to have all the rust-ring build
> dependencies added and it will need to be built each time.
>
> I've attached a patch that I tested locally to build the sources in an
> actual package, and then use that to build rust-ring. I tested it by
> building librsvg.  Currently it still requires go itself as using gccgo
> needs gccgo-toolchain.

Nice!

> +  (package
> +    (name "rust-ring")
> +    (version "0.17.8.tar.gz")   ; Hack to adjust the output name.
> +    (source (origin
>               (method git-fetch)
>               (uri (git-reference
>                      (url "https://github.com/briansmith/ring")
> @@ -4147,182 +4148,185 @@ (define rust-ring-0.17-sources
>               (file-name (git-file-name "rust-ring" version))
>               (sha256
>                (base32 "0rqfal81bf4l3dja98cajfjq2jbz1rcx7xdp2r33cxrm5y5psr28"))

[...]

> +    (build-system trivial-build-system)
> +    (arguments
> +     (list
> +       #:modules '((guix build utils))
> +       #:builder
> +       #~(begin
> +           (use-modules (guix build utils))
> +           (setenv "PATH"
> +                   (string-join
> +                     (list (assoc-ref %build-inputs "clang")    ; for clang-format
> +                           (assoc-ref %build-inputs "go")
> +                           (assoc-ref %build-inputs "gzip")
> +                           (assoc-ref %build-inputs "nasm")
> +                           (assoc-ref %build-inputs "perl")
> +                           (assoc-ref %build-inputs "python-minimal")
> +                           (assoc-ref %build-inputs "tar"))

You could use #+(this-package-native-input "clang"), etc.

If it works, I’m all for it!

I wonder if another option would be to make a proper package, which
would install the generated headers to $output/include and the generated
.o files to #$output/lib.  That package could be among the
‘propagated-inputs’ of ‘rust-ring’.  Dunno if that would work though.

Thanks for the quick reply & fix!

Ludo’.


      reply	other threads:[~2024-12-15 13:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-14 22:37 Use and abuse of ‘computed-origin-method’: the ‘rust-ring’ case Ludovic Courtès
2024-12-15  8:41 ` Efraim Flashner
2024-12-15 13:50   ` Ludovic Courtès [this message]

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

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

  git send-email \
    --in-reply-to=87ttb5hx7l.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.