[tbb-commits] [tor-browser-build/master] Bug 28238: Adapt firefox project for Windows builds

boklm at torproject.org boklm at torproject.org
Wed Aug 28 13:25:26 UTC 2019


commit 023ce30eb3c6082af3353fe6876c202d849cfea8
Author: Georg Koppen <gk at torproject.org>
Date:   Mon Aug 26 21:30:50 2019 +0000

    Bug 28238: Adapt firefox project for Windows builds
---
 projects/firefox/build                    | 77 ++++---------------------------
 projects/firefox/config                   | 16 +++----
 projects/firefox/mozconfig-windows-i686   | 24 ++++++++--
 projects/firefox/mozconfig-windows-x86_64 | 21 +++++++--
 4 files changed, 56 insertions(+), 82 deletions(-)

diff --git a/projects/firefox/build b/projects/firefox/build
index 1fb4b58..a4b10b6 100644
--- a/projects/firefox/build
+++ b/projects/firefox/build
@@ -1,46 +1,15 @@
 #!/bin/bash
 [% c("var/setarch") -%]
 [% c("var/set_default_env") -%]
-[% IF c("var/windows") -%]
-  [% pc('gcc', 'var/setup', { compiler_tarfile => c('input_files_by_name/gcc') }) %]
-  # We need a link to our GCC, otherwise the system cc gets used which points to
-  # /usr/bin/gcc.
-  ln -s gcc /var/tmp/dist/gcc/bin/cc
-[% END -%]
 [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
 distdir=/var/tmp/dist/[% project %]
 mkdir -p /var/tmp/build
 mkdir -p [% dest_dir _ '/' _ c('filename') %]
 
-[% IF c("var/windows") -%]
-  mingwdir=/var/tmp/dist/mingw-w64
-  mkdir -p $mingwdir/helpers
-
-  cat > $mingwdir/helpers/[% c("arch") %]-w64-mingw32-g++ << 'EOF'
-#!/bin/sh
-/var/tmp/dist/mingw-w64/bin/[% c("arch") %]-w64-mingw32-g++ [% c("var/LDFLAGS") %] [% c("var/CFLAGS") %] "$@"
-EOF
-
-  cat > $mingwdir/helpers/[% c("arch") %]-w64-mingw32-gcc << 'EOF'
-#!/bin/sh
-/var/tmp/dist/mingw-w64/bin/[% c("arch") %]-w64-mingw32-gcc [% c("var/LDFLAGS") %] [% c("var/CFLAGS") %] "$@"
-EOF
-
-  cat > $mingwdir/helpers/[% c("arch") %]-w64-mingw32-ld << 'EOF'
-#!/bin/sh
-/var/tmp/dist/mingw-w64/bin/[% c("arch") %]-w64-mingw32-ld [% c("var/LDFLAGS") %] "$@"
-EOF
-
-  chmod +x $mingwdir/helpers/*
-  export PATH="$mingwdir/helpers:$PATH"
-[% END -%]
-
 [% IF c("var/windows") %]
-  # Unpack fxc2.
-  mkdir -p /var/tmp/dist
+  # Setting up fxc2
   tar -C /var/tmp/dist -xf [% c('input_files_by_name/fxc2') %]
-  fxcdir=/var/tmp/dist/fxc2/bin
-  export PATH="$fxcdir:$PATH"
+  export PATH="/var/tmp/dist/fxc2/bin:$PATH"
   # fxc2 requires Wine.
   [% IF c("var/windows-x86_64") %]
     export WINEARCH=win64
@@ -51,7 +20,6 @@ EOF
   wine wineboot -i
 [% END -%]
 
-mkdir -p /var/tmp/dist
 tar -C /var/tmp/dist -xf [% c('input_files_by_name/rust') %]
 tar -C /var/tmp/dist -xf [% c('input_files_by_name/cbindgen') %]
 tar -C /var/tmp/dist -xf [% c('input_files_by_name/nasm') %]
@@ -113,30 +81,11 @@ then
 fi
 
 [% IF c("var/windows") %]
-  # FIXME
-  # Ideally, using LDFLAGS (and e.g. DLLFLAGS for NSS) would be enough to get
-  # all Firefox libraries linked against msvcr100. Alas, this does not hold for
-  # NSPR. Without patching it we get a "missing entry points for _strcmpi in
-  # msvcr100.dll". Now, this should be fixed in rev>=6179 as the def file there
-  # contains a proper patch according to the mingw-w64 developers.
-  # However, even with this patch the _strcmpi issue is still popping up,
-  # probably due to a bug in our current linking setup. The small patch below
-  # is therefore just a workaround which should get fixed but is at least
-  # justified as the signature of _strcmpi and _stricmp is the same, see:
-  # http://msdn.microsoft.com/en-us/library/k59z8dwe.aspx.
-  sed 's/strcmpi/stricmp/' -i nsprpub/pr/src/linking/prlink.c
-  export HOST_LDFLAGS=" "
-  export LDFLAGS="-specs=/var/tmp/dist/mingw-w64/msvcr100.spec"
-  # Our flags don't get passed to NSS. We need to do that manually using an
-  # obscure one.
-  export DLLFLAGS="-specs=/var/tmp/dist/mingw-w64/msvcr100.spec"
-
   # Make sure widl is not inserting random timestamps, see #21837.
   export WIDL_TIME_OVERRIDE="0"
-[% END %]
-
-[% IF c("var/windows") %]
   patch -p1 < $rootdir/nsis-uninstall.patch
+  # Make sure we link without inserting timestamps in general.
+  export LDFLAGS="-Wl,--no-insert-timestamp"
 [% END -%]
 
 # Backporting a sec-high bugfix to ESR 60, but making sure it is only applied to
@@ -203,14 +152,9 @@ rm -f js/src/configure
   chmod 755 $distdir/Browser/firefox
 [% END %]
 
-[% IF c("var/windows-x86_64") -%]
-  mv $rootdir/msvcr100-x86_64.dll $rootdir/msvcr100.dll
-[% END -%]
 [% IF c("var/windows") %]
   cp -a obj-*/dist/firefox/* $distdir/Browser/
-  cp -a $rootdir/msvcr100.dll $distdir/Browser
-  cp -a $gcclibs/libssp-0.dll $distdir/Browser
-  cp -a $fxcdir/d3dcompiler_47.dll $distdir/Browser
+  cp -a /var/tmp/dist/fxc2/bin/d3dcompiler_47.dll $distdir/Browser
 [% END %]
 
 # Make MAR-based update tools available for use during the bundle phase.
@@ -243,16 +187,15 @@ cp -p obj-*/dist/host/bin/mbsdiff $MARTOOLS/
   done
 [% END %]
 [% IF c("var/windows") %]
-  cp -p obj-*/modules/libmar/tool/signmar.exe $MARTOOLS/
-  cp -p obj-*/security/nss/cmd/certutil/certutil_certutil/certutil.exe $MARTOOLS/
-  cp -p obj-*/security/nss/cmd/modutil/modutil_modutil/modutil.exe $MARTOOLS/
-  cp -p obj-*/security/nss/cmd/pk12util/pk12util_pk12util/pk12util.exe $MARTOOLS/
-  cp -p obj-*/security/nss/cmd/shlibsign/shlibsign_shlibsign/shlibsign.exe $MARTOOLS/
+  cp -p obj-*/dist/bin/signmar.exe $MARTOOLS/
+  cp -p obj-*/dist/bin/certutil.exe $MARTOOLS/
+  cp -p obj-*/dist/bin/modutil.exe $MARTOOLS/
+  cp -p obj-*/dist/bin/pk12util.exe $MARTOOLS/
+  cp -p obj-*/dist/bin/shlibsign.exe $MARTOOLS/
   NSS_LIBS="freebl3.dll mozglue.dll nss3.dll nssckbi.dll nssdbm3.dll softokn3.dll"
   for LIB in $NSS_LIBS; do
       cp -p obj-*/dist/bin/$LIB $MARTOOLS/
   done
-  cp -a $rootdir/msvcr100.dll $MARTOOLS/
 [% END %]
 
 cd $distdir
diff --git a/projects/firefox/config b/projects/firefox/config
index 2622da6..799861e 100644
--- a/projects/firefox/config
+++ b/projects/firefox/config
@@ -110,6 +110,13 @@ targets:
     var:
       arch_deps:
         - wine
+      pre_pkginst: |
+        echo 'deb http://ftp.debian.org/debian stretch-backports main' >> /etc/apt/sources.list
+      post_pkginst: |
+        # We need to have at least 3.0.3 which Mozilla is using in the
+        # mingw-w64/clang build process
+        apt-get -y -t stretch-backports install wine
+      compiler: mingw-w64-clang
 
   windows-i686:
     var:
@@ -131,15 +138,6 @@ input_files:
     enable: '[% c("var/linux") %]'
   - filename: fix-info-plist.py
     enable: '[% c("var/osx") %]'
-  - URL: https://people.torproject.org/~gk/mirrors/sources/msvcr100.dll
-    sha256sum: 8793353461826fbd48f25ea8b835be204b758ce7510db2af631b28850355bd18
-    enable: '[% c("var/windows-i686") %]'
-  - URL: https://people.torproject.org/~boklm/mirrors/sources/msvcr100-x86_64.dll
-    sha256sum: ae3cb6c6afba9a4aa5c85f66023c35338ca579b30326dd02918f9d55259503d5
-    enable: '[% c("var/windows-x86_64") %]'
-  - project: gcc
-    name: gcc
-    enable: '[% c("var/windows") %]'
   - filename: nsis-uninstall.patch
     enable: '[% c("var/windows") %]'
   - project: rust
diff --git a/projects/firefox/mozconfig-windows-i686 b/projects/firefox/mozconfig-windows-i686
index 3314719..5538bc1 100644
--- a/projects/firefox/mozconfig-windows-i686
+++ b/projects/firefox/mozconfig-windows-i686
@@ -1,5 +1,18 @@
 CROSS_COMPILE=1
 
+HOST_CC="clang"
+HOST_CXX="clang++"
+CC="i686-w64-mingw32-clang"
+CXX="i686-w64-mingw32-clang++"
+CXXFLAGS="-fms-extensions"
+AR=llvm-ar
+RANLIB=llvm-ranlib
+
+clang_path=/var/tmp/dist/mingw-w64-clang
+
+# For Stylo
+BINDGEN_CFLAGS="-I$clang_path/i686-w64-mingw32/include/c++/v1 -I$clang_path/i686-w64-mingw32/include"
+
 ac_add_options --enable-application=browser
 ac_add_options --target=i686-w64-mingw32
 ac_add_options --with-toolchain-prefix=i686-w64-mingw32-
@@ -11,6 +24,9 @@ export MOZILLA_OFFICIAL=1
 mk_add_options BUILD_OFFICIAL=1
 
 ac_add_options --disable-debug
+# Until we build on a 64bit host we need to hack around linker errors due to
+# memory constraints
+ac_add_options --disable-debug-symbols
 ac_add_options --enable-optimize
 ac_add_options --enable-strip
 ac_add_options --enable-official-branding
@@ -18,12 +34,14 @@ ac_add_options --enable-official-branding
 ac_add_options --enable-tor-browser-update
 ac_add_options --enable-signmar
 ac_add_options --enable-verify-mar
+ac_add_options --disable-bits-download
 
 # Let's make sure no preference is enabling either Adobe's or Google's CDM.
 ac_add_options --disable-eme
 ac_add_options --disable-crashreporter
 ac_add_options --disable-maintenance-service
-ac_add_options --disable-webrtc
+ac_add_options --enable-proxy-bypass-protection
+ac_add_options --disable-webrtc # Bug 1393901
 ac_add_options --disable-tests
-ac_add_options --disable-stylo # Bugzilla 1390583
-ac_add_options --disable-jemalloc # Bugzilla 1466192
+ac_add_options --disable-jemalloc # Bug 154751
+ac_add_options --disable-geckodriver # Bug 1489320
diff --git a/projects/firefox/mozconfig-windows-x86_64 b/projects/firefox/mozconfig-windows-x86_64
index 62e32c5..c95525b 100644
--- a/projects/firefox/mozconfig-windows-x86_64
+++ b/projects/firefox/mozconfig-windows-x86_64
@@ -1,5 +1,18 @@
 CROSS_COMPILE=1
 
+HOST_CC="clang"
+HOST_CXX="clang++"
+CC="x86_64-w64-mingw32-clang"
+CXX="x86_64-w64-mingw32-clang++"
+CXXFLAGS="-fms-extensions"
+AR=llvm-ar
+RANLIB=llvm-ranlib
+
+clang_path=/var/tmp/dist/mingw-w64-clang
+
+# For Stylo
+BINDGEN_CFLAGS="-I$clang_path/x86_64-w64-mingw32/include/c++/v1 -I$clang_path/x86_64-w64-mingw32/include"
+
 ac_add_options --enable-application=browser
 ac_add_options --target=x86_64-w64-mingw32
 ac_add_options --with-toolchain-prefix=x86_64-w64-mingw32-
@@ -18,12 +31,14 @@ ac_add_options --enable-official-branding
 ac_add_options --enable-tor-browser-update
 ac_add_options --enable-signmar
 ac_add_options --enable-verify-mar
+ac_add_options --disable-bits-download
 
 # Let's make sure no preference is enabling either Adobe's or Google's CDM.
 ac_add_options --disable-eme
 ac_add_options --disable-crashreporter
 ac_add_options --disable-maintenance-service
-ac_add_options --disable-webrtc
+ac_add_options --enable-proxy-bypass-protection
+ac_add_options --disable-webrtc # Bug 1393901
 ac_add_options --disable-tests
-ac_add_options --disable-stylo # Bugzilla 1390583
-ac_add_options --disable-jemalloc # Bugzilla 1466192
+ac_add_options --disable-jemalloc # Bug 1547519
+ac_add_options --disable-geckodriver # Bug 1489320



More information about the tbb-commits mailing list