grim: locate wayland-scanner explicitly, and drop upstream's -Werror
Two defects found by building it, both worth the comments they carry.
Naming wayland in BOTH dependencies: and build-inputs: -- the obvious way to say "I link the library and I run the scanner" -- is refused outright with package: duplicate input name: wayland, and there is no declarative way round it: only build inputs contribute a bin/ to PATH, and a dependency cannot export one either because PATH is builder-owned. foot does not hit this because it reads the scanner's absolute path out of pkg-config; grim does find_program('wayland-scanner'), which searches PATH, and produced "wayland-client found: YES / wayland-scanner found: NO" from one package one line apart. Answered with meson's own native file, fed from ${wayland} -- which interpolates precisely because wayland is a declared dependency.
And upstream sets werror=true, which this clang turns into a build failure on an unused variable in a PPM writer nothing here calls. Disabled for grim only; foot sets werror=true too and compiles clean under the same compiler, so this is one package's warning rather than a blanket concession.
src/core/packages/capture.sgl | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 51 insertions(+), 16 deletions(-)src/core/packages/capture.sglmodified
;; note on `fontconfig` in (core packages fonts) for why a ;; grand-dependency has to be named here. dependencies: (list libpng pixman wayland wayland-protocols libffi zlib) ;; `wayland` APPEARS IN BOTH LISTS, AND THAT IS NOT A MISTAKE. ;; WAYLAND IS A DEPENDENCY ONLY, AND THE SCANNER IS POINTED AT ;; EXPLICITLY. The obvious move -- naming `wayland` in BOTH ;; `dependencies:` and `build-inputs:`, since grim needs the library ;; linked and the `wayland-scanner` program run -- IS REFUSED: ;; ;; grim needs two different things from it. The LIBRARY ;; (wayland-client) is linked into the result, which is a ;; `dependencies:` relationship. The PROGRAM `wayland-scanner` runs ;; during the build to turn protocol XML into C, which is a ;; `build-inputs:` relationship -- and only build inputs contribute ;; their `bin/` to PATH. A dependency's `bin/` is not on PATH at all. ;; package: duplicate input name: wayland ;; ;; foot does not need the second declaration, because foot asks ;; pkg-config for the scanner's absolute path ;; (`wscanner.get_variable('wayland_scanner')`) rather than searching ;; PATH. grim's `protocol/meson.build:3` does a plain ;; `find_program('wayland-scanner')`, so without this it fails: ;; and there is no way round it by declaration. Only build inputs put ;; a `bin/` on PATH, and a dependency cannot export one either, because ;; `PATH` is builder-owned and a `search-paths:` export naming it is ;; refused as well. ;; ;; foot does not hit this: it reads the scanner's absolute path out of ;; pkg-config (`wscanner.get_variable('wayland_scanner')`). grim's ;; `protocol/meson.build:3` does a plain ;; `find_program('wayland-scanner')`, which searches PATH: ;; ;; Run-time dependency wayland-client found: YES 1.24.0 ;; Program wayland-scanner found: NO ;; ;; Note the shape of that pair -- the library IS found and the program ;; is not, from the same package, one line apart. build-inputs: (list meson samurai python wayland) ;; The library is found and the program is not, from the same package, ;; one line apart. ;; ;; The answer is meson's own mechanism for exactly this -- a native ;; file naming the binary -- fed from `${wayland}`, which interpolates ;; because wayland IS a declared dependency. No patch to grim, no ;; second declaration, and the path is derived from the closure rather ;; than searched for. build-inputs: (list meson samurai python) phases: (list (external-phase kind: 'run args: (list "sh" "-c" (string-append "set -eu\n" "meson setup build" "cat > native.ini <<'NF'\n" "[binaries]\n" "wayland-scanner = '${wayland}/bin/wayland-scanner'\n" "NF\n" "meson setup build --native-file native.ini" " --prefix=${out}" " --buildtype=plain" " --default-library=static" " -Dprefer_static=true" ;; JPEG output would add libjpeg for a format ;; nothing here reads. ;; UPSTREAM'S WARNINGS-AS-ERRORS IS TURNED OFF, ;; and this is a compiler-set difference rather ;; than a defect in grim. grim's meson sets ;; `werror=true`, and this toolchain's clang ;; warns where the author's compiler did not: ;; ;; ../write_ppm.c:32:23: error: unused variable ;; 'format' [-Werror,-Wunused-variable] ;; ;; The variable really is unused, in a PPM writer ;; nothing in this channel calls. Distributions ;; disable `werror` for exactly this reason: a ;; project's warning policy is calibrated to the ;; compilers its authors use, and turning a ;; foreign compiler's extra warnings into build ;; failures makes the package unbuildable for ;; reasons unrelated to correctness. ;; ;; NOTE THAT FOOT DOES NOT NEED THIS. foot also ;; sets `werror=true` and compiles clean under ;; the same clang, so this is not a blanket ;; concession -- it is one package's warning. " -Dwerror=false" " -Djpeg=disabled" ;; man pages want scdoc. " -Dman-pages=disabled\n"