Bug 1291944 - Search for nsis in msys environment; r?glandium draft
authorGregory Szorc <gps@mozilla.com>
Mon, 15 Aug 2016 17:34:42 -0700
changeset 400951 a733ed738e3f3aec3af050ee5069b7e0951fb08f
parent 400825 054d4856cea6150a6638e5daf7913713281af97d
child 400952 6dc25e9d243ddc7ea14dc743b681449dec2b04fc
child 400956 12c10679bb3f299f6760bdd4a21d380e6fb1fcb7
push id26313
push userbmo:gps@mozilla.com
push dateTue, 16 Aug 2016 02:05:43 +0000
reviewersglandium
bugs1291944
milestone51.0a1
Bug 1291944 - Search for nsis in msys environment; r?glandium Previously, configure found nsis on PATH, likely from MozillaBuild. In our msys2 environment, nsis is installed under /mingw32. We supplement moz.configure to look for nsis in this location. MozReview-Commit-ID: 34mjoCrI7B6
moz.configure
--- a/moz.configure
+++ b/moz.configure
@@ -246,19 +246,36 @@ def check_for_hunspell(value, compile_en
 
 system_hunspell = pkg_check_modules('MOZ_HUNSPELL', 'hunspell',
                                     check_for_hunspell)
 
 set_config('MOZ_SYSTEM_HUNSPELL', system_hunspell)
 
 
 @depends(target)
+@imports('os')
 def makensis_progs(target):
-    if target.kernel == 'WINNT':
-        return ('makensis-3.0b3.exe', 'makensis-3.0b1.exe', 'makensis.exe', 'makensis')
+    if target.kernel != 'WINNT':
+        return
+
+    candidates = [
+        'makensis-3.0b3.exe',
+        'makensis-3.0b1.exe',
+        'makensis.exe',
+        'makensis',
+    ]
+
+    # Look for nsis installed by msys environment. But only the 32-bit version.
+    # We use an absolute path and insert as the first entry so it is preferred
+    # over a 64-bit exe that may be in PATH.
+    if 'MSYSTEM_PREFIX' in os.environ:
+        prefix = os.path.dirname(os.environ['MSYSTEM_PREFIX'])
+        candidates.insert(0, os.path.join(prefix, 'mingw32', 'bin', 'makensis.exe'))
+
+    return tuple(candidates)
 
 nsis = check_prog('MAKENSISU', makensis_progs)
 
 # Make sure the version of makensis is up to date.
 @depends_if(nsis)
 @checking('for NSIS version')
 @imports('re')
 def nsis_version(nsis):