flatpak-builder
flatpak-builder copied to clipboard
qmake buildsystem doesn't honor environment buildflags
Flatpak-builder version
1.0.5
Description of the problem
qmake
buildsystem doesn't honor current environment buildflags. This affects KDE runtime and any app build with qmake
. It punches a hole in security flags coverage for apps in flathub.
Could flatpak-builder
additionally add the following variables in qmake buildsystem config?:
QMAKE_CFLAGS="$CFLAGS"
QMAKE_CXXFLAGS="$CXXFLAGS"
QMAKE_LFLAGS="$LDFLAGS"
See also https://gitlab.com/freedesktop-sdk/freedesktop-sdk/issues/640
Steps to reproduce
Build anything with qmake, i.e. https://flathub.org/builds/#/builders/32/builds/976/steps/5/logs/stdio
Setting these by default in the qmake buildsystem seems right to me. We have to be careful with not overwriting them if they are set explicitly though. Anyone want to do a PR with this?
The fix is slightly different than I described. Instead of exporting those variables in environment, they have to be passed as config args for qmake like:
qmake QMAKE_CFLAGS="$CFLAGS" QMAKE_CXXFLAGS="$CXXFLAGS" QMAKE_LFLAGS="$LDFLAGS"
I guess the correct place to add those is here. So something like that should work (correct values should replace ???):
g_ptr_array_add (configure_args_arr, g_strdup_printf ("QMAKE_CFLAGS='%s'", ???));
g_ptr_array_add (configure_args_arr, g_strdup_printf ("QMAKE_CXXFLAGS='%s'", ???));
g_ptr_array_add (configure_args_arr, g_strdup_printf ("QMAKE_LFLAGS='%s'", ???));
I adjusted description above.
@alexlarsson any idea?