| 1 |
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- |
| 2 |
# vim: set filetype=python: |
| 3 |
# This Source Code Form is subject to the terms of the Mozilla Public |
| 4 |
# License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 6 |
|
| 7 |
# Also see <http://www.icu-project.org/repos/icu/tags/latest/icu4c/readme.html#RecBuild> for the |
| 8 |
# recommended build options when compiling ICU. |
| 9 |
# Don't use icu namespace automatically in client code. |
| 10 |
DEFINES["U_USING_ICU_NAMESPACE"] = 0 |
| 11 |
# Don't include obsolete header files. |
| 12 |
DEFINES["U_NO_DEFAULT_INCLUDE_UTF_HEADERS"] = 1 |
| 13 |
DEFINES["U_HIDE_OBSOLETE_UTF_OLD_H"] = 1 |
| 14 |
|
| 15 |
# Remove chunks of the library that we don't need (yet). |
| 16 |
DEFINES["UCONFIG_NO_LEGACY_CONVERSION"] = True |
| 17 |
DEFINES["UCONFIG_NO_TRANSLITERATION"] = True |
| 18 |
DEFINES["UCONFIG_NO_REGULAR_EXPRESSIONS"] = True |
| 19 |
DEFINES["UCONFIG_NO_BREAK_ITERATION"] = True |
| 20 |
DEFINES["UCONFIG_NO_IDNA"] = True |
| 21 |
DEFINES["UCONFIG_NO_MF2"] = True |
| 22 |
|
| 23 |
# We don't need to pass data to and from legacy char* APIs. |
| 24 |
DEFINES["U_CHARSET_IS_UTF8"] = True |
| 25 |
|
| 26 |
# Add 'explicit' keyword to UnicodeString constructors. |
| 27 |
DEFINES["UNISTR_FROM_CHAR_EXPLICIT"] = "explicit" |
| 28 |
DEFINES["UNISTR_FROM_STRING_EXPLICIT"] = "explicit" |
| 29 |
|
| 30 |
# Disable dynamic loading of ICU data as a loadable library. |
| 31 |
DEFINES["U_ENABLE_DYLOAD"] = 0 |
| 32 |
|
| 33 |
if not CONFIG["HAVE_LANGINFO_CODESET"]: |
| 34 |
DEFINES["U_HAVE_NL_LANGINFO_CODESET"] = 0 |
| 35 |
|
| 36 |
if CONFIG["MOZ_DEBUG"]: |
| 37 |
DEFINES["U_DEBUG"] = 1 |
| 38 |
|
| 39 |
# ICU requires RTTI |
| 40 |
if CONFIG["CC_TYPE"] in ("clang", "gcc"): |
| 41 |
CXXFLAGS += ["-frtti"] |
| 42 |
elif CONFIG["OS_TARGET"] == "WINNT": |
| 43 |
# Remove the -GR- flag so we don't get a bunch of warning spam. |
| 44 |
COMPILE_FLAGS["OS_CXXFLAGS"] = [ |
| 45 |
f for f in COMPILE_FLAGS["OS_CXXFLAGS"] if f != "-GR-" |
| 46 |
] + ["-GR"] |
| 47 |
|
| 48 |
DisableStlWrapping() |
| 49 |
AllowCompilerWarnings() |
| 50 |
|
| 51 |
# We allow compiler warnings, but we can at least cut down on spammy |
| 52 |
# warnings that get triggered for every file. |
| 53 |
if CONFIG["CC_TYPE"] in ("clang", "clang-cl"): |
| 54 |
CFLAGS += [ |
| 55 |
"-Wno-comma", |
| 56 |
"-Wno-implicit-const-int-float-conversion", |
| 57 |
"-Wno-macro-redefined", |
| 58 |
"-Wno-microsoft-include", |
| 59 |
"-Wno-tautological-unsigned-enum-zero-compare", |
| 60 |
"-Wno-unreachable-code-loop-increment", |
| 61 |
"-Wno-unreachable-code-return", |
| 62 |
] |
| 63 |
CXXFLAGS += [ |
| 64 |
"-Wno-comma", |
| 65 |
"-Wno-implicit-const-int-float-conversion", |
| 66 |
"-Wno-macro-redefined", |
| 67 |
"-Wno-microsoft-include", |
| 68 |
"-Wno-tautological-unsigned-enum-zero-compare", |
| 69 |
"-Wno-unreachable-code-loop-increment", |
| 70 |
"-Wno-unreachable-code-return", |
| 71 |
] |
| 72 |
|
| 73 |
for k, v in DEFINES.items(): |
| 74 |
if k != "UCONFIG_NO_LEGACY_CONVERSION": |
| 75 |
HOST_DEFINES[k] = v |