...by reusing as much as possible the existing upstream logic used for the LO Flathub build (cherry picked from commit f41687290d)
f41687290d