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