|Version 1 (modified by email@example.com, 3 years ago) (diff)|
I propose that we change as follows:
1) Strictly separate platform adaptation (mandatory to run on a given OS, compiler, or CPU at all) from policy choices (what features to enable, what optional libraries to use).
2) Phase out PLATFORM macros completely - each use should be converted to a policy choice, or a platform adaptation decision.
3) Instead of ports being defined by a top-level PLATFORM macro, I propose that each port should have its own header file to define policy decisions. For example, I'd propose that the system Mac OS X WebKit should use PortCocoa.h, and the WebKit used by Safari for Windows should use PortWinCG.h. There may also be a PortIPhone.h. These port definition headers would live in their own top-level WebKit module. Each one would be completely owned by whoever is generally considered the "owner" of a given port. Because related ports on different platforms may wish to share policy choices, it's ok for Port headers to include shared headers for some choices. For example, all Apple-maintained ports may include PortApple.h. We could go even further and have PortDefault.h to make default choices of what features are enabled, that ports would have to explicitly override.
4) Platform adaptation macros would still be defined in Platform.h based on sniffing the environment, this would include things like the compiler, the underlying OS, available libc functions, and so forth.
Platform adaptation macros would be:
OS() - underlying operating system; only to be used for mandated low-level services like virtual memory, not to choose a GUI toolkit
OS(UNIX) - Any Unix-like OS OS(DARWIN) - Underlying OS is the base OS X environment OS(FREEBSD) - FreeBSD OS(WIN) - Any version of Windows OS(WINCE) - The embedded version of Windows
COMPILER() - the compiler being used to build the project
COMPILER(GCC) - GNU Compiler Collection COMPILER(MSVC) - Microsoft Visual C++ COMPILER(RVCT) - ARM compiler
HAVE() - specific system features (headers, functions or similar) that are present or not
HAVE(MMAP) - mmap() function is available HAVE(ERRNO_H) - errno.h header is available HAVE(MADV_FREE) - madvise(MADV_FREE) is available
Policy decision macros would be:
USE() - use a particular third-party library or optional OS service
ENABLE() - turn on a specific feature of WebKit
Some macros that would be completely phased out, in favor of platform and policy decisions:
PLATFORM(MAC) - A mix of things that should be USE(APPKIT), USE(NSURL_NET), ENABLE(OBJC_MAC_API) and a host of other things PLATFORM(WIN) - Hodgepodge of mandatory platform adaptation, optional platform adaptation, and choices specific to Apple's Mac Port PLATFORM(GTK) - Most of this would be replaced by USE(GTK) but perhaps different policy macros are appropriate in some cases. PLATFORM(CHROMIUM) - Grab-bag of various policy choices.