bug 1198226 - Move HOST_{C,CXX}FLAGS to moz.build HOST_{CFLAGS,CXXFLAGS,DEFINES}. r=mshal
authorTed Mielczarek <ted@mielczarek.org>
Tue, 08 Sep 2015 11:35:43 -0400
changeset 295887 3492202f465e1572cdbc4cf930b31f10e7735ab2
parent 295886 444ea60893cde03b26b6eb2d7af33aef5d968a06
child 295888 b54844d26cb6e9dc09b6378ba6173c386231790a
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1198226
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1198226 - Move HOST_{C,CXX}FLAGS to moz.build HOST_{CFLAGS,CXXFLAGS,DEFINES}. r=mshal As part of this move, HOST_NSPR_MDCPUCFG needed to be changed to get the quoting right.
build/unix/stdc++compat/Makefile.in
build/unix/stdc++compat/moz.build
config/Makefile.in
config/moz.build
configure.in
js/src/configure.in
modules/libmar/tool/Makefile.in
modules/libmar/tool/moz.build
mozglue/linker/Makefile.in
mozglue/linker/moz.build
other-licenses/bsdiff/Makefile.in
other-licenses/bsdiff/moz.build
toolkit/crashreporter/google-breakpad/src/common/Makefile.in
toolkit/crashreporter/google-breakpad/src/common/dwarf/Makefile.in
toolkit/crashreporter/google-breakpad/src/common/dwarf/moz.build
toolkit/crashreporter/google-breakpad/src/common/moz.build
--- a/build/unix/stdc++compat/Makefile.in
+++ b/build/unix/stdc++compat/Makefile.in
@@ -1,10 +1,7 @@
 # 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/.
 
 ENABLE_CLANG_PLUGIN :=
 
 include $(topsrcdir)/config/rules.mk
-
-CXXFLAGS += -DMOZ_LIBSTDCXX_VERSION=$(MOZ_LIBSTDCXX_TARGET_VERSION)
-HOST_CXXFLAGS += -DMOZ_LIBSTDCXX_VERSION=$(MOZ_LIBSTDCXX_HOST_VERSION)
--- a/build/unix/stdc++compat/moz.build
+++ b/build/unix/stdc++compat/moz.build
@@ -14,8 +14,11 @@ if CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']:
         'stdc++compat.cpp',
     ]
 
 FORCE_STATIC_LIB = True
 
 NO_PGO = True
 
 DISABLE_STL_WRAPPING = True
+
+DEFINES['MOZ_LIBSTDCXX_VERSION'] = CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION']
+HOST_DEFINES['MOZ_LIBSTDCXX_VERSION'] = CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -36,18 +36,16 @@ HEADERS_FILES = \
 	$(NULL)
 HEADERS_DEST := $(DIST)/include
 HEADERS_TARGET := export
 INSTALL_TARGETS += HEADERS
 endif
 
 include $(topsrcdir)/config/rules.mk
 
-HOST_CFLAGS += -DUNICODE -D_UNICODE
-
 ifndef JS_STANDALONE
 ifndef MOZ_PROFILE_USE
 # Generate a new buildid every time we "export" in config... that's only
 # supposed to be once per-build!
 export::
 ifdef MOZ_BUILD_DATE
 	printf '%s' $(MOZ_BUILD_DATE) > buildid
 else
--- a/config/moz.build
+++ b/config/moz.build
@@ -40,8 +40,13 @@ PYTHON_UNIT_TESTS += [
     'tests/unit-printprereleasesuffix.py',
 ]
 
 if CONFIG['GNU_CC'] and CONFIG['MOZ_OPTIMIZE']:
     CFLAGS += ['-O3']
 
 # XXX: We should fix these warnings.
 ALLOW_COMPILER_WARNINGS = True
+
+HOST_DEFINES = {
+    'UNICODE': True,
+    '_UNICODE': True,
+}
--- a/configure.in
+++ b/configure.in
@@ -1832,17 +1832,17 @@ case "$host" in
         HOST_AR=lib
         HOST_AR_FLAGS='-NOLOGO -OUT:$@'
         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
         HOST_RANLIB='echo ranlib'
     else
         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
     fi
     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
-    HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
+    HOST_NSPR_MDCPUCFG='"md/_winnt.cfg"'
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
     HOST_BIN_SUFFIX=.exe
     case "$host" in
     *mingw*)
         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
         ;;
     esac
 
@@ -1858,23 +1858,23 @@ case "$host" in
         fi
         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
         ;;
     esac
     ;;
 
 *-darwin*)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
-    HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
+    HOST_NSPR_MDCPUCFG='"md/_darwin.cfg"'
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
     ;;
 
 *-linux*|*-kfreebsd*-gnu|*-gnu*)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
-    HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
+    HOST_NSPR_MDCPUCFG='"md/_linux.cfg"'
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
     ;;
 
 *)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
     ;;
 esac
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -1431,17 +1431,16 @@ case "$host" in
         HOST_AR=lib
         HOST_AR_FLAGS='-NOLOGO -OUT:$@'
         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
         HOST_RANLIB='echo ranlib'
     else
         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
     fi
     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
-    HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
     HOST_BIN_SUFFIX=.exe
     case "$host" in
     *mingw*)
         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
         ;;
     esac
 
@@ -1457,23 +1456,21 @@ case "$host" in
         fi
         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
         ;;
     esac
     ;;
 
 *-darwin*)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
-    HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
     ;;
 
 *-linux*|*-kfreebsd*-gnu|*-gnu*)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
-    HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
     ;;
 
 *)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
     ;;
 esac
@@ -3713,17 +3710,16 @@ AC_SUBST(HOST_CXX)
 AC_SUBST(HOST_CFLAGS)
 AC_SUBST(HOST_CXXFLAGS)
 AC_SUBST(HOST_LDFLAGS)
 AC_SUBST(HOST_OPTIMIZE_FLAGS)
 AC_SUBST(HOST_AR)
 AC_SUBST(HOST_AR_FLAGS)
 AC_SUBST(HOST_LD)
 AC_SUBST(HOST_RANLIB)
-AC_SUBST(HOST_NSPR_MDCPUCFG)
 AC_SUBST(HOST_BIN_SUFFIX)
 AC_SUBST(HOST_OS_ARCH)
 
 AC_SUBST(TARGET_CPU)
 AC_SUBST(TARGET_VENDOR)
 AC_SUBST(TARGET_OS)
 AC_SUBST(TARGET_NSPR_MDCPUCFG)
 AC_SUBST(TARGET_MD_ARCH)
deleted file mode 100644
--- a/modules/libmar/tool/Makefile.in
+++ /dev/null
@@ -1,23 +0,0 @@
-# vim:set ts=8 sw=8 sts=8 noet:
-#
-# 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/.
-
-# The mar executable is output into dist/host/bin since it is something that
-# would only be used by our build system and should not itself be included in a
-# Mozilla distribution.
-
-HOST_CFLAGS += \
-  -DNO_SIGN_VERIFY \
-  $(DEFINES) \
-  $(NULL)
-
-include $(topsrcdir)/config/rules.mk
-
-ifdef CROSS_COMPILE
-ifdef HOST_NSPR_MDCPUCFG
-HOST_CFLAGS += -DMDCPUCFG=$(HOST_NSPR_MDCPUCFG)
-CFLAGS += -DMDCPUCFG=$(HOST_NSPR_MDCPUCFG)
-endif
-endif
--- a/modules/libmar/tool/moz.build
+++ b/modules/libmar/tool/moz.build
@@ -54,8 +54,18 @@ elif CONFIG['OS_ARCH'] == 'Darwin':
 
 if CONFIG['HOST_OS_ARCH'] == 'WINNT':
     HOST_OS_LIBS += [
         'ws2_32',
     ]
 
 # XXX: We should fix these warnings.
 ALLOW_COMPILER_WARNINGS = True
+
+HOST_CFLAGS += [
+    #TODO: bug 1200360 - don't pass make variables here
+    '$(DEFINES)',
+]
+
+HOST_DEFINES['NO_SIGN_VERIFY'] = True
+
+if CONFIG['CROSS_COMPILE'] and CONFIG['HOST_NSPR_MDCPUCFG']:
+    HOST_DEFINES['MDCPUCFG'] = CONFIG['HOST_NSPR_MDCPUCFG']
deleted file mode 100644
--- a/mozglue/linker/Makefile.in
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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/.
-
-include $(topsrcdir)/config/rules.mk
-
-ifeq (arm,$(TARGET_CPU))
-ifdef MOZ_THUMB2
-HOST_CXXFLAGS += -DTARGET_THUMB
-else
-HOST_CXXFLAGS += -DTARGET_ARM
-endif
-endif
-ifeq (x86,$(CPU_ARCH))
-HOST_CXXFLAGS += -DTARGET_X86
-endif
--- a/mozglue/linker/moz.build
+++ b/mozglue/linker/moz.build
@@ -28,8 +28,17 @@ DEFINES['IMPL_MFBT'] = True
 
 DISABLE_STL_WRAPPING = True
 
 TEST_DIRS += ['tests']
 
 HOST_OS_LIBS += [
     'z',
 ]
+
+if CONFIG['TARGET_CPU'] == 'arm':
+    if CONFIG['MOZ_THUMB2']:
+        HOST_DEFINES['TARGET_THUMB'] = True
+    else:
+        HOST_DEFINES['TARGET_ARM'] = True
+
+if CONFIG['CPU_ARCH'] == 'x86':
+    HOST_DEFINES['TARGET_X86'] = True
deleted file mode 100644
--- a/other-licenses/bsdiff/Makefile.in
+++ /dev/null
@@ -1,30 +0,0 @@
-# vim:set ts=8 sw=8 sts=8 noet:
-# 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/.
-
-# Portions created by the Initial Developer are Copyright (C) 2005
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-# This program is output to dist/host/bin because it is only needed by the
-# build system and is not intended to be included in Mozilla distributions.
-
-include $(topsrcdir)/config/rules.mk
-
-HOST_CXXFLAGS += $(MOZ_BZ2_CFLAGS)
--- a/other-licenses/bsdiff/moz.build
+++ b/other-licenses/bsdiff/moz.build
@@ -21,8 +21,9 @@ if CONFIG['HOST_OS_ARCH'] == 'WINNT':
     HOST_OS_LIBS += [
         'ws2_32',
     ]
 
 LOCAL_INCLUDES += [
     '/toolkit/mozapps/update/updater',
 ]
 
+HOST_CXXFLAGS += CONFIG['MOZ_BZ2_CFLAGS']
--- a/toolkit/crashreporter/google-breakpad/src/common/Makefile.in
+++ b/toolkit/crashreporter/google-breakpad/src/common/Makefile.in
@@ -1,24 +1,9 @@
 # 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/.
 
-ifneq (WINNT,$(OS_TARGET))
-ifdef MOZ_CRASHREPORTER
-endif
-endif
-
 ifeq ($(OS_TARGET),Android)
 TARGET_LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/crashreporter/google-breakpad/src/common/android/include/
 endif
 
-# This kind of sucks.
-ifeq (Linux,$(OS_ARCH))
-HOST_CXXFLAGS += -DHAVE_A_OUT_H
-OS_CXXFLAGS += -DHAVE_A_OUT_H
-endif
-ifeq (Darwin,$(OS_ARCH))
-HOST_CXXFLAGS += -DHAVE_MACH_O_NLIST_H
-OS_CXXFLAGS += -DHAVE_MACH_O_NLIST_H
-endif
-
 include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/toolkit/crashreporter/google-breakpad/src/common/dwarf/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-# 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/.
-
-# This code is only compiled for build-time tools,
-# so enabling RTTI should be fine.
-HOST_CXXFLAGS += -funsigned-char -frtti
--- a/toolkit/crashreporter/google-breakpad/src/common/dwarf/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/dwarf/moz.build
@@ -13,8 +13,16 @@ if CONFIG['MOZ_CRASHREPORTER']:
         'functioninfo.cc',
     ]
     LOCAL_INCLUDES += [
         '../..',
     ]
 
 # need static lib
 FORCE_STATIC_LIB = True
+
+# This code is only compiled for build-time tools,
+# so enabling RTTI should be fine.
+HOST_CXXFLAGS += [
+    '-frtti',
+    '-funsigned-char',
+]
+
--- a/toolkit/crashreporter/google-breakpad/src/common/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/moz.build
@@ -30,16 +30,18 @@ if CONFIG['OS_TARGET'] != 'WINNT':
         'md5.cc',
     ]
 
 if CONFIG['OS_ARCH'] == 'Linux':
     UNIFIED_SOURCES += [
         'linux/dump_symbols.cc',
         'linux/elf_symbols_to_module.cc',
     ]
+    HOST_DEFINES['HAVE_A_OUT_H'] = True
+    DEFINES['HAVE_A_OUT_H'] = True
 
 if CONFIG['OS_TARGET'] == 'Android':
     pass
 else:
     if CONFIG['OS_TARGET'] != 'WINNT':
         UNIFIED_SOURCES += [
             'stabs_reader.cc',
             'stabs_to_module.cc',
@@ -64,16 +66,18 @@ if CONFIG['OS_TARGET'] != 'WINNT' and CO
         'string_conversion.cc',
         'unique_string.cc',
     ]
 
 if CONFIG['OS_ARCH'] == 'Darwin':
     UNIFIED_SOURCES += [
         'mac/dump_syms.mm',
     ]
+    HOST_DEFINES['HAVE_MACH_O_NLIST_H'] = True
+    DEFINES['HAVE_MACH_O_NLIST_H'] = True
 
 if CONFIG['OS_TARGET'] == 'Android':
     # We don't support unifying assembly files.
     SOURCES += [
         'android/breakpad_getcontext.S',
     ]
 
 Library('breakpad_common_s')