Bug 1290044 - Moved NSIS configure to Python. r=glandium
authorNathan Hakkakzadeh <nhakkakzadeh@mozilla.com>
Thu, 28 Jul 2016 17:39:24 -0700
changeset 307795 7ab959c316fca2fc209431491644af62bb93dbdc
parent 307794 f793fb1222f761d9b8b7b0f0eb9bee2864a909ba
child 307796 d53875b32f92957b4531cb550a38377d0d3f1c64
push id30519
push usercbook@mozilla.com
push dateWed, 03 Aug 2016 15:00:03 +0000
treeherdermozilla-central@8a98cde343c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1290044
milestone51.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 1290044 - Moved NSIS configure to Python. r=glandium MozReview-Commit-ID: 6JFR5K1XDBr
moz.configure
old-configure.in
--- a/moz.configure
+++ b/moz.configure
@@ -223,11 +223,41 @@ option('--enable-system-hunspell',
 def check_for_hunspell(value, compile_env):
     return value and compile_env
 
 system_hunspell = pkg_check_modules('MOZ_HUNSPELL', 'hunspell',
                                     check_for_hunspell)
 
 set_config('MOZ_SYSTEM_HUNSPELL', system_hunspell)
 
+
+@depends(target)
+def makensis_progs(target):
+    if target.kernel == 'WINNT':
+        return ('makensis-3.0b3.exe', 'makensis-3.0b1.exe', 'makensis.exe', 'makensis')
+
+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):
+    nsis_min_version = '3.0b1'
+    out = check_cmd_output(nsis, '-version',
+                           onerror=lambda: die('Failed to get nsis version.'))
+    m = re.search(r'(?<=v)[0-9]+\.[0-9]+((a|b|rc)[0-9]+)?', out)
+
+    if not m:
+        raise FatalCheckError('Unknown version of makensis')
+    ver = Version(m.group(0))
+
+    if ver < nsis_min_version:
+        raise FatalCheckError('To build the installer you must have NSIS'
+                              ' version %s or greater in your path'
+                              % nsis_min_version)
+
+    return ver
+
+
 # Fallthrough to autoconf-based configure
 include('build/moz.configure/old.configure')
 # Please do not add anything after the include of old.configure.
--- a/old-configure.in
+++ b/old-configure.in
@@ -4269,72 +4269,16 @@ if test -n "$MOZ_TREE_FREETYPE"; then
    CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
    CAIRO_FT_OSLIBS=''
    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
    AC_SUBST_LIST(CAIRO_FT_CFLAGS)
 fi
 
-dnl ========================================================
-dnl Installer
-dnl ========================================================
-dnl Abort Windows build if the required major version and
-dnl minimum minor version of Unicode NSIS isn't in the path
-dnl (unless in case of cross compiling, for which Unicode
-dnl is not yet sufficient).
-if test "$OS_ARCH" = "WINNT"; then
-    MIN_NSIS_MAJOR_VER=3
-    MIN_NSIS_MINOR_VER=0
-    MIN_NSIS_PRERELEASE_TYPE=b
-    MIN_NSIS_PRERELEASE_VER=1
-    MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensis-3.0b3.exe makensis-3.0b1.exe makensis)
-    if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
-      AC_MSG_RESULT([yes])
-      MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
-      changequote(,)
-      MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
-      changequote([,])
-      MAKENSISU_MAJOR_VER=0
-      MAKENSISU_MINOR_VER=0
-      MAKENSISU_PRERELEASE_TYPE=$MIN_NSIS_PRERELEASE_TYPE
-      MAKENSISU_PRERELEASE_VER=$MIN_NSIS_PRERELEASE_VER
-      if test ! "$MAKENSISU_PARSED_VER" = ""; then
-          MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
-          MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
-          changequote(,)
-          MAKENSISU_PARSED_PRERELEASE=`echo "$MAKENSISU_VER" | sed -e 's/^v[0-9]\+\.[0-9]\+\([^0-9]\+\)\([0-9]\+\).*$/\1.\2/g'`
-          changequote([,])
-          if test ! "$MAKENSISU_PARSED_PRERELEASE" = "$MAKENSISU_VER"; then
-              MAKENSISU_PRERELEASE_TYPE=`echo $MAKENSISU_PARSED_PRERELEASE | $AWK -F\. '{ print $1 }'`
-              MAKENSISU_PRERELEASE_VER=`echo $MAKENSISU_PARSED_PRERELEASE | $AWK -F\. '{ print $2 }'`
-          fi
-      fi
-      AC_MSG_CHECKING([for NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER$MIN_NSIS_PRERELEASE_TYPE$MIN_NSIS_PRERELEASE_VER or greater])
-      if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
-              "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER -a \
-              "$MAKENSISU_PRERELEASE_TYPE" = "$MIN_NSIS_PRERELEASE_TYPE" -a \
-              "$MAKENSISU_PRERELEASE_VER" -ge $MIN_NSIS_PRERELEASE_VER; then
-          AC_MSG_RESULT([yes])
-          AC_MSG_RESULT([Found NSIS Version: $MAKENSISU_VER])
-      else
-          AC_MSG_RESULT([no])
-          if test -z "$CROSS_COMPILE"; then
-            AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER$MIN_NSIS_PRERELEASE_TYPE$MIN_NSIS_PRERELEASE_VER or greater in your path.])
-          else
-            MAKENSISU=
-          fi
-      fi
-    elif test -z "$CROSS_COMPILE"; then
-      AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER$MIN_NSIS_PRERELEASE_TYPE$MIN_NSIS_PRERELEASE_VER or greater in your path.])
-    else
-      MAKENSISU=
-    fi
-fi
-
 AC_CHECK_PROGS(WGET, wget, "")
 AC_SUBST(WGET)
 
 dnl ========================================================
 dnl Maintenance Service
 dnl ========================================================
 
 MOZ_ARG_ENABLE_BOOL(maintenance-service,
@@ -6331,17 +6275,16 @@ if test -n "$MOZ_TELEMETRY_REPORTING" ||
   MOZ_DATA_REPORTING=1
   AC_DEFINE(MOZ_DATA_REPORTING)
   AC_SUBST(MOZ_DATA_REPORTING)
 fi
 
 dnl win32 options
 AC_SUBST(WIN32_REDIST_DIR)
 AC_SUBST(WIN_UCRT_REDIST_DIR)
-AC_SUBST(MAKENSISU)
 
 dnl Echo the CFLAGS to remove extra whitespace.
 CFLAGS=`echo \
     $_WARNINGS_CFLAGS \
     $CFLAGS`
 
 CXXFLAGS=`echo \
     $_WARNINGS_CXXFLAGS \