1 # Maintainer: Devin Cofer <ranguvar{AT]archlinux[DOT}us>
2 # Contributor: blasse <koralik(at)gmail(dot)com>
4 # This package is not a normal -hg package. I manually bump $_workingrev every now and again when
5 # a revision of Firefox passes all of the Linux tests on http://bit.ly/1O4siz
7 pkgname=firefox-pgo-minefield
11 _workingrev='d632fb50f68d'
13 pkgdesc="Mozilla Firefox customizable web browser (XULRunner independent, PGO optimized, 64-bit TraceMonkey, dev tree)"
14 url="http://www.mozilla.org/projects/firefox"
15 arch=('i686' 'x86_64')
16 license=('MPL' 'GPL' 'LGPL')
18 _soundsystem='alsa-lib' # 'alsa-lib' for ALSA, 'oss' for OSS
20 makedepends=('mercurial' 'autoconf2.13' 'gcc>=4.4' 'zip' 'pkgconfig'
21 'diffutils' 'libgnomeui>=2.24.1' 'python' 'wireless_tools')
22 depends=('gtk2>=2.18.0' 'gcc-libs>=4.4' 'libidl2>=0.8.13' 'mozilla-common'
23 'nss>=3.12.4' 'libxt' 'hunspell>=1.2.8' 'startup-notification>=0.10'
24 'libnotify>=0.4' 'mime-types' 'dbus-glib>=0.82' 'desktop-file-utils'
25 'cairo' 'libpng>=1.4.0' ${_soundsystem})
26 replaces=('firefox-hg-pgo')
27 provides=("firefox=$_prever" "firefox-hg=$pkgver" "firefox-pgo=$_prever"
28 "firefox-beta=$_prever" "firefox-pgo-beta=$_prever")
29 conflicts=('firefox' 'firefox-hg' 'firefox-pgo' 'firefox-beta'
30 'firefox-pgo-beta' 'firefox-pgo-minefield-smp')
34 'firefox-safe.desktop'
35 'fix-mozilla-launcher.patch'
36 'mozilla-firefox-1.0-lang.patch'
37 'ldflags-namespec.patch'
38 'jemalloc-enable-pgo.patch'
39 'potential-pgo-fix.patch')
40 sha256sums=('8d08ee111b88473a53e8c0852d463971af7a827f796a94d3fe74ca2eed76ca0b'
41 '21722965bb0bab05e3fbd2f584dbcaeb9f0726ed755f59bbf6fb26a7f964e6ec'
42 '00641e2d7ba45a607522a621aa86c21e13b2951ebca920b1e0b538b0e1188445'
43 'd4948cc5878b2100b4d19b0fbc09119c34377593c5847678d5788db2b4e0fe43'
44 '0ca095ff2af57297f615877a7e79ddc84d1a3f62509a8af6ca50aad7a8671f6a'
45 '0e9631fdad5efa3fd7a95b59171f5d15420d10aa61748b920cc994ee9227915c'
46 'e6b8345215eb0c595cadfd6b1abb3a12a1cad8b8b1f3528e6affc58900695215'
47 'bf53a9712aada73dbecb45516bf932b52e7b8debf25cf19294adbfcc54d80028')
49 # Don't use normal _hgroot/_hgrepo, we don't want Pacman automagically changing the pkgver.
50 _ff_hgroot="http://hg.mozilla.org/"
54 msg "* Note: If the build fails, try again, try without jemalloc PGO, and try *"
55 msg "* without PGO at all. Also, try with 'potential-pgo-fix.patch'. PGO can be *"
56 msg "* temperamental -- it can sometimes take two or three builds before you'll *"
57 msg "* get a good one. *"
61 # It can take a long time to re-fetch the Mozilla source...
62 # The commented lines are for use by experienced users who build often.
63 hg clone "$_ff_hgroot/mozilla-$_mozver" "mozilla-$_mozver" || return 1
64 # tar xf "$startdir/mozilla-$_mozver.tar.gz" || return 1
67 # hg update || return 1
69 # tar czf "$startdir/mozilla-$_mozver.tar.gz" "mozilla-$_mozver" || return 1
70 # cd "mozilla-$_mozver"
71 hg up "$_workingrev" || return 1 # Comment out this line to use the untested latest source.
73 cp "$srcdir/mozconfig" .mozconfig || return 1
74 # Don't strip if the user doesn't want to... ;p
75 if [ "$(check_option strip)" = "n" ]; then
76 sed -i 's/--enable-strip/--disable-strip/' \
77 .mozconfig || return 1
78 sed -i 's/--enable-install-strip/--disable-install-strip/' \
79 .mozconfig || return 1
82 if [ "$_soundsystem" = "oss" ]; then
83 msg "Using OSS instead of ALSA."
84 sed -i 's/sydney_audio_alsa/sydney_audio_oss/' \
85 media/libsydneyaudio/src/Makefile.in || return 1
86 # Get rid of ALSA config system stuff (requires autoconf rerun)
87 sed -i '/alsa\//d' config/system-headers || return 1
88 sed -i '/alsa\//d' js/src/config/system-headers || return 1
89 sed -i '/LIB(asound/d' configure.in || return 1
93 msg "Patching source."
94 msg "Patches from main Arch xulrunner/firefox packages..."
95 # Fix stub launcher - Arch
96 patch -Np0 -i "$srcdir"/fix-mozilla-launcher.patch || return 1
97 # Use LANG environment variable to choose locale
98 patch -Np1 -i "$srcdir"/mozilla-firefox-1.0-lang.patch || return 1
101 msg "Patches from this package..."
102 # PGO compilation LDFLAGS fix
103 patch -Np1 -i "$srcdir"/ldflags-namespec.patch || return 1
104 # Enable experimental PGO for jemalloc (speed).
105 # See Mozilla bugs #418866 and #419470.
106 patch -Np0 -i "$srcdir"/jemalloc-enable-pgo.patch || return 1
107 # Sometimes necessary for PGO build to work, especially when PGO compile
108 # aborts with an error about control sum mismatch (thx to methuselah!)
109 # patch -Np1 -i "$srcdir/potential-pgo-fix.patch" || return 1
112 msg "Setting up build."
113 # Changing the user's optimization flags is justified, because this is
114 # a package specifically for an optimized software build, and because of
115 # the official branding, binaries can't be redistributed anyways.
116 # These flags just set guidelines for the build, they are overridden in
117 # most compile job pieces by Firefox's better judgement.
118 export CFLAGS="-march=native -O2 -pipe"
119 export CXXFLAGS="-march=native -O2 -pipe"
120 # The hash-style and as-needed flags are in Arch defaults anyways,
121 # and the other optimization flags are almost definitely safe.
122 export LDFLAGS="-Wl,-rpath,/usr/lib/firefox-$_prever -Wl,-O1,--sort-common,--hash-style=gnu,--as-needed"
124 autoconf-2.13 || return 1
128 # Yes, all this is SMP -- MOZ_MAKE_FLAGS takes care of it.
129 # Compile a non-PGO build first to reduce chance of error in PGO build.
130 make -j1 -f client.mk build MOZ_MAKE_FLAGS="$MAKEFLAGS" || return 1
131 # Comment out remaining lines for a non-PGO build.
132 msg "Profiled build now."
133 # Don't let PGO disrupt the user, use a virtual framebuffer.
134 LD_PRELOAD="" /usr/bin/Xvfb -nolisten tcp -extension GLX :99 &
135 XPID=$! # Store the PID of the framebuffer
136 DISPLAY=:99 LD_PRELOAD="" make -j1 -f client.mk profiledbuild \
137 MOZ_MAKE_FLAGS="$MAKEFLAGS"
138 RC=$? # Store the make return code
139 kill -9 $XPID # Kill the framebuffer
140 if [ $RC != 0 ]; then # Build did not succeed, fail
145 cd "$srcdir/mozilla-$_mozver"
147 msg "Installing to $pkgdir."
148 make -j1 DESTDIR="$pkgdir" -C ff-pgo install || return 1
150 install -Dm644 "$srcdir/mozilla-$_mozver/other-licenses/branding/firefox/mozicon128.png" \
151 "$pkgdir/usr/share/pixmaps/firefox.png" || return 1
152 install -Dm644 "$srcdir/firefox.desktop" \
153 "$pkgdir/usr/share/applications/firefox.desktop" || return 1
154 install -Dm644 "$srcdir/firefox-safe.desktop" \
155 "$pkgdir/usr/share/applications/firefox-safe.desktop" \
158 # Remove devel stuff.
159 rm -rf "$pkgdir/usr/include/"
160 rm -rf "$pkgdir/usr/lib/firefox-devel-$_prever/"
161 rm -rf "$pkgdir/usr/share/idl/"