flatpak-builder icon indicating copy to clipboard operation
flatpak-builder copied to clipboard

qmake buildsystem doesn't honor environment buildflags

Open Erick555 opened this issue 6 years ago • 3 comments

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

Erick555 avatar Feb 12 '19 11:02 Erick555

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?

alexlarsson avatar Feb 12 '19 12:02 alexlarsson

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.

Erick555 avatar Apr 24 '19 10:04 Erick555

@alexlarsson any idea?

Erick555 avatar Apr 25 '19 13:04 Erick555