0009-fix-build-with-ccache.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. Fix QMAKE_CXX/CROSS_COMPILE verification with ccache
  2. The use of ccache leads to QMAKE_CXX definitions of the form:
  3. QMAKE_CXX = $${CCACHE} $${CROSS_COMPILE}g++
  4. The previous test required QMAKE_CXX to be a single valid (absolute or
  5. QMAKE_PATH_ENV-relative) path to an existing file, which was not
  6. compatible with definitions of QMAKE_CXX like the one above.
  7. Fix this by using only the first value in QMAKE_CXX, which usually
  8. points to the compiler executable, or to the ccache executable in the
  9. above case.
  10. Signed-off-by: Benoît Thébaudeau <benoit@wsystem.com>
  11. ---
  12. mkspecs/features/device_config.prf | 9 +++++++--
  13. 1 file changed, 7 insertions(+), 2 deletions(-)
  14. diff --git a/mkspecs/features/device_config.prf b/mkspecs/features/device_config.prf
  15. index cd3a0cf..eee4ac6 100644
  16. --- a/mkspecs/features/device_config.prf
  17. +++ b/mkspecs/features/device_config.prf
  18. @@ -19,10 +19,15 @@ defineTest(deviceSanityCheckCompiler) {
  19. else: \
  20. sfx =
  21. + # Build the compiler filename using the first value in QMAKE_CXX in order to
  22. + # support tools like ccache, which give QMAKE_CXX values of the form:
  23. + # ccache <path_to_compiler>
  24. + compiler = $$first(QMAKE_CXX)$$sfx
  25. +
  26. # Check if the binary exists with an absolute path. Do this check
  27. # before the CROSS_COMPILE empty check below to allow the mkspec
  28. # to derive the compiler path from other device options.
  29. - exists($$QMAKE_CXX$$sfx):return()
  30. + exists($$compiler):return()
  31. # Check for possible reasons of failure
  32. # check if CROSS_COMPILE device-option is set
  33. @@ -31,7 +36,7 @@ defineTest(deviceSanityCheckCompiler) {
  34. # Check if QMAKE_CXX points to an executable.
  35. ensurePathEnv()
  36. for (dir, QMAKE_PATH_ENV) {
  37. - exists($$dir/$${QMAKE_CXX}$$sfx): \
  38. + exists($$dir/$${compiler}): \
  39. return()
  40. }