Bug 1506450 - Use llvm-rc via mingw-llvm windres wrapper as resource compiler. r=froydnj
authorJacek Caban <jacek@codeweavers.com>
Wed, 05 Dec 2018 22:10:45 +0100
changeset 505940 8dcdfbc80345
parent 505939 3e75f80fd784
child 505941 05dbd9368700
push id10301
push userarchaeopteryx@coole-files.de
push dateThu, 06 Dec 2018 16:36:14 +0000
treeherdermozilla-beta@7d2f3c71997c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1506450
milestone65.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 1506450 - Use llvm-rc via mingw-llvm windres wrapper as resource compiler. r=froydnj
browser/config/mozconfigs/win32/mingwclang
browser/config/mozconfigs/win64/mingwclang
taskcluster/scripts/misc/build-clang-trunk-mingw.sh
--- a/browser/config/mozconfigs/win32/mingwclang
+++ b/browser/config/mozconfigs/win32/mingwclang
@@ -43,27 +43,22 @@ ac_add_options --disable-webrtc # Bug 13
 ac_add_options --disable-geckodriver # Bug 1489320
 
 # Find our toolchain
 HOST_CC="$TOOLTOOL_DIR/clang/bin/clang"
 HOST_CXX="$TOOLTOOL_DIR/clang/bin/clang++"
 CC="$TOOLTOOL_DIR/clang/bin/i686-w64-mingw32-clang"
 CXX="$TOOLTOOL_DIR/clang/bin/i686-w64-mingw32-clang++"
 CXXFLAGS="-fms-extensions"
-CPP="$TOOLTOOL_DIR/clang/bin/i686-w64-mingw32-clang -E"
 AR=llvm-ar
 RANLIB=llvm-ranlib
 
 # For Stylo
 BINDGEN_CFLAGS="-I$TOOLTOOL_DIR/clang/i686-w64-mingw32/include/c++/v1 -I$TOOLTOOL_DIR/clang/lib/clang/8.0.0/include -I$TOOLTOOL_DIR/clang/i686-w64-mingw32/include"
 
-# Since we use windres from binutils without the rest of tools (like cpp), we need to
-# explicitly specify clang as a preprocessor.
-WINDRES="i686-w64-mingw32-windres --preprocessor=\"$CPP -xc\" -DRC_INVOKED"
-
 # Bug 1471698 - Work around binutils corrupting mingw clang binaries.
 LDFLAGS="-Wl,-S"
 STRIP=/bin/true
 OBJCOPY=/bin/true
 
 # We want to make sure we use binutils and other binaries in the tooltool
 # package.
 mk_add_options "export PATH=$TOOLTOOL_DIR/clang/bin:$TOOLTOOL_DIR/mingw32/bin:$TOOLTOOL_DIR/wine/bin:$TOOLTOOL_DIR/upx/bin:$TOOLTOOL_DIR/fxc2/bin:$PATH"
--- a/browser/config/mozconfigs/win64/mingwclang
+++ b/browser/config/mozconfigs/win64/mingwclang
@@ -43,27 +43,22 @@ ac_add_options --disable-webrtc # Bug 13
 ac_add_options --disable-geckodriver # Bug 1489320
 
 # Find our toolchain
 HOST_CC="$TOOLTOOL_DIR/clang/bin/clang"
 HOST_CXX="$TOOLTOOL_DIR/clang/bin/clang++"
 CC="$TOOLTOOL_DIR/clang/bin/x86_64-w64-mingw32-clang"
 CXX="$TOOLTOOL_DIR/clang/bin/x86_64-w64-mingw32-clang++"
 CXXFLAGS="-fms-extensions"
-CPP="$TOOLTOOL_DIR/clang/bin/x86_64-w64-mingw32-clang -E"
 AR=llvm-ar
 RANLIB=llvm-ranlib
 
 # For Stylo
 BINDGEN_CFLAGS="-I$TOOLTOOL_DIR/clang/x86_64-w64-mingw32/include/c++/v1 -I$TOOLTOOL_DIR/clang/lib/clang/8.0.0/include -I$TOOLTOOL_DIR/clang/x86_64-w64-mingw32/include"
 
-# Since we use windres from binutils without the rest of tools (like cpp), we need to
-# explicitly specify clang as a preprocessor.
-WINDRES="x86_64-w64-mingw32-windres --preprocessor=\"$CPP -xc\" -DRC_INVOKED"
-
 # Bug 1471698 - Work around binutils corrupting mingw clang binaries.
 LDFLAGS="-Wl,-S"
 STRIP=/bin/true
 OBJCOPY=/bin/true
 
 # We want to make sure we use binutils and other binaries in the tooltool
 # package.
 mk_add_options "export PATH=$TOOLTOOL_DIR/clang/bin:$TOOLTOOL_DIR/mingw32/bin:$TOOLTOOL_DIR/wine/bin:$TOOLTOOL_DIR/upx/bin:$TOOLTOOL_DIR/fxc2/bin:$PATH"
--- a/taskcluster/scripts/misc/build-clang-trunk-mingw.sh
+++ b/taskcluster/scripts/misc/build-clang-trunk-mingw.sh
@@ -29,16 +29,17 @@ TOOLCHAIN_DIR=$WORKSPACE/moz-toolchain
 INSTALL_DIR=$TOOLCHAIN_DIR/build/stage3/clang
 CROSS_PREFIX_DIR=$INSTALL_DIR/$machine-w64-mingw32
 SRC_DIR=$TOOLCHAIN_DIR/src
 
 make_flags="-j$(nproc)"
 
 mingw_version=d66350ea60d043a8992ada752040fc4ea48537c3
 libunwind_version=1f89d78bb488bc71cfdee8281fc0834e9fbe5dce
+llvm_mingw_version=53db1c3a4c9c81972b70556a5ba5cd6ccd8e6e7d
 
 binutils_version=2.27
 binutils_ext=bz2
 binutils_sha=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88
 
 # This is default value of _WIN32_WINNT. Gecko configure script explicitly sets this,
 # so this is not used to build Gecko itself. We default to 0x600, which is Windows Vista.
 default_win32_winnt=0x600
@@ -59,16 +60,21 @@ prepare() {
   git checkout $mingw_version
   popd
 
   git clone https://github.com/llvm-mirror/libunwind.git
   pushd libunwind
   git checkout $libunwind_version
   popd
 
+  git clone https://github.com/mstorsjo/llvm-mingw.git
+  pushd llvm-mingw
+  git checkout $llvm_mingw_version
+  popd
+
   wget -c --progress=dot:mega ftp://ftp.gnu.org/gnu/binutils/binutils-$binutils_version.tar.$binutils_ext
   if [ "$(sha256sum binutils-$binutils_version.tar.$binutils_ext)" != "$binutils_sha  binutils-$binutils_version.tar.$binutils_ext" ];
   then
     echo Corrupted binutils archive
     exit 1
   fi
   tar -jxf binutils-$binutils_version.tar.$binutils_ext
 
@@ -263,32 +269,31 @@ build_libcxx() {
   # libc++.a depends on libunwind.a. Whild linker will automatically link
   # to libc++.a in C++ mode, it won't pick libunwind.a, requiring caller
   # to explicitly pass -lunwind. Wo work around that, we merge libunwind.a
   # into libc++.a.
   merge_libs $CROSS_PREFIX_DIR/lib/libc++.a $CROSS_PREFIX_DIR/lib/libunwind.a
   popd
 }
 
-build_windres() {
-  # we build whole binutils, but use only windres in our toolchain
+build_utils() {
   mkdir binutils
   pushd binutils
   $SRC_DIR/binutils-$binutils_version/configure --prefix=$INSTALL_DIR \
                                                 --disable-multilib \
                                                 --disable-nls \
                                                 --target=$machine-w64-mingw32
   make $make_flags
 
-  # Manually install only nm and windres
-  cp binutils/windres $INSTALL_DIR/bin/$machine-w64-mingw32-windres
+  # Manually install only nm
   cp binutils/nm-new $INSTALL_DIR/bin/$machine-w64-mingw32-nm
 
   pushd $INSTALL_DIR/bin/
   ln -s llvm-readobj $machine-w64-mingw32-readobj
+  ./clang $SRC_DIR/llvm-mingw/wrappers/windres-wrapper.c -O2 -Wl,-s -o $machine-w64-mingw32-windres
   popd
 
   popd
 }
 
 export PATH=$INSTALL_DIR/bin:$PATH
 
 prepare
@@ -303,17 +308,17 @@ cd build/build-clang
 set -x
 
 pushd $TOOLCHAIN_DIR/build
 
 install_wrappers
 build_mingw
 build_compiler_rt
 build_libcxx
-build_windres
+build_utils
 
 popd
 
 # Put a tarball in the artifacts dir
 mkdir -p $UPLOAD_DIR
 
 pushd $(dirname $INSTALL_DIR)
 rm -f clang/lib/libstdc++*