Bug 1314979 Support cross compilation with MinGW in windows.configure draft
authorTom Ritter <tom@mozilla.com>
Fri, 27 Jan 2017 12:32:25 -0600
changeset 467374 ee3a4b87faa3051461369dadadaa818bfb398d9b
parent 467243 07d7ecbf77e3be59797f16234d357a02bb38ed8b
child 543669 5bb397f29655ce99ffa679cb0ca53199c5d8d217
push id43156
push userbmo:tom@mozilla.com
push dateFri, 27 Jan 2017 18:33:16 +0000
bugs1314979
milestone54.0a1
Bug 1314979 Support cross compilation with MinGW in windows.configure Note: - We completely ignore the windows.configure file for MinGW builds - Angle appears the be the only thing we need to clear up later on because of this change - --enable-crashreporter will not work, at least because makecab is not checked for On a cross compilation we would need a different program anyway. So we will open a new bug about configuring and building with the crash-reporter enabled (it is always disabled for Tor) - ./mach package will not work, at least because makensis is ignored on a MinGW build. Tor does not use ./mach package, it uses nsis elsewhere MozReview-Commit-ID: 4GdnwSlRLvH
build/moz.configure/toolchain.configure
moz.configure
old-configure.in
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -960,13 +960,13 @@ def wrap_system_includes(target, visibil
 
 set_define('HAVE_VISIBILITY_HIDDEN_ATTRIBUTE',
            depends(visibility_flags)(lambda v: bool(v) or None))
 set_define('HAVE_VISIBILITY_ATTRIBUTE',
            depends(visibility_flags)(lambda v: bool(v) or None))
 set_config('WRAP_SYSTEM_INCLUDES', wrap_system_includes)
 set_config('VISIBILITY_FLAGS', visibility_flags)
 
-@depends(target)
-def is_windows(target):
-    return target.kernel == 'WINNT'
+@depends(target, c_compiler)
+def is_windows(target, compiler):
+    return target.kernel == 'WINNT' and compiler.type in ['msvc', 'clang-cl']
 
 include('windows.configure', when=is_windows)
--- a/moz.configure
+++ b/moz.configure
@@ -273,21 +273,23 @@ def check_for_hunspell(value, compile_en
     return value and compile_env
 
 system_hunspell = pkg_check_modules('MOZ_HUNSPELL', 'hunspell',
                                     when=check_for_hunspell)
 
 set_config('MOZ_SYSTEM_HUNSPELL', depends_if(system_hunspell)(lambda _: True))
 
 
-@depends(target)
+@depends(target, c_compiler)
 @imports('os')
-def makensis_progs(target):
+def makensis_progs(target, compiler):
     if target.kernel != 'WINNT':
         return
+    elif target.kernel == 'WINNT' and compiler.type not in ['msvc', 'clang-cl']:
+        return
 
     candidates = [
         'makensis-3.0b3.exe',
         'makensis-3.0b1.exe',
         'makensis.exe',
         'makensis',
     ]
 
--- a/old-configure.in
+++ b/old-configure.in
@@ -3279,17 +3279,27 @@ if test -n "$MOZ_ANGLE_RENDERER"; then
         AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
         AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
         MOZ_D3DCOMPILER_VISTA_DLL_PATH=
       fi
     else
       AC_MSG_RESULT([Windows SDK not found.])
     fi
   else
-    AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
+    if test "$target" != "$host"; then
+        case "$target" in
+        *-mingw*)
+            AC_MSG_RESULT([Windows SDK not needed for ANGLE in MinGW build.])
+        ;;
+        *)
+            AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
+        esac
+    else
+        AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
+    fi
   fi
 
   if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
     MOZ_D3DCOMPILER_VISTA_DLL=
   fi
 
   # On mingw, check if headers are provided by toolchain.
   if test -n "$GNU_CC"; then