Bug 1132771 - moz.build fixups to enable execution in no config mode draft
authorGregory Szorc <gps@mozilla.com>
Thu, 19 Feb 2015 10:58:41 -0800
changeset 243492 090de0411f5a19bc094294803706ddbb01ed4ad6
parent 243486 b82df0b1e8cc016f38416e46e40e94a0f520bfa7
child 243493 8b0279673d8de1c69f53944cc1a48a1c9eafe739
push id730
push usergszorc@mozilla.com
push dateThu, 19 Feb 2015 19:19:13 +0000
bugs1132771
milestone38.0a1
Bug 1132771 - moz.build fixups to enable execution in no config mode Various moz.build files fail to execute when a build config is not present. Many of these are due to assuming certain CONFIG entries are present. This patch attempts to fix them all.
build/gyp.mozbuild
build/unix/elfhack/inject/moz.build
config/external/icu/moz.build
extensions/moz.build
gfx/cairo/libpixman/src/moz.build
gfx/qcms/moz.build
ipc/chromium/moz.build
ipc/glue/moz.build
media/libtheora/moz.build
mobile/android/base/moz.build
moz.build
mozglue/build/moz.build
netwerk/build/moz.build
security/sandbox/linux/moz.build
toolkit/content/moz.build
toolkit/library/StaticXULComponentsEnd/moz.build
toolkit/library/moz.build
widget/gtk/mozgtk/gtk2/moz.build
widget/gtk/mozgtk/gtk3/moz.build
xpcom/reflect/xptcall/md/unix/moz.build
xulrunner/stub/moz.build
--- a/build/gyp.mozbuild
+++ b/build/gyp.mozbuild
@@ -90,17 +90,18 @@ flavors = {
     'Darwin': 'mac' if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' else 'ios',
     'SunOS': 'solaris',
     'GNU/kFreeBSD': 'freebsd',
     'DragonFly': 'dragonfly',
     'FreeBSD': 'freebsd',
     'NetBSD': 'netbsd',
     'OpenBSD': 'openbsd',
 }
-gyp_vars['OS'] = flavors[os]
+
+gyp_vars['OS'] = flavors.get(os)
 
 arches = {
     'x86_64': 'x64',
     'x86': 'ia32',
 }
 
 gyp_vars['target_arch'] = arches.get(CONFIG['CPU_ARCH'], CONFIG['CPU_ARCH'])
 
--- a/build/unix/elfhack/inject/moz.build
+++ b/build/unix/elfhack/inject/moz.build
@@ -1,22 +1,24 @@
 # -*- Mode: python; c-basic-offset: 4; 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/.
 
 NO_DIST_INSTALL = True
 
-if CONFIG['TARGET_CPU'].endswith('86'):
+target = CONFIG['TARGET_CPU'] or ''
+
+if target.endswith('86'):
     cpu = 'x86'
-elif CONFIG['TARGET_CPU'].startswith('arm'):
+elif target.startswith('arm'):
     cpu = 'arm'
 else:
-    cpu = CONFIG['TARGET_CPU']
+    cpu = target
 
 GENERATED_SOURCES += [
     "%s.c" % cpu,
 ]
 
 DEFINES['ELFHACK_BUILD'] = True
 
 NO_PGO = True
--- a/config/external/icu/moz.build
+++ b/config/external/icu/moz.build
@@ -5,14 +5,14 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 Library('icu')
 
 if CONFIG['MOZ_NATIVE_ICU']:
     OS_LIBS += CONFIG['MOZ_ICU_LIBS']
 else:
     # Order needs to be preserved
-    for l in CONFIG['ICU_LIB_NAMES']:
+    for l in (CONFIG['ICU_LIB_NAMES'] or []):
         USE_LIBS += ['%s/intl/icu/target/lib/%s%s' % (
             'static:' if not CONFIG['MOZ_SHARED_ICU'] else '',
             l,
             CONFIG['MOZ_ICU_DBG_SUFFIX']
         )]
--- a/extensions/moz.build
+++ b/extensions/moz.build
@@ -1,7 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; 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/.
 
-DIRS += CONFIG['MOZ_EXTENSIONS'].split()
+if CONFIG['MOZ_EXTENSIONS']:
+    DIRS += CONFIG['MOZ_EXTENSIONS'].split()
--- a/gfx/cairo/libpixman/src/moz.build
+++ b/gfx/cairo/libpixman/src/moz.build
@@ -75,37 +75,39 @@ DEFINES['PACKAGE'] = 'mozpixman'
 
 DEFINES['_USE_MATH_DEFINES'] = True
 
 use_mmx = False
 use_sse2 = False
 use_vmx = False
 use_arm_simd_gcc = False
 use_arm_neon_gcc = False
-if '86' in CONFIG['OS_TEST']:
-    if '64' in CONFIG['OS_TEST']:
+
+os_test = CONFIG['OS_TEST'] or ''
+if '86' in os_test:
+    if '64' in os_test:
         if CONFIG['GNU_CC']:
             use_sse2 = True
     else:
         if CONFIG['_MSC_VER']:
             use_mmx = True
         if CONFIG['HAVE_GCC_ALIGN_ARG_POINTER']:
             use_sse2 = True
     if CONFIG['GNU_CC']:
         use_mmx = True
     if CONFIG['_MSC_VER']:
         use_sse2 = True
-elif 'ppc' in CONFIG['OS_TEST']:
+elif 'ppc' in os_test:
     if CONFIG['GNU_CC']:
         use_vmx = True
 # Apple's arm assembler doesn't support the same syntax as
 # the standard GNU assembler, so use the C fallback paths for now.
 # This may be fixable if clang's ARM/iOS assembler improves into a
 # viable solution in the future.
-elif 'arm' in CONFIG['OS_TEST']:
+elif 'arm' in os_test:
     if CONFIG['OS_ARCH'] != 'Darwin':
         if CONFIG['HAVE_ARM_SIMD']:
             use_arm_simd_gcc = True
         if CONFIG['HAVE_ARM_NEON']:
             use_arm_neon_gcc = True
 
 if use_mmx:
     DEFINES['USE_MMX'] = True
--- a/gfx/qcms/moz.build
+++ b/gfx/qcms/moz.build
@@ -22,24 +22,27 @@ MSVC_ENABLE_PGO = True
 FINAL_LIBRARY = 'gkmedias'
 
 if CONFIG['GNU_CC']:
     CFLAGS += ['-Wno-missing-field-initializers']
 
 use_sse1 = False
 use_sse2 = False
 use_altivec = False
-if '86' in CONFIG['OS_TEST']:
+os_test = CONFIG['OS_TEST'] or ''
+cpu_arch = CONFIG['CPU_ARCH'] or ''
+
+if '86' in os_test:
     use_sse2 = True
     if CONFIG['_MSC_VER']:
-        if CONFIG['OS_ARCH'] != 'WINNT' or CONFIG['OS_TEST'] != 'x86_64':
+        if CONFIG['OS_ARCH'] != 'WINNT' or os_test != 'x86_64':
             use_sse1 = True
     else:
         use_sse1 = True
-elif 'ppc' in CONFIG['CPU_ARCH']:
+elif 'ppc' in cpu_arch:
     if CONFIG['GNU_CC']:
         use_altivec = True
 
 if use_sse1:
     SOURCES += ['transform-sse1.c']
     SOURCES['transform-sse1.c'].flags += CONFIG['SSE_FLAGS']
     if CONFIG['SOLARIS_SUNPRO_CC']:
         if '64' in CONFIG['OS_TEST']:
--- a/ipc/chromium/moz.build
+++ b/ipc/chromium/moz.build
@@ -241,17 +241,17 @@ if os_bsd:
             'moc_message_pump_qt.cc',
         ]
     if not CONFIG['MOZ_NATIVE_LIBEVENT']:
         SOURCES += [
             'src/third_party/libevent/kqueue.c',
         ]
         LOCAL_INCLUDES += ['src/third_party/libevent/bsd']
 
-ost = CONFIG['OS_TEST']
+ost = CONFIG['OS_TEST'] or ''
 if ost.find('86') == -1 and ost.find('arm') == -1 and ost.find('mips') == -1:
     SOURCES += [
         'src/base/atomicops_internals_mutex.cc',
     ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
--- a/ipc/glue/moz.build
+++ b/ipc/glue/moz.build
@@ -82,17 +82,17 @@ else:
 if CONFIG['OS_ARCH'] == 'Linux':
     UNIFIED_SOURCES += [
         'ProcessUtils_linux.cpp',
     ]
 elif CONFIG['OS_ARCH'] in ('DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD'):
     UNIFIED_SOURCES += [
         'ProcessUtils_bsd.cpp'
     ]
-elif CONFIG['OS_ARCH'] in ('Darwin'):
+elif CONFIG['OS_ARCH'] == 'Darwin':
     UNIFIED_SOURCES += [
         'ProcessUtils_mac.mm'
     ]
 else:
     UNIFIED_SOURCES += [
         'ProcessUtils_none.cpp',
     ]
 
--- a/media/libtheora/moz.build
+++ b/media/libtheora/moz.build
@@ -47,24 +47,25 @@ LOCAL_INCLUDES += ['include']
 if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_AS']:
     GENERATED_SOURCES += [ '%s.%s' % (f, CONFIG['ASM_SUFFIX']) for f in [
         'armbits-gnu',
         'armfrag-gnu',
         'armidct-gnu',
         'armloop-gnu',
     ]]
 
-if '86' in CONFIG['OS_TEST']:
+os_test = CONFIG['OS_TEST'] or ''
+if '86' in os_test:
     if CONFIG['OS_ARCH'] != 'SunOS':
-        if CONFIG['OS_ARCH'] != 'WINNT' or CONFIG['OS_TEST'] != 'x86_64':
+        if CONFIG['OS_ARCH'] != 'WINNT' or os_test != 'x86_64':
             DEFINES['OC_X86_ASM'] = True
-            if '64' in CONFIG['OS_TEST']:
+            if '64' in os_test:
                 DEFINES['OC_X86_64_ASM'] = True
     if CONFIG['_MSC_VER']:
-        if '64' not in CONFIG['OS_TEST']:
+        if '64' not in os_test:
             SOURCES += [
                 'lib/x86_vc/mmxfrag.c',
                 'lib/x86_vc/mmxidct.c',
                 'lib/x86_vc/mmxstate.c',
                 'lib/x86_vc/x86cpu.c',
                 'lib/x86_vc/x86state.c',
             ]
     else:
@@ -73,17 +74,17 @@ if '86' in CONFIG['OS_TEST']:
             'lib/x86/mmxidct.c',
             'lib/x86/mmxstate.c',
             'lib/x86/sse2idct.c',
             'lib/x86/x86cpu.c',
             'lib/x86/x86state.c',
         ]
 
 if CONFIG['GNU_AS']:
-    if 'arm' in CONFIG['OS_TEST']:
+    if 'arm' in os_test:
         SOURCES += [
             'lib/arm/armcpu.c',
             'lib/arm/armstate.c',
         ]
         for var in ('OC_ARM_ASM',
                     'OC_ARM_ASM_EDSP',
                     'OC_ARM_ASM_MEDIA',
                     'OC_ARM_ASM_NEON'):
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -521,17 +521,18 @@ gbjar.sources += [
     'widget/ThemedTextView.java',
     'widget/ThemedView.java',
 ]
 gbjar.sources += [ thirdparty_source_dir + f for f in [
     'com/googlecode/eyesfree/braille/selfbraille/ISelfBrailleService.java',
     'com/googlecode/eyesfree/braille/selfbraille/SelfBrailleClient.java',
     'com/googlecode/eyesfree/braille/selfbraille/WriteData.java',
 ] ]
-android_package_dir = CONFIG['ANDROID_PACKAGE_NAME'].replace('.', '/')
+package_name = CONFIG['ANDROID_PACKAGE_NAME'] or ''
+android_package_dir = package_name.replace('.', '/')
 gbjar.generated_sources = [] # Keep it this way.
 gbjar.extra_jars += [
     'constants.jar'
 ]
 if CONFIG['MOZ_CRASHREPORTER']:
     gbjar.sources += [ 'CrashReporter.java' ]
     ANDROID_RES_DIRS += [ SRCDIR + '/crashreporter/res' ]
 
@@ -666,17 +667,17 @@ gtjar.sources += [ thirdparty_source_dir
 if not CONFIG['MOZILLA_OFFICIAL']:
     gtjar.sources += [ thirdparty_source_dir + f for f in [
         'org/lucasr/dspec/DesignSpec.java',
         'org/lucasr/dspec/RawResource.java'
     ] ]
 
 ANDROID_RES_DIRS += [
     SRCDIR + '/resources',
-    TOPSRCDIR + '/' + CONFIG['MOZ_BRANDING_DIRECTORY'] + '/res',
+    TOPSRCDIR + '/' + (CONFIG['MOZ_BRANDING_DIRECTORY'] or '') + '/res',
     OBJDIR + '/res',
 ]
 
 ANDROID_GENERATED_RESFILES += [
     'res/raw/suggestedsites.json',
     'res/values/strings.xml',
 ]
 
@@ -695,20 +696,20 @@ for var in ('ANDROID_PACKAGE_NAME', 'AND
             'GRE_MILESTONE', 'MOZ_APP_BASENAME', 'MOZ_MOZILLA_API_KEY',
             'MOZ_APP_DISPLAYNAME', 'MOZ_APP_ID', 'MOZ_APP_NAME',
             'MOZ_APP_VENDOR', 'MOZ_APP_VERSION', 'MOZ_CHILD_PROCESS_NAME',
             'MOZ_CRASHREPORTER', 'MOZ_UPDATE_CHANNEL', 'OMNIJAR_NAME',
             'OS_TARGET', 'TARGET_XPCOM_ABI'):
     DEFINES[var] = CONFIG[var]
 
 # Mangle our package name to avoid Bug 750548.
-DEFINES['MANGLED_ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME'].replace('fennec', 'f3nn3c')
+DEFINES['MANGLED_ANDROID_PACKAGE_NAME'] = (CONFIG['ANDROID_PACKAGE_NAME'] or '').replace('fennec', 'f3nn3c')
 DEFINES['MOZ_APP_ABI'] = CONFIG['TARGET_XPCOM_ABI']
 
-if '-march=armv7' in CONFIG['OS_CFLAGS']:
+if '-march=armv7' in (CONFIG['OS_CFLAGS'] or ''):
     DEFINES['MOZ_MIN_CPU_VERSION'] = 7
 else:
     DEFINES['MOZ_MIN_CPU_VERSION'] = 5
 
 if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']:
     # The Search Activity is mostly independent of Fennec proper, but
     # it does depend on Geckoview.  Therefore, we build it as a jar
     # that depends on the Geckoview jars.
@@ -731,17 +732,17 @@ generated_recursive_make_targets = ['.aa
 
 generated = add_android_eclipse_library_project('FennecResourcesGenerated')
 generated.package_name = 'org.mozilla.gecko.generated'
 generated.res = OBJDIR + '/res'
 generated.recursive_make_targets += generated_recursive_make_targets
 
 branding = add_android_eclipse_library_project('FennecResourcesBranding')
 branding.package_name = 'org.mozilla.gecko.branding'
-branding.res = TOPSRCDIR + '/' + CONFIG['MOZ_BRANDING_DIRECTORY'] + '/res'
+branding.res = TOPSRCDIR + '/' + (CONFIG['MOZ_BRANDING_DIRECTORY'] or '') + '/res'
 branding.recursive_make_targets += generated_recursive_make_targets
 
 static = add_android_eclipse_library_project('FennecResourcesStatic')
 # 'org.mozilla.gecko.static' is not a valid Java package name, so we use a different one.
 static.package_name = 'org.mozilla.gecko.resources'
 static.res = SRCDIR + '/resources'
 static.recursive_make_targets += generated_recursive_make_targets
 static.included_projects += ['../' + generated.name, '../' + branding.name]
@@ -760,20 +761,20 @@ main.filtered_resources += [
 
 main.recursive_make_targets += generated_recursive_make_targets
 main.recursive_make_targets += ['generated/' + f for f in mgjar.generated_sources]
 main.recursive_make_targets += ['generated/' + f for f in gbjar.generated_sources]
 
 main.extra_jars += [CONFIG['ANDROID_COMPAT_LIB']]
 main.assets = TOPOBJDIR + '/dist/' + CONFIG['MOZ_APP_NAME'] + '/assets'
 main.libs = [
-    (TOPOBJDIR + '/dist/' + CONFIG['MOZ_APP_NAME'] + '/lib/' + CONFIG['ANDROID_CPU_ARCH'] + '/libmozglue.so',
-     'libs/' + CONFIG['ANDROID_CPU_ARCH'] + '/libmozglue.so'),
-    (TOPOBJDIR + '/dist/' + CONFIG['MOZ_APP_NAME'] + '/lib/' + CONFIG['ANDROID_CPU_ARCH'] + '/libplugin-container.so',
-     'libs/' + CONFIG['ANDROID_CPU_ARCH'] + '/libplugin-container.so'),
+    (TOPOBJDIR + '/dist/' + CONFIG['MOZ_APP_NAME'] + '/lib/' + (CONFIG['ANDROID_CPU_ARCH'] or '') + '/libmozglue.so',
+     'libs/' + (CONFIG['ANDROID_CPU_ARCH'] or '') + '/libmozglue.so'),
+    (TOPOBJDIR + '/dist/' + CONFIG['MOZ_APP_NAME'] + '/lib/' + (CONFIG['ANDROID_CPU_ARCH'] or '') + '/libplugin-container.so',
+     'libs/' + (CONFIG['ANDROID_CPU_ARCH'] or '') + '/libplugin-container.so'),
 ]
 main.res = None
 
 cpe = main.add_classpathentry('src', SRCDIR,
     dstdir='src/org/mozilla/gecko',
     exclude_patterns=[
         'org/mozilla/gecko/tests/**',
         'org/mozilla/gecko/resources/**'])
--- a/moz.build
+++ b/moz.build
@@ -61,13 +61,13 @@ if CONFIG['COMPILE_ENVIRONMENT'] and not
         ]
 
     if CONFIG['BUILD_CTYPES']:
         DIRS += ['config/external/ffi']
     if CONFIG['USE_ICU']:
         DIRS += ['config/external/icu']
     DIRS += ['js/src']
 
-if not CONFIG['JS_STANDALONE']:
+if not CONFIG['JS_STANDALONE'] and CONFIG['MOZ_BUILD_APP']:
     # Bring in the configuration for the configured application.
     include('/' + CONFIG['MOZ_BUILD_APP'] + '/app.mozbuild')
 
 include('build/templates.mozbuild')
--- a/mozglue/build/moz.build
+++ b/mozglue/build/moz.build
@@ -47,17 +47,17 @@ if CONFIG['MOZ_NUWA_PROCESS']:
     ]
 
 EXPORTS.mozilla += [
     'arm.h',
     'SSE.h',
     'WindowsDllBlocklist.h',
 ]
 
-if CONFIG['CPU_ARCH'].startswith('x86'):
+if (CONFIG['CPU_ARCH'] or '').startswith('x86'):
     SOURCES += [
         'SSE.cpp',
     ]
 
 if CONFIG['CPU_ARCH'] == 'arm':
     SOURCES += [
         'arm.cpp',
     ]
--- a/netwerk/build/moz.build
+++ b/netwerk/build/moz.build
@@ -28,17 +28,18 @@ LOCAL_INCLUDES += [
     '/netwerk/protocol/about',
     '/netwerk/protocol/app',
     '/netwerk/socket',
     '/netwerk/streamconv',
     '/netwerk/streamconv/converters',
 ]
 
 protocols = CONFIG['NECKO_PROTOCOLS'].copy()
-protocols.remove("about")
+if 'about' in protocols:
+    protocols.remove('about')
 LOCAL_INCLUDES += sorted([
     '/netwerk/protocol/%s' % d for d in protocols
 ])
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     LOCAL_INCLUDES += [
         '/netwerk/system/win32',
     ]
--- a/security/sandbox/linux/moz.build
+++ b/security/sandbox/linux/moz.build
@@ -57,17 +57,17 @@ SOURCES += [
     'Sandbox.cpp',
     'SandboxAssembler.cpp',
     'SandboxFilter.cpp',
 ]
 
 # gcc lto likes to put the top level asm in syscall.cc in a different partition
 # from the function using it which breaks the build.  Work around that by
 # forcing there to be only one partition.
-if '-flto' in CONFIG['OS_CXXFLAGS'] and not CONFIG['CLANG_CXX']:
+if '-flto' in (CONFIG['OS_CXXFLAGS'] or '') and not CONFIG['CLANG_CXX']:
     LDFLAGS += ['--param lto-partitions=1']
 
 DEFINES['NS_NO_XPCOM'] = True
 DISABLE_STL_WRAPPING = True
 
 LOCAL_INCLUDES += ['/security/sandbox/chromium-shim']
 LOCAL_INCLUDES += ['/security/sandbox/chromium']
 LOCAL_INCLUDES += ['/nsprpub']
--- a/toolkit/content/moz.build
+++ b/toolkit/content/moz.build
@@ -10,12 +10,12 @@ for var in ('target', 'ac_configure_args
             'CXX', 'CXX_VERSION'):
     DEFINES[var] = CONFIG[var]
 
 DEFINES['CFLAGS'] = CONFIG['OS_CFLAGS']
 
 if CONFIG['OS_TARGET'] == 'Android':
     DEFINES['ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME']
 
-if 'stlport' in CONFIG['STLPORT_LIBS']:
+if 'stlport' in (CONFIG['STLPORT_LIBS'] or ''):
     DEFINES['USE_STLPORT'] = True
 
 JAR_MANIFESTS += ['jar.mn']
--- a/toolkit/library/StaticXULComponentsEnd/moz.build
+++ b/toolkit/library/StaticXULComponentsEnd/moz.build
@@ -2,16 +2,16 @@
 # 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/.
 
 SOURCES += [
     'StaticXULComponentsEnd.cpp',
 ]
 
 # Don't let LTO reorder StaticXULComponentsStart.o.
-if '-flto' in CONFIG['OS_CXXFLAGS']:
+if '-flto' in (CONFIG['OS_CXXFLAGS'] or ''):
     SOURCES['StaticXULComponentsEnd.cpp'].flags += ['-fno-lto']
 
 Library('StaticXULComponentsEnd')
 
 DEFINES['MOZILLA_INTERNAL_API'] = True
 
 FAIL_ON_WARNINGS = True
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -72,17 +72,17 @@ SOURCES += [
 
 MSVC_ENABLE_PGO = True
 
 # This, combined with the fact the file is first, makes the start pointer
 # it contains first in Windows PGO builds.
 SOURCES['StaticXULComponentsStart.cpp'].no_pgo = True
 
 # Don't let LTO reorder StaticXULComponentsStart.o.
-if '-flto' in CONFIG['OS_CXXFLAGS']:
+if '-flto' in (CONFIG['OS_CXXFLAGS'] or ''):
     SOURCES['StaticXULComponentsStart.cpp'].flags += ['-fno-lto']
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     SOURCES += [
         'nsDllMain.cpp',
     ]
 
 LOCAL_INCLUDES += [
--- a/widget/gtk/mozgtk/gtk2/moz.build
+++ b/widget/gtk/mozgtk/gtk2/moz.build
@@ -13,22 +13,22 @@ DEFINES['GTK3_SYMBOLS'] = True
 SharedLibrary('mozgtk2')
 
 SONAME = 'mozgtk'
 
 # If LDFLAGS contains -Wl,--as-needed, we need to add -Wl,--no-as-needed
 # before the gtk libraries, otherwise the linker will drop those dependencies
 # because no symbols are used from them. But those dependencies need to be
 # kept for things to work properly.
-if '-Wl,--as-needed' in CONFIG['OS_LDFLAGS']:
+if '-Wl,--as-needed' in (CONFIG['OS_LDFLAGS'] or ''):
     no_as_needed = ['-Wl,--no-as-needed']
     as_needed = ['-Wl,--as-needed']
 else:
     no_as_needed = []
     as_needed = []
 
-OS_LIBS += [f for f in CONFIG['MOZ_GTK2_LIBS'] if f.startswith('-L')]
+OS_LIBS += [f for f in (CONFIG['MOZ_GTK2_LIBS'] or '') if f.startswith('-L')]
 OS_LIBS += no_as_needed
 OS_LIBS += [
     'gtk-x11-2.0',
     'gdk-x11-2.0',
 ]
 OS_LIBS += as_needed
--- a/widget/gtk/mozgtk/gtk3/moz.build
+++ b/widget/gtk/mozgtk/gtk3/moz.build
@@ -13,22 +13,22 @@ DEFINES['GTK2_SYMBOLS'] = True
 SharedLibrary('mozgtk')
 
 SONAME = 'mozgtk'
 
 # If LDFLAGS contains -Wl,--as-needed, we need to add -Wl,--no-as-needed
 # before the gtk libraries, otherwise the linker will drop those dependencies
 # because no symbols are used from them. But those dependencies need to be
 # kept for things to work properly.
-if '-Wl,--as-needed' in CONFIG['OS_LDFLAGS']:
+if '-Wl,--as-needed' in (CONFIG['OS_LDFLAGS'] or ''):
     no_as_needed = ['-Wl,--no-as-needed']
     as_needed = ['-Wl,--as-needed']
 else:
     no_as_needed = []
     as_needed = []
 
-OS_LIBS += [f for f in CONFIG['MOZ_GTK3_LIBS'] if f.startswith('-L')]
+OS_LIBS += [f for f in (CONFIG['MOZ_GTK3_LIBS'] or '') if f.startswith('-L')]
 OS_LIBS += no_as_needed
 OS_LIBS += [
     'gtk-3',
     'gdk-3',
 ]
 OS_LIBS += as_needed
--- a/xpcom/reflect/xptcall/md/unix/moz.build
+++ b/xpcom/reflect/xptcall/md/unix/moz.build
@@ -22,17 +22,17 @@ if CONFIG['OS_ARCH'] == 'Darwin':
 if CONFIG['OS_ARCH'] == 'GNU':
     if CONFIG['CPU_ARCH'] == 'x86':
         SOURCES += [
             'xptcinvoke_gcc_x86_unix.cpp',
             'xptcstubs_gcc_x86_unix.cpp'
         ]
 
 if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD', 'NetBSD', 'OpenBSD') or \
-   CONFIG['OS_ARCH'].startswith('GNU_'):
+   (CONFIG['OS_ARCH'] or '').startswith('GNU_'):
     if CONFIG['OS_TEST'] == 'x86_64':
         SOURCES += [
             'xptcinvoke_x86_64_unix.cpp',
             'xptcstubs_x86_64_linux.cpp',
         ]
     elif CONFIG['OS_TEST'].find('86') != -1:
         SOURCES += [
             'xptcinvoke_gcc_x86_unix.cpp',
--- a/xulrunner/stub/moz.build
+++ b/xulrunner/stub/moz.build
@@ -6,17 +6,17 @@
 
 # The value of XULRUNNER_STUB_NAME is generated by configure to allow XULRunner
 # apps to override it using the --with-xulrunner-stub-name=<appname> argument.
 # If this configure argument is not present then the default name is
 # 'xulrunner-stub'.
 
 # We don't want to create a dependency on mozglue.
 # Statically link against the RTL on windows
-GeckoProgram(CONFIG['XULRUNNER_STUB_NAME'], mozglue=None, msvcrt='static')
+GeckoProgram(CONFIG['XULRUNNER_STUB_NAME'] or '', mozglue=None, msvcrt='static')
 
 SOURCES += [
     'nsXULStub.cpp',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     FINAL_TARGET = 'dist/XUL.framework/Versions/%(MOZILLA_VERSION)s' % CONFIG