Bug 1407359 Set up a framework for patching the MinGW toolchain draft
authorTom Ritter <tom@mozilla.com>
Wed, 11 Oct 2017 14:59:00 -0500
changeset 678732 3047ddff1f19d6fa5fa03b593820b5dcc952500b
parent 677727 0330ad5ff129ea559f1d726e1b33a872792ac8a7
child 735419 ef1750243852a69e3ece1a3e0b8458bdfb1240b8
push id84021
push userbmo:tom@mozilla.com
push dateWed, 11 Oct 2017 19:59:44 +0000
bugs1407359
milestone58.0a1
Bug 1407359 Set up a framework for patching the MinGW toolchain MozReview-Commit-ID: 8HtjLXAIXTP
build/unix/build-gcc/build-gcc.sh
build/unix/build-gcc/mingw-sample-patch.patch
taskcluster/scripts/misc/build-gcc-mingw32.sh
--- a/build/unix/build-gcc/build-gcc.sh
+++ b/build/unix/build-gcc/build-gcc.sh
@@ -61,18 +61,36 @@ 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/
+  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?)
+  popd
+}
+
 apply_patch() {
-  pushd $root_dir/gcc-$gcc_version
+  if [ $# -ge 2 ]; then
+    pushd $root_dir/$1
+    shift
+  else
+    pushd $root_dir/gcc-$gcc_version
+  fi
   patch -p1 < $1
   popd
 }
 
 build_binutils() {
   # if binutils_configure_flags is not set at all, give it the default value
   if [ -z "${binutils_configure_flags+xxx}" ];
   then
@@ -97,27 +115,16 @@ build_gcc() {
   make $make_flags install DESTDIR=$root_dir
 
   cd $root_dir/tools
   tar caf $root_dir/gcc.tar.xz gcc/
   popd
 }
 
 build_gcc_and_mingw() {
-  export install_dir=$root_dir/tools/gcc/
-  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?)
-  popd
-
   mkdir gcc-objdir
   pushd gcc-objdir
   ../gcc-$gcc_version/configure --prefix=$install_dir --target=i686-w64-mingw32 --with-gnu-ld --with-gnu-as --disable-multilib --enable-threads=posix
   make $make_flags all-gcc
   make $make_flags install-gcc
   popd
 
   mkdir mingw-w64-headers32
new file mode 100644
--- /dev/null
+++ b/build/unix/build-gcc/mingw-sample-patch.patch
@@ -0,0 +1,13 @@
+diff --git a/AUTHORS b/AUTHORS
+index 9060dd32..02d07f49 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -1,7 +1,7 @@
+ Note
+ ====
+ 
+-This file contains information about people who are permitted to make
++This file contains out of date information about people who are permitted to make
+ changes to various parts of the runtimes, headers, associated tools,
+ and associated libraries. Also the list of contributors to mingw-w64
+ are listed here, too.
--- a/taskcluster/scripts/misc/build-gcc-mingw32.sh
+++ b/taskcluster/scripts/misc/build-gcc-mingw32.sh
@@ -37,14 +37,16 @@ 369737ce51587f92466041a97ab7d2358c6d9e1b
 850bf21eafdfe5cd5f6827148184c08c4a0852a37ccf36ce69855334d2c914d4  gcc-6.4.0.tar.xz
 752079520b4690531171d0f4532e40f08600215feefede70b24fabdc6f1ab160  gmp-5.1.3.tar.bz2
 8ceebbf4d9a81afa2b4449113cee4b7cb14a687d7a549a963deb5e2a41458b6b  isl-0.15.tar.bz2
 ae79f8d41d8a86456b68607e9ca398d00f8b7342d1d83bcf4428178ac45380c7  mpc-0.8.2.tar.gz
 ca498c1c7a74dd37a576f353312d1e68d490978de4395fa28f1cbd46a364e658  mpfr-3.1.5.tar.bz2
 EOF
 
 prepare
+prepare_mingw
+apply_patch mingw-w64 $data_dir/mingw-sample-patch.patch
 build_binutils
 build_gcc_and_mingw
 
 # Put a tarball in the artifacts dir
 mkdir -p $UPLOAD_DIR
 cp $root_dir/mingw32.tar.* $UPLOAD_DIR