Bug 1426322 - Separate gcc and mingw32-gcc. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 20 Dec 2017 13:46:53 +0900
changeset 397064 8b7e54e7c8063ccc328c4ca3d68d9b8d66769aa4
parent 397063 3ce865c24dd7348a8ca710656c1e76918542897e
child 397065 7c5a3709868be88aabfa48c7a54d4a122c35340c
push id33123
push userncsoregi@mozilla.com
push dateThu, 21 Dec 2017 10:00:47 +0000
treeherdermozilla-central@06a19fbe2581 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1426322
milestone59.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 1426322 - Separate gcc and mingw32-gcc. r=gps The "contract" for toolchains is that extracting foo.tar.xz creates a directory named foo/. That is however not true for mingw32.tar.xz, which extracts into gcc/, possibly overwriting files from the gcc.tar.xz archive (which is also used for mingw builds, for the host part). This is also not true for nsis.tar.xz, but it reportedly has problems when it's not in the same directory as mingw32. But mingw32 doesn't actually need to be mixed with gcc, so it's better to separate them as they are supposed to be.
browser/config/mozconfigs/win32/mingw32
build/unix/build-gcc/build-gcc.sh
taskcluster/scripts/misc/build-mingw32-fxc2.sh
taskcluster/scripts/misc/build-mingw32-nsis.sh
--- a/browser/config/mozconfigs/win32/mingw32
+++ b/browser/config/mozconfigs/win32/mingw32
@@ -42,27 +42,27 @@ ac_add_options --disable-accessibility #
 ac_add_options --disable-sandbox # Bug 1230910
 ac_add_options --disable-stylo # Bug 1390583
 
 # These aren't supported on mingw at this time
 ac_add_options --disable-webrtc # Bug 1393901
 ac_add_options --disable-maintenance-service
 
 # Find our toolchain
-CC="$TOOLTOOL_DIR/gcc/bin/i686-w64-mingw32-gcc"
-CXX="$TOOLTOOL_DIR/gcc/bin/i686-w64-mingw32-g++"
+CC="$TOOLTOOL_DIR/mingw32/bin/i686-w64-mingw32-gcc"
+CXX="$TOOLTOOL_DIR/mingw32/bin/i686-w64-mingw32-g++"
 
 HOST_CC="$TOOLTOOL_DIR/gcc/bin/gcc"
 HOST_CXX="$TOOLTOOL_DIR/gcc/bin/g++"
 
 # We want to make sure we use binutils and other binaries in the tooltool
 # package.
-mk_add_options PATH="$TOOLTOOL_DIR/gcc/bin:$TOOLTOOL_DIR/gcc/i686-w64-mingw32/bin:$TOOLTOOL_DIR/wine/bin:$TOOLTOOL_DIR/upx/bin:$TOOLTOOL_DIR/fxc2/bin:$PATH"
+mk_add_options PATH="$TOOLTOOL_DIR/gcc/bin:$TOOLTOOL_DIR/mingw32/bin:$TOOLTOOL_DIR/wine/bin:$TOOLTOOL_DIR/upx/bin:$TOOLTOOL_DIR/fxc2/bin:$PATH"
 
-LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/gcc/lib64:$TOOLTOOL_DIR/gcc/lib
+LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/gcc/lib64:$TOOLTOOL_DIR/mingw32/lib64
 mk_add_options "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
 
 # Do not include the visual studio related mozconfigs of course
 
 ac_add_options --with-branding=browser/branding/nightly
 
 . "$topsrcdir/build/mozconfig.common.override"
-. "$topsrcdir/build/mozconfig.cache"
\ No newline at end of file
+. "$topsrcdir/build/mozconfig.cache"
--- a/build/unix/build-gcc/build-gcc.sh
+++ b/build/unix/build-gcc/build-gcc.sh
@@ -62,17 +62,18 @@ prepare() {
   # Check all the downloads we did are in the checksums list, and that the
   # checksums match.
   diff -u <(sort -k 2 $root_dir/downloads) $root_dir/checksums
 
   popd
 }
 
 prepare_mingw() {
-  export install_dir=$root_dir/tools/gcc/
+  export prefix=/tools/mingw32
+  export install_dir=$root_dir$prefix
   mkdir -p $install_dir
   export PATH=$PATH:$install_dir/bin/
 
   cd $root_dir
 
   git clone -n git://git.code.sf.net/p/mingw-w64/mingw-w64
   pushd mingw-w64
   git checkout $mingw_version # Asserts the integrity of the checkout (Right?)
@@ -96,26 +97,26 @@ build_binutils() {
   then
     # gold is disabled because we don't use it on automation, and also we ran into
     # some issues with it using this script in build-clang.py.
     binutils_configure_flags="--disable-gold --enable-plugins --disable-nls"
   fi
 
   mkdir $root_dir/binutils-objdir
   pushd $root_dir/binutils-objdir
-  ../binutils-$binutils_version/configure --prefix /tools/gcc/ $binutils_configure_flags
+  ../binutils-$binutils_version/configure --prefix=${prefix-/tools/gcc}/ $binutils_configure_flags
   make $make_flags
   make install $make_flags DESTDIR=$root_dir
   popd
 }
 
 build_gcc() {
   mkdir $root_dir/gcc-objdir
   pushd $root_dir/gcc-objdir
-  ../gcc-$gcc_version/configure --prefix=/tools/gcc --enable-languages=c,c++  --disable-nls --disable-gnu-unique-object --enable-__cxa_atexit --with-arch-32=pentiumpro
+  ../gcc-$gcc_version/configure --prefix=${prefix-/tools/gcc} --enable-languages=c,c++  --disable-nls --disable-gnu-unique-object --enable-__cxa_atexit --with-arch-32=pentiumpro
   make $make_flags
   make $make_flags install DESTDIR=$root_dir
 
   cd $root_dir/tools
   tar caf $root_dir/gcc.tar.xz gcc/
   popd
 }
 
@@ -154,12 +155,12 @@ build_gcc_and_mingw() {
 
   mkdir widl32
   pushd widl32
   ../mingw-w64/mingw-w64-tools/widl/configure --prefix=$install_dir --target=i686-w64-mingw32
   make
   make install
   popd
 
-  pushd $root_dir/tools
-  tar caf $root_dir/mingw32.tar.xz gcc/
+  pushd $(dirname $install_dir)
+  tar caf $root_dir/mingw32.tar.xz $(basename $install_dir)/
   popd
 }
--- a/taskcluster/scripts/misc/build-mingw32-fxc2.sh
+++ b/taskcluster/scripts/misc/build-mingw32-fxc2.sh
@@ -6,30 +6,30 @@ HOME_DIR=$WORKSPACE/build
 INSTALL_DIR=$WORKSPACE/fxc2
 TOOLTOOL_DIR=$WORKSPACE/build/src
 UPLOAD_DIR=$HOME/artifacts
 
 mkdir -p $INSTALL_DIR/bin
 
 cd $TOOLTOOL_DIR
 . taskcluster/scripts/misc/tooltool-download.sh
-export PATH="$TOOLTOOL_DIR/gcc/bin:$TOOLTOOL_DIR/gcc/i686-w64-mingw32/bin:$PATH"
+export PATH="$TOOLTOOL_DIR/mingw32/bin:$PATH"
 
 cd $WORKSPACE
 
 # --------------
 
 git clone -n https://github.com/mozilla/fxc2.git fxc2-clone
 cd fxc2-clone
 git checkout 82527b81104e5e21390d3ddcd328700c67ce73d4 # Asserts integrity of the clone (right?)
 make
 
 cp fxc2.exe $INSTALL_DIR/bin/
 cp d3dcompiler_47.dll $INSTALL_DIR/bin/
-cp $TOOLTOOL_DIR/gcc/i686-w64-mingw32/bin/libwinpthread-1.dll $INSTALL_DIR/bin/
+cp $TOOLTOOL_DIR/mingw32/i686-w64-mingw32/bin/libwinpthread-1.dll $INSTALL_DIR/bin/
 
 # --------------
 
 cd $WORKSPACE
 tar caf fxc2.tar.xz fxc2
 
 mkdir -p $UPLOAD_DIR
-cp fxc2.tar.* $UPLOAD_DIR
\ No newline at end of file
+cp fxc2.tar.* $UPLOAD_DIR
--- a/taskcluster/scripts/misc/build-mingw32-nsis.sh
+++ b/taskcluster/scripts/misc/build-mingw32-nsis.sh
@@ -1,24 +1,24 @@
 #!/bin/bash
 set -x -e -v
 
 # We set the INSTALL_DIR to match the directory that it will run in exactly,
 # otherwise we get an NSIS error of the form:
 #   checking for NSIS version...
-#   DEBUG: Executing: `/home/worker/workspace/build/src/gcc/
+#   DEBUG: Executing: `/home/worker/workspace/build/src/mingw32/
 #   DEBUG: The command returned non-zero exit status 1.
 #   DEBUG: Its error output was:
-#   DEBUG: | Error: opening stub "/home/worker/workspace/gcc/
+#   DEBUG: | Error: opening stub "/home/worker/workspace/mingw32/
 #   DEBUG: | Error initalizing CEXEBuild: error setting
 #   ERROR: Failed to get nsis version.
 
 WORKSPACE=$HOME/workspace
 HOME_DIR=$WORKSPACE/build
-INSTALL_DIR=$WORKSPACE/build/src/gcc
+INSTALL_DIR=$WORKSPACE/build/src/mingw32
 TOOLTOOL_DIR=$WORKSPACE/build/src
 UPLOAD_DIR=$HOME/artifacts
 
 mkdir -p $INSTALL_DIR
 
 root_dir=$HOME_DIR
 data_dir=$HOME_DIR/src/build/unix/build-gcc
 
@@ -28,19 +28,18 @@ cd $TOOLTOOL_DIR
 . taskcluster/scripts/misc/tooltool-download.sh
 # After tooltool runs, we move the stuff we just downloaded.
 # As explained above, we have to build nsis to the directory it
 # will eventually be run from, which is the same place we just
 # installed our compiler. But at the end of the script we want
 # to package up what we just built. If we don't move the compiler,
 # we will package up the compiler we downloaded along with the
 # stuff we just built.
-mv gcc gcc-mingw
-export PATH="$TOOLTOOL_DIR/gcc-mingw/bin:$TOOLTOOL_DIR/gcc-mingw/i686-w64-mingw32/bin:$PATH"
-mkdir -p $INSTALL_DIR
+mv mingw32 mingw32-gcc
+export PATH="$TOOLTOOL_DIR/mingw32-gcc/bin:$PATH"
 
 cd $WORKSPACE
 
 $GPG --import <<EOF
 -----BEGIN PGP PUBLIC KEY BLOCK-----
 
 mQGiBDuVqKgRBAD5Mcvdc41W5lpeZvYplEuyEBXwmxnUryE2KaCG1C06sGyqgiec
 VPXPbgIPKOUt4veMycVoqU4U4ZNuIeCGPfUvkGKLKvy5lK3iexC1Qvat+9ek2+yX
@@ -95,12 +94,12 @@ tar xaf nsis-3.01-src.tar
 cd nsis-3.01-src
 # I don't know how to make the version work with the environment variables/config flags the way the author appears to
 sed -i "s/'VERSION', 'Version of NSIS', cvs_version/'VERSION', 'Version of NSIS', '3.01'/" SConstruct
 scons XGCC_W32_PREFIX=i686-w64-mingw32- ZLIB_W32=../zlib-1.2.11 SKIPUTILS="NSIS Menu" PREFIX=$INSTALL_DIR/ install
 
 # --------------
 
 cd $WORKSPACE/build/src
-tar caf nsis.tar.xz gcc
+tar caf nsis.tar.xz mingw32
 
 mkdir -p $UPLOAD_DIR
 cp nsis.tar.* $UPLOAD_DIR