Home | History | Annotate | Download | only in patch
      1 --- a/build/build_config.h
      2 +++ b/build/build_config.h
      3 @@ -16,6 +16,40 @@
      4  #ifndef BUILD_BUILD_CONFIG_H_
      5  #define BUILD_BUILD_CONFIG_H_
      6  
      7 +// A brief primer on #defines:
      8 +//
      9 +// - __ANDROID__ is automatically defined by the Android toolchain (see
     10 +//   https://goo.gl/v61lXa). It's not defined when building host code.
     11 +// - __ANDROID_HOST__ is defined via -D by Android.mk when building host code
     12 +//   within an Android checkout.
     13 +// - ANDROID is defined via -D when building code for either Android targets or
     14 +//   hosts. Use __ANDROID__ and __ANDROID_HOST__ instead.
     15 +// - OS_ANDROID is a Chrome-specific define used to build Chrome for Android
     16 +//   within the NDK.
     17 +
     18 +// Android targets and hosts don't use tcmalloc.
     19 +#if defined(__ANDROID__) || defined(__ANDROID_HOST__)
     20 +#define NO_TCMALLOC
     21 +#endif  // defined(__ANDROID__) || defined(__ANDROID_HOST__)
     22 +
     23 +// Use the Chrome OS version of the code for both Android targets and Chrome OS builds.
     24 +#if !defined(__ANDROID_HOST__)
     25 +#define OS_CHROMEOS 1
     26 +#endif  // !defined(__ANDROID_HOST__)
     27 +
     28 +#if defined(__ANDROID__)  // Android targets
     29 +
     30 +#define __linux__ 1
     31 +
     32 +#elif !defined(__ANDROID_HOST__)  // Chrome OS
     33 +
     34 +// TODO: Remove these once the GLib MessageLoopForUI isn't being used:
     35 +// https://crbug.com/361635
     36 +#define USE_GLIB 1
     37 +#define USE_OZONE 1
     38 +
     39 +#endif  // defined(__ANDROID__)
     40 +
     41  // A set of macros to use for platform detection.
     42  #if defined(__native_client__)
     43  // __native_client__ must be first, so that other OS_ defines are not set.
     44 @@ -28,8 +62,7 @@
     45  #else
     46  #define OS_NACL_SFI
     47  #endif
     48 -#elif defined(ANDROID)
     49 -#define OS_ANDROID 1
     50 +// Don't set OS_ANDROID; it's only used when building Chrome for Android.
     51  #elif defined(__APPLE__)
     52  // only include TargetConditions after testing ANDROID as some android builds
     53  // on mac don't have this header available and it's not needed unless the target
     54