[arch-commits] Commit in firefox/trunk (PKGBUILD hack-buildsymbols.patch)

Jan Steffens heftig at archlinux.org
Thu Oct 3 20:45:57 UTC 2019


    Date: Thursday, October 3, 2019 @ 20:45:56
  Author: heftig
Revision: 363710

69.0.2-1

Added:
  firefox/trunk/hack-buildsymbols.patch
Modified:
  firefox/trunk/PKGBUILD

-------------------------+
 PKGBUILD                |   66 +++++++++++++++++++++++++++++++++++++++-------
 hack-buildsymbols.patch |   47 ++++++++++++++++++++++++++++++++
 2 files changed, 104 insertions(+), 9 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2019-10-03 19:45:44 UTC (rev 363709)
+++ PKGBUILD	2019-10-03 20:45:56 UTC (rev 363710)
@@ -3,7 +3,7 @@
 # Contributor: Jakub Schmidtke <sjakub at gmail.com>
 
 pkgname=firefox
-pkgver=69.0.1
+pkgver=69.0.2
 pkgrel=1
 pkgdesc="Standalone web browser from mozilla.org"
 arch=(x86_64)
@@ -21,10 +21,12 @@
             'hunspell-en_US: Spell checking, American English')
 options=(!emptydirs !makeflags !strip)
 source=(https://archive.mozilla.org/pub/firefox/releases/$pkgver/source/firefox-$pkgver.source.tar.xz{,.asc}
+        hack-buildsymbols.patch
         0001-Use-remoting-name-for-GDK-application-names.patch
         $pkgname.desktop firefox-symbolic.svg)
-sha256sums=('f5f2f592b8296812d43244d6a50c0c57ad11a5324db8e4e79749545482b79033'
+sha256sums=('2904ef954626d2a7f320670ccb7cb5d9060610f091c94190a6cbee14aa2cd82e'
             'SKIP'
+            'f16c614ab7268176021eba63050bf6018c9ebeebc419c5db62480f867c7c7535'
             'ab07ab26617ff76fce68e07c66b8aa9b96c2d3e5b5517e51a3c3eac2edd88894'
             'a9e5264257041c0b968425b5c97436ba48e8d294e1a0f02c59c35461ea245c33'
             '9a1a572dc88014882d54ba2d3079a1cf5b28fa03c5976ed2cb763c93dabbd797')
@@ -46,6 +48,9 @@
   mkdir mozbuild
   cd firefox-$pkgver
 
+  # Do symbol dumping during compile
+  patch -Np1 -i ../hack-buildsymbols.patch
+
   # https://bugzilla.mozilla.org/show_bug.cgi?id=1530052
   patch -Np1 -i ../0001-Use-remoting-name-for-GDK-application-names.patch
 
@@ -52,7 +57,7 @@
   echo -n "$_google_api_key" >google-api-key
   echo -n "$_mozilla_api_key" >mozilla-api-key
 
-  cat >.mozconfig <<END
+  cat >../mozconfig <<END
 ac_add_options --enable-application=browser
 
 ac_add_options --prefix=/usr
@@ -60,10 +65,8 @@
 ac_add_options --enable-hardening
 ac_add_options --enable-optimize
 ac_add_options --enable-rust-simd
-ac_add_options --enable-lto
-export MOZ_PGO=1
-export CC=clang
-export CXX=clang++
+export CC='clang --target=x86_64-unknown-linux-gnu'
+export CXX='clang++ --target=x86_64-unknown-linux-gnu'
 export AR=llvm-ar
 export NM=llvm-nm
 export RANLIB=llvm-ranlib
@@ -107,8 +110,46 @@
   # LTO needs more open files
   ulimit -n 4096
 
+  # -fno-plt with cross-LTO causes obscure LLVM errors
+  # LLVM ERROR: Function Import: link error
+  CFLAGS="${CFLAGS/-fno-plt/}"
+  CXXFLAGS="${CXXFLAGS/-fno-plt/}"
+
+  # Do 3-tier PGO
+  msg2 "Building instrumented browser..."
+  cat >.mozconfig ../mozconfig - <<END
+ac_add_options --enable-profile-generate
+END
+  ./mach build
+
+  msg2 "Profiling instrumented browser..."
+  ./mach package
+  LLVM_PROFDATA=llvm-profdata \
+    JARLOG_FILE="$PWD/jarlog" \
+    xvfb-run -a -n 92 -s "-screen 0 1600x1200x24" \
+    ./mach python build/pgo/profileserver.py
+
+  if ! compgen -G '*.profraw' >&2; then
+    error "No profile data produced."
+    return 1
+  fi
+
+  if [[ ! -s jarlog ]]; then
+    error "No jar log produced."
+    return 1
+  fi
+
+  msg2 "Removing instrumented browser..."
+  ./mach clobber
+
   msg2 "Building optimized browser..."
-  xvfb-run -a -n 97 -s "-screen 0 1600x1200x24" ./mach build
+  cat >.mozconfig ../mozconfig - <<END
+ac_add_options --enable-lto=cross
+ac_add_options --enable-profile-use
+ac_add_options --with-pgo-profile-path=${PWD at Q}
+ac_add_options --with-pgo-jarlog=${PWD at Q}/jarlog
+END
+  ./mach build
 
   msg2 "Building symbol archive..."
   ./mach buildsymbols
@@ -117,7 +158,6 @@
 package() {
   cd firefox-$pkgver
   DESTDIR="$pkgdir" ./mach install
-  find . -name '*crashreporter-symbols-full.zip' -exec cp -fvt "$startdir" {} +
 
   _vendorjs="$pkgdir/usr/lib/$pkgname/browser/defaults/preferences/vendor.js"
   install -Dm644 /dev/stdin "$_vendorjs" <<END
@@ -172,6 +212,14 @@
   # https://bugzilla.mozilla.org/show_bug.cgi?id=658850
   ln -srf "$pkgdir/usr/bin/$pkgname" \
     "$pkgdir/usr/lib/$pkgname/firefox-bin"
+
+  if [[ -f "$startdir/.crash-stats-api.token" ]]; then
+    find . -name '*crashreporter-symbols-full.zip' -exec \
+      "$startdir/upload-symbol-archive" "$startdir/.crash-stats-api.token" {} +
+  else
+    find . -name '*crashreporter-symbols-full.zip' -exec \
+      cp -fvt "$startdir" {} +
+  fi
 }
 
 # vim:set sw=2 et:

Added: hack-buildsymbols.patch
===================================================================
--- hack-buildsymbols.patch	                        (rev 0)
+++ hack-buildsymbols.patch	2019-10-03 20:45:56 UTC (rev 363710)
@@ -0,0 +1,47 @@
+diff --git i/Makefile.in w/Makefile.in
+index 626edae551d3..781e41269723 100644
+--- i/Makefile.in
++++ w/Makefile.in
+@@ -239,7 +239,7 @@ prepsymbolsarchive:
+ 	echo packing symbols
+ 	$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
+ 
+-ifndef MOZ_AUTOMATION
++ifndef MOZ_PROFILE_USE
+ prepsymbolsarchive: recurse_syms
+ endif
+ 
+diff --git i/config/recurse.mk w/config/recurse.mk
+index ed2e187061aa..379b9042a8e4 100644
+--- i/config/recurse.mk
++++ w/config/recurse.mk
+@@ -76,11 +76,9 @@ $(compile_targets) $(syms_targets):
+ $(syms_targets): %/syms: %/target
+ 
+ # Only hook symbols targets into the main compile graph in automation.
+-ifdef MOZ_AUTOMATION
+-ifeq (1,$(MOZ_AUTOMATION_BUILD_SYMBOLS))
++ifdef MOZ_PROFILE_USE
+ recurse_compile: $(syms_targets)
+ endif
+-endif
+ 
+ # Create a separate rule that depends on every 'syms' target so that
+ # symbols can be dumped on demand locally.
+diff --git i/config/rules.mk w/config/rules.mk
+index fefe2805fb92..b5641eae15ba 100644
+--- i/config/rules.mk
++++ w/config/rules.mk
+@@ -750,11 +750,9 @@ DUMP_SYMS_TARGETS := $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS)
+ endif
+ endif
+ 
+-ifdef MOZ_AUTOMATION
+-ifeq (,$(filter 1,$(MOZ_AUTOMATION_BUILD_SYMBOLS)))
++ifdef MOZ_PROFILE_GENERATE
+ DUMP_SYMS_TARGETS :=
+ endif
+-endif
+ 
+ ifdef MOZ_COPY_PDBS
+ MAIN_PDB_FILES = $(addsuffix .pdb,$(basename $(DUMP_SYMS_TARGETS)))



More information about the arch-commits mailing list