Bug 1463637: Remove mozilla-config.h hacks for Hunspell extra includes. r?glandium,build
MozReview-Commit-ID: 2yBlykhQsyV
new file mode 100644
--- /dev/null
+++ b/extensions/spellcheck/hunspell/glue/common.mozbuild
@@ -0,0 +1,18 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+@template
+def ForceInclude(*headers):
+ if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
+ include_flag = '-FI'
+ else:
+ include_flag = '-include'
+ for header in headers:
+ CXXFLAGS += [include_flag, header]
+
+@template
+def HunspellIncludes():
+ ForceInclude('hunspell_alloc_hooks.h', 'hunspell_fopen_hooks.h')
--- a/extensions/spellcheck/hunspell/glue/hunspell_alloc_hooks.h
+++ b/extensions/spellcheck/hunspell/glue/hunspell_alloc_hooks.h
@@ -34,19 +34,16 @@
#ifndef alloc_hooks_h__
#define alloc_hooks_h__
/**
* This file is force-included in hunspell code. Its purpose is to add memory
* reporting to hunspell without modifying its code, in order to ease future
* upgrades.
*
- * This file is force-included through mozilla-config.h which is generated
- * during the configure step.
- *
* Currently, the memory allocated using operator new/new[] is not being
* tracked, but that's OK, since almost all of the memory used by Hunspell is
* allocated using C memory allocation functions.
*/
#include "mozilla/mozalloc.h"
#include "mozHunspellAllocator.h"
--- a/extensions/spellcheck/hunspell/glue/hunspell_fopen_hooks.h
+++ b/extensions/spellcheck/hunspell/glue/hunspell_fopen_hooks.h
@@ -4,19 +4,16 @@
#ifndef fopen_hooks_h__
#define fopen_hooks_h__
/**
* This file is force-included in hunspell code. Its purpose is to add
* readahead to fopen() calls in hunspell without modifying its code, in order
* to ease future upgrades.
- *
- * This file is force-included through mozilla-config.h which is generated
- * during the configure step.
*/
#include "mozilla/FileUtils.h"
#include <stdio.h>
#include <string.h>
#if defined(XP_WIN)
#include "nsNativeCharsetUtils.h"
--- a/extensions/spellcheck/hunspell/glue/moz.build
+++ b/extensions/spellcheck/hunspell/glue/moz.build
@@ -15,21 +15,20 @@ FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
'../src',
'/dom/base',
'/extensions/spellcheck/src',
]
include('/ipc/chromium/chromium-config.mozbuild')
+include('common.mozbuild')
+
+HunspellIncludes()
IPDL_SOURCES = [
'PRemoteSpellcheckEngine.ipdl',
]
EXPORTS.mozilla += [
'RemoteSpellCheckEngineChild.h',
'RemoteSpellCheckEngineParent.h',
]
-
-# This variable is referenced in mozilla-config.h.in. Make sure to change
-# that file too if you need to change this variable.
-DEFINES['HUNSPELL_STATIC'] = True
--- a/extensions/spellcheck/hunspell/src/moz.build
+++ b/extensions/spellcheck/hunspell/src/moz.build
@@ -10,27 +10,26 @@ UNIFIED_SOURCES += [
'csutil.cxx',
'hashmgr.cxx',
'hunspell.cxx',
'phonet.cxx',
'replist.cxx',
'suggestmgr.cxx',
]
-# This variable is referenced in mozilla-config.h.in. Make sure to change
-# that file too if you need to change this variable.
-DEFINES['HUNSPELL_STATIC'] = True
-
FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
'../glue',
]
# We allow warnings for third-party code that can be updated from upstream.
AllowCompilerWarnings()
include('/ipc/chromium/chromium-config.mozbuild')
+include('../glue/common.mozbuild')
+
+HunspellIncludes()
if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
CXXFLAGS += [
'-Wno-implicit-fallthrough',
]
--- a/mozilla-config.h.in
+++ b/mozilla-config.h.in
@@ -33,27 +33,16 @@
#define __STDC_FORMAT_MACROS
#endif
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
/*
- * Force-include hunspell_alloc_hooks.h and hunspell_fopen_hooks.h for hunspell,
- * so that we don't need to modify them directly.
- *
- * HUNSPELL_STATIC is defined in extensions/spellcheck/hunspell/src/moz.build
- */
-#if defined(HUNSPELL_STATIC)
-#include "hunspell_alloc_hooks.h"
-#include "hunspell_fopen_hooks.h"
-#endif
-
-/*
* Force-include sdkdecls.h for building the chromium sandbox code.
*
* CHROMIUM_SANDBOX_BUILD is defined in security/sandbox/moz.build.
* Note that this include path relies on the LOCAL_INCLUDES in that file.
*/
#if defined(CHROMIUM_SANDBOX_BUILD) && defined(XP_WIN)
#include "base/win/sdkdecls.h"