Subject: [bug#73842] [PATCH v4 1/3] gnu: appimage: New packages for the appimage runtime.

From: Ludovic Courtès <[email-masked]>
Date: Tue, 05 Nov 2024 15:22:50 +0100

Hi!

Noé Lopez <[email-masked]> skribis:

> From: Noé Lopez <[email-masked]>
>
> * gnu/packages/appimage.scm
> (gnu packages appimage): New module.
> (fuse-for-appimage, squashfuse-for-appimage)
> (appimage-type2-runtime): New variables.
>
> Change-Id: I857a8eb5399a6a493e52db70b6c8cf0c71360930
> ---
>  gnu/packages/appimage.scm | 126 ++++++++++++++++++++++++++++++++++++++

Please add this file to ‘gnu/local.mk’.

> +(define fuse-for-appimage
> +  (package
> +    (inherit fuse)

Due to restrictions having to do with circular module dependencies, this
package must be defined in the same file as ‘fuse’ itself (apologies for
overlooking it!).  You could add the ‘hidden?’ property if needed, but
IMO it perhaps not even necessary to hide it.

> +(define squashfuse-for-appimage
> +    (package
> +      (inherit squashfuse)

Likewise, this should be in the same file as ‘squashfuse’.

> +      (arguments
> +       (list
> +        #:make-flags
> +        #~(list "-Csrc/runtime" "runtime-fuse3"
> +                (string-append "CFLAGS=" "-I" #$fuse-2 "/include/fuse/"

Rather: #$(this-package-input "fuse").

> +                               " -DGIT_COMMIT='\"" "guix-" #$version "\"'"
> +                               " -D_FILE_OFFSET_BITS=64"
> +                               " -static"))

You may need to add “-O2 -g” here, or the code might be compiled as with
“-O0 -g0”.

> +                     ;; Must be after all elf reliant phases.
> +                     (add-after 'make-dynamic-linker-cache 'set-magic-bytes
> +                       (lambda _
> +                         (let ((port (open (string-append #$output
> +                                            "/bin/runtime-fuse3")
> +                                           (logior O_WRONLY))))
> +                           (seek port 8 SEEK_SET)
> +                           (put-bytevector port #vu8(#x41 #x49 #x02))
> +                           (close-port port)))))

What’s the story with magic bytes here? :-)

Could you add a comment explaining what the phase does and why it’s
necessary?

> +        #:disallowed-references (list squashfuse-for-appimage
> +                                      fuse-for-appimage zstd zlib)))
> +      ;; Only needed at build time.
> +      (inputs (list squashfuse-for-appimage fuse-for-appimage
> +                    `(,zstd "static")
> +                    `(,zlib "static")))

It should probably be ‘native-inputs’, then.

Also, in #:disallowed-references, I think you need:

  `(,zstd "static") `(,zlib "static")

> +      (synopsis "Runtime for executing AppImages")
> +      (description "The runtime is the executable part of every AppImage, it
> +mounts the payload via FUSE and executes the entrypoint.")

Please make that a full sentence, as per
<https://guix.gnu.org/manual/devel/en/html_node/Synopses-and-Descriptions.html>.