CREATE-PROJECT: Various portability fixes for Mac OS X Leopard and other older systems #2751
Conversation
Maybe move the override workaround to create_project.h so that it's applied everywhere, otherwise using override in the future in a different file will break this again. These changes look good to me, thanks! I appreciate create_project building in old environments. |
5346e82
to
a6d7326
Thank you! I've edited the PR with your suggestion. |
xcode.cpp was just updated in master and now there's a conflict, can you please rebase this against master? |
<CommonCrypto/CommonDigest.h> should be used for CC_MD5() on macOS. Fixes the build on Leopard.
Non POSIX.1-2008 systems will not necessarily accept NULL as the second argument, and could crash the program here. Provide a temporary buffer on the stack instead, and don't count on realpath() allocating one on the heap. This will work on older POSIX.1-2001 systems. (In theory, this older POSIX.1-2001 syntax could have portability problems too, because of PATH_MAX, but in practice this shouldn't be a problem for the systems intended to be used by create_project.) Fixes the build on Mac OS X Leopard.
msbuild.h makes uses of the "override" keyword, so borrow the compat macro from c++11-compat.h to make this work on older compilers, such as the ones found on Mac OS X Leopard.
a6d7326
to
05c292f
Ah yeah, I had a conflict with one of my own commits there :) It should be OK now. |
I've tested this on Big Sur (M1) and Catalina (Intel) and each change makes sense. Nice job! |
Here's a set of changes I had to make so that
create_project
could be built on Mac OS X Leopard.In summary:
override
compat macro fromc++11-compat.h
tomsbuild.h
, because this file makes use of theoverride
keyword, and older compilers don't have it.<CommonCrypto/CommonDigest.h>
, not<CommonCrypto/CommonCrypto.h>
forCC_MD5()
. This is what the manpage documents, and Leopard will not find it without the proper header.realpath()
, not the POSIX.1-2008 one, because it will cause a crash on older systems. Don'tfree(rp);
anymore, since we're no longer using the heap for this.This is maybe useless (although the one for
CommonDigest.h
still looks good to me), or you may want to do this a bit differently, but here's my proposal :)Tested on Leopard and Mojave.