Bug 972089 - Fix paths for Windows SM(...) builds, r=glandium
authorSteve Fink <sfink@mozilla.com>
Fri, 05 Dec 2014 18:04:33 -0800
changeset 218921 d467571ac7039f16112395fb6f0cc72bff57fc18
parent 218920 445641aa96c1c42b4ae8dec0a59307b76a4ed90c
child 218922 f0226c3be05138baec8ae610f07182d189d1a49f
push id52680
push usersfink@mozilla.com
push dateTue, 09 Dec 2014 23:03:18 +0000
treeherdermozilla-inbound@d467571ac703 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs972089
milestone37.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 972089 - Fix paths for Windows SM(...) builds, r=glandium
js/src/devtools/automation/autospider.sh
js/src/devtools/automation/winbuildenv.sh
--- a/js/src/devtools/automation/autospider.sh
+++ b/js/src/devtools/automation/autospider.sh
@@ -6,22 +6,28 @@ DIR="$(dirname $0)"
 ABSDIR="$(cd $DIR; pwd)"
 SOURCE="$(cd $DIR/../../../..; pwd)"
 
 function usage() {
   echo "Usage: $0 [--dep] <variant>"
 }
 
 clean=""
+platform=""
 while [ $# -gt 1 ]; do
     case "$1" in
         --clobber)
             shift
             clean=1
             ;;
+        --platform)
+            shift
+            platform="$1"
+            shift
+            ;;
         *)
             echo "Invalid arguments" >&2
             usage
             exit 1
             ;;
     esac
 done
 
@@ -36,17 +42,17 @@ fi
 
 TRY_OVERRIDE=$SOURCE/js/src/config.try
 if [ -r $TRY_OVERRIDE ]; then
   CONFIGURE_ARGS="$(cat "$TRY_OVERRIDE")"
 else
   CONFIGURE_ARGS="$(cat "$ABSDIR/$VARIANT")"
 fi
 
-OBJDIR="$SOURCE/obj-spider"
+OBJDIR="${OBJDIR:-$SOURCE/obj-spider}"
 
 if [ -n "$clean" ]; then
   [ -d "$OBJDIR" ] && rm -rf "$OBJDIR"
   mkdir "$OBJDIR"
 else
   [ -d "$OBJDIR" ] || mkdir "$OBJDIR"
 fi
 cd "$OBJDIR"
@@ -76,17 +82,21 @@ elif [ "$OSTYPE" = "linux-gnu" ]; then
     if $USE_64BIT; then
       export LD_LIBRARY_PATH=$GCCDIR/lib64
     else
       export LD_LIBRARY_PATH=$GCCDIR/lib
     fi
   fi
 elif [ "$OSTYPE" = "msys" ]; then
   USE_64BIT=false
+  if [ "$platform" = "win64" ]; then
+      USE_64BIT=true
+  fi
   MAKE=${MAKE:-mozmake}
+  source "$ABSDIR/winbuildenv.sh"
 fi
 
 MAKE=${MAKE:-make}
 
 if $USE_64BIT; then
   NSPR64="--enable-64bit"
 else
   NSPR64=""
new file mode 100644
--- /dev/null
+++ b/js/src/devtools/automation/winbuildenv.sh
@@ -0,0 +1,51 @@
+# We will be sourcing mozconfig files, which end up calling mk_add_options with
+# various settings. We only need the variable settings they create along the
+# way.
+mk_add_options() {
+  : do nothing
+}
+
+topsrcdir="$SOURCE"
+
+# When running on a developer machine, several variables will already
+# have the right settings and we will need to keep them since the
+# Windows mozconfigs overwrite them.
+export OLD_INCLUDE="$INCLUDE"
+export OLD_LIB=$(IFS=';'; for d in $LIB; do ( cd "$d" && echo -n $(pwd): ); done)
+export OLD_LIBPATH=$(IFS=';'; for d in $LIBPATH; do ( cd "$d" && echo -n $(pwd): ); done)
+
+# The various browser/config/mozconfigs/win32/* files use these checks to pick
+# the compiler.
+if $USE_64BIT; then
+  . $topsrcdir/build/win64/mozconfig.vs2013
+elif test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
+  . $topsrcdir/build/win32/mozconfig.vs2013-win64
+else
+  . $topsrcdir/build/win32/mozconfig.vs2010
+fi
+
+# If PATH starts with a directory beginning with /d that does not
+# exist, it messes up cl.exe invocation (probably by passing in a
+# bogus option or something. I don't know why exactly.)
+export PATH="$(perl -le 'print join ":", grep { -d $_ } split ":", $ENV{PATH}')"
+
+# PATH also needs to point to mozmake.exe, which can come from either
+# newer mozilla-build or tooltool.
+if ! which mozmake 2>/dev/null; then
+    export PATH="$PATH:$SOURCE/.."
+    if ! which mozmake 2>/dev/null; then
+	TT_SERVER=${TT_SERVER:-http://runtime-binaries.pvt.build.mozilla.org/tooltool}
+	( cd $SOURCE/..; ./scripts/scripts/tooltool/tooltool_wrapper.sh $SOURCE/browser/config/tooltool-manifests/${platform:-win32}/releng.manifest $TT_SERVER setup.sh c:/mozilla-build/python27/python.exe C:/mozilla-build/tooltool.py )
+    fi
+fi
+
+# Set INCLUDE to any existing directories from either the INCLUDE set by the
+# mozconfig, or pre-existing directories. I have observed cases where extra
+# nonexistent directories in the INCLUDE search path causes the compiler to
+# fail to find files that show up later in the search path.
+#
+# Note that the mozconfig will use msys-style paths and OLD_INCLUDE will use
+# Windows-style paths, but perl and cl.exe both seem ok with either.
+export INCLUDE="$(perl -le 'print join ":", grep { -d $_ } split(":", $ENV{INCLUDE}),split(";", $ENV{OLD_INCLUDE})')"
+export LIB="$(perl -le 'print join ":", grep { -d $_ } split(":", $ENV{LIB}),split(":", $ENV{OLD_LIB})')"
+export LIBPATH="$(perl -le 'print join ":", grep { -d $_ } split(":", $ENV{LIBPATH}),split(":", $ENV{OLD_LIBPATH})')"