Patch 'build-find-pre-built-heimdal-build-tools-in-case-of-.patch' no longer applied. I found that LibreELEC maintainers had posted on https://bugzilla.samba.org/show_bug.cgi?id=14164, and that they had an updated patch, so let's just fetch that.
Why do we need `--with-systemd`? Samba 4.23 has a build script regression that no longer auto-detects systemd libraries. I intend to raise this with Samba's bugzilla, but in short:
* Samba 4.23 upgraded its bundled waf from 2.0.26 (used in 4.22.x) to 2.1.6.
* waf 2.1.6 switched the CLI option parser from `optparse` to `argparse`, in which case the default boolean was previously `None`, but is now `False`.
* In `lib/util/wscript`, the systemd options are registered like `opt.add_option('--with-systemd', action='store_true', dest='enable_systemd')`.
* In `lib/util/wscript_configure`, the libsystemd checks are guarded by `options.enable_sytemd != False`, and thus is no longer true when unspecified.
Our `standard-*` packages are set up to be null on the Python versions
that still include the corresponding module in the standard library.
However, since mobi depends on standard-imghdr unconditionally, using
the package on versions of Python that still have imghdr in the standard
library fails to build due to the following sequence of steps:
1. Something calls `python312Packages.mobi`.
2. `standard-imghdr` in the dependencies resolves to `null`, since
`imghdr` is still in the standard library on Python 3.12 and we have
the `standard-imghdr` package set to be null on versions of Python
where `imghdr` is in the standard library.
3. `pythonRuntimeDepsCheck` runs.
4. `pythonRuntimeDepsCheck` sees `Requires-Dist: standard-imghdr` in
mobi's distinfo metadata and checks whether the package is installed.
5. It is not, so the runtime deps check fails the build.
We solve this issue by removing `standard-imghdr` from the list of
dependencies on versions of Python where the package is set to `null`
(those versions that have `imghdr` in the standard library). The package
continues to work because it will transparently import the standard
library version of `imghdr`.