From f856d6fcc597a7ea5934b94cfe244ae6f27f1123 Mon Sep 17 00:00:00 2001
From: Evangelos Foutras <foutrelis@archlinux.org>
Date: Wed, 10 Apr 2013 13:20:56 +0000
Subject: [PATCH] Add workaround for preprocessor misdetection (FS#34644).

---
 PKGBUILD | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/PKGBUILD b/PKGBUILD
index 5f1b9c3..8aa8e6a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -25,7 +25,7 @@ md5sums=('e664416da2075f13089fe3e883cadb73'
          '0d053487907de4376d67d8f499c5502b'
          '52e52f840a49eb1d14be1c0065b03a93')
 
-build() {
+prepare() {
   cd mozilla-release
 
   cp ../mozconfig .mozconfig
@@ -37,7 +37,6 @@ build() {
     browser/base/Makefile.in
 
   mkdir "$srcdir/path"
-  export PATH="$srcdir/path:$PATH"
 
   # WebRTC build tries to execute "python" and expects Python 2
   ln -s /usr/bin/python2 "$srcdir/path/python"
@@ -45,6 +44,15 @@ build() {
   # Use gold, as Mozilla can use some of its features, such as safe ICF
   ln -s /usr/bin/ld.gold "$srcdir/path/ld"
 
+  # configure script misdetects the preprocessor without an optimization level
+  # https://bugs.archlinux.org/task/34644
+  sed -i '/ac_cpp=/s/$CPPFLAGS/& -O2/' configure
+}
+
+build() {
+  cd mozilla-release
+
+  export PATH="$srcdir/path:$PATH"
   export LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/lib/firefox"
   export PYTHON="/usr/bin/python2"
   export MOZ_MAKE_FLAGS="$MAKEFLAGS"
-- 
GitLab