Subject: Re: [bug#73071] [PATCH mesa-updates 0/8] Various updates for mesa to 24.2.2

From: John Kehayias <[email-masked]>
Date: Fri, 20 Sep 2024 01:51:34 +0000

Hello The Man :)

A note that your email went to no one; the debbugs number address is not
an alias for anyone. I happen to see your message via the issues web
interface. I would suggest adding in cc's here to whoever you intended.

On Tue, Sep 17, 2024 at 07:35 PM, The Man wrote:

> Hello, In the interest of creating a future where mesa properly works alongside libglvnd i think there's a few options:
>
> - simply adding "-Dglvnd=true" to mesa configure-flags and tediously adding libglvnd to the inputs of every package
> that links to LibGL, as well as patching anything problematic as mentioned in https://issues.guix.gnu.org/49339#8
>

This didn't seem so tidious but a countable number of packages. The
building and testing will take more time but it didn't seem too bad at
the time at least.

> - create an abomination, the ONE MESA TO RULE THEM ALL. an example follows:
>

This looks the same basically as just propagating libglvnd from mesa,
but I didn't look too carefully or try it.

In any event, we should handle this in a separate issue, get some input,
and then we can do this on a branch. My instinct is to go with what was
started in the linked issue above; add libglvnd to mesa (propagated?)
and fix failing packages assuming it isn't all 4000 or whatever (pretty
sure it is not).

> (define-public mesa/new
>   (package
>     (inherit mesa)
>     (arguments
>       (substitute-keyword-arguments (package-arguments mesa)
>         ((#:configure-flags flags ''())
>           #~(append #$flags
>             (list "-Dglvnd=true")))
>         ((#:phases phases ''())
>           (with-imported-modules '((guix build union))
>           #~(modify-phases #$phases
>             (add-before 'validate-runpath 'unionize
>               (lambda _ ;; unionize with libglvnd, fixing all problems
>                 (use-modules (ice-9 match)
>                              (guix build union))
>                 (union-build (string-append #$output "/tmp")
>                   '#$(list (this-package-input "libglvnd"))
>                   #:create-all-directories? #t)
>                 (copy-recursively (string-append #$output "/tmp") #$output)
>                 (delete-file-recursively (string-append #$output "/tmp"))
>                 ;; leftovers from building with old mesa.
>                 ;; some packages still link to these.
>                 ;; remove for rebuilding after applying graft?
>                 (symlink (string-append #$output "/lib/libEGL.so.1")
>                          (string-append #$output "/lib/libEGL.so.1.0.0"))
>                 (symlink (string-append #$output "/lib/libGLESv1_CM.so.1")
>                          (string-append #$output "/lib/libGLESv1_CM.so.1.1.0"))
>                 (symlink (string-append #$output "/lib/libGLESv2.so.2")
>                          (string-append #$output "/lib/libGLESv2.so.2.0.0"))
>                 (symlink (string-append #$output "/lib/libGL.so.1")
>                          (string-append #$output "/lib/libGL.so.1.2.0"))))
>             (add-after 'install 'fix-paths
>               (lambda _
>                 (substitute*
>                   (string-append #$output "/share/glvnd/egl_vendor.d/50_mesa.json")
>                   (("libEGL_mesa")
>                     (string-append #$output "/lib/libEGL_mesa")))))
>             (add-after 'fix-paths 'add-external-egl
>               (lambda _
>                 (mkdir-p (string-append #$output "/share/egl/egl_external_platform.d")))))))))
>     (native-search-paths (append (package-native-search-paths mesa)
>      (list
>       (search-path-specification
>        (variable "__EGL_VENDOR_LIBRARY_DIRS")
>        (files '("share/glvnd/egl_vendor.d")))
>       (search-path-specification
>        (variable "GBM_BACKENDS_PATH")
>        (files '("lib")))
>       (search-path-specification
>        (variable "XDG_DATA_DIRS")
>        (files '("share")))
>       (search-path-specification
>        (variable "__EGL_EXTERNAL_PLATFORM_CONFIG_DIRS")
>        (files '("share/egl/egl_external_platform.d"))))))
>     (inputs (modify-inputs (package-inputs mesa)
>       (prepend libglvnd)))))
>
> Using this to graft over mesa is a filthy answer to the "GL problem". no rebuilding necessary, it seems to "just work".
>
> Other distributions have settled on packaging mesa build for working with libglvnd and most software seems to expect
> such.
> Perhaps there's another solution?

It is unclear to me in Guix what this all means. I think it would mostly
be helpful on foreign distros (so libglvnd can load host's GL stuff) but
I don't know. Or perhaps for non-free related stuff (which wouldn't be
part of Guix directly in any event).

Thanks for the input!
John