Instead of patching mkspecs files set the desired CFLAGS, CXXFLAGS and LDFLAGS through QMAKE_... variables when configuring. See #3112