WTF processor architecture is being determined via CMAKE_SYSTEM_PROCESSOR. On systems which support uname, this is initialized to `uname -p`.
However, the tricky bit is that on some OSes, `uname -p` returns 'i386' for both 32-bit and 64-bit members of the Intel processor family. Thus, in this case, we must check the pointer size to determine the actual architecture.
Created attachment 358107 [details]
Attachment 358107 [details] did not pass style-queue:
ERROR: CMakeLists.txt:105: No trailing spaces [whitespace/trailing] 
Total errors found: 1 in 2 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 358108 [details]
Fixed style fault
Comment on attachment 358108 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=358108&action=review
> + # On some OSes, `uname -p` always reports i386 for all members
How will we know in the future that this hack can be removed? Can you leave any pointers at all?
(In reply to Alexey Proskuryakov from comment #4)
> How will we know in the future that this hack can be removed? Can you leave
> any pointers at all?
There is no intention that this should ever be removed; it is necessary because of the semantics of uname -p:
As can be observed from the link above, many operating systems return 'i386' for `uname -p` although they are in fact 64-bit. For correct operation, it must be checked in this case whether the target is actually 32- or 64-bits. See for example:
I am going to withdraw this patch for now.
CMAKE_SYSTEM_PROCESSOR is not ideal, as i386 is ambiguous; however, I am not sure there is a best-practices alternative for architecture determination in CMake.
As for the patch, my doubt is whether CMAKE_SIZEOF_VOID_P will yield the expected result if the target architecture is different to the build architecture.
For now, users who are affected by the i386 ambiguity can override the value of CMAKE_SYSTEM_PROCESSOR to work within the existing semantics. That is not ideal, but now I can think of no better way that does not introduce some other problem.