updated on Tue Jan 17 08:05:08 UTC 2012
[aur-mirror.git] / firefox3-pgo / PKGBUILD
blob18c72abf4484a5e004503bd20927a9f26da08152
1 # Maintainer:  Michael Duell <akurei+aur.archlinux.org{AT]luamail[DOT}net>
2 # Contributor: Devin Cofer <ranguvar{AT]archlinux[DOT}us>
3 # Contributor: blasse <koralik(at)gmail(dot)com>
5 pkgname=firefox3-pgo
6 pkgver=3.6.16
7 _mozver=1.9.2
8 pkgrel=1
9 pkgdesc="Mozilla Firefox customizable web browser (XULRunner independent, PGO optimized, 64-bit TraceMonkey)"
10 url="http://www.mozilla.org/projects/firefox"
11 arch=('i686' 'x86_64')
12 license=('MPL' 'GPL' 'LGPL')
14 _soundsystem='alsa-lib'  # 'alsa-lib' for ALSA, 'oss' for OSS
16 makedepends=('autoconf2.13' 'gcc>=4.4' 'zip' 'pkgconfig' 'diffutils'
17              'libgnomeui>=2.24.1' 'python2' 'wireless_tools' 'yasm>=0.7.1'
18              'xorg-server-xvfb')
19 depends=('gtk2>=2.18.0' 'gcc-libs>=4.4' 'libidl2>=0.8.13' 'mozilla-common'
20          'nss>=3.12.4' 'libxt' 'hunspell>=1.2.8' 'startup-notification>=0.10'
21          'libnotify>=0.4' 'mime-types' 'dbus-glib>=0.82' 'desktop-file-utils'
22          'cairo' 'libpng>=1.4.0' 'libevent>=2.0' ${_soundsystem})
23 provides=("firefox=$pkgver" "firefox-pgo-beta=$pkgver" "firefox-beta=$pkgver")
24 conflicts=('firefox' 'firefox-pgo-beta' 'firefox-beta' 'firefox-pgo-minefield' 'firefox-pgo-minefield-smp')
26 source=("ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/$pkgver/source/firefox-$pkgver.source.tar.bz2"
27         'mozconfig'
28         'firefox.desktop'
29         'firefox-safe.desktop'
30         'firefox.install'
31         'browser-defaulturls.patch'
32             'fix-mozilla-launcher.patch'
33             'mozilla-firefox-1.0-lang.patch'
34             'xulrunner-version.patch'
35             'firefox-version.patch'
36             'xulrunner-png14.patch'
37         'ldflags-namespec.patch'
38         'enable-x86_64-tracemonkey.patch'
39         'jemalloc-enable-pgo.patch'
40         'gnome-notify.patch'
41         'potential-pgo-fix.patch')
42 sha256sums=('e0a56db439484538d7a1156304b74249a8f1108be23fb4b0dc4fb94777ae29cc'
43             'b2a43c32d63ef5148596824f64d6b49830354ba2f5756e632f350e515dac0729'
44             '83a14017a6a09491db22b9d6972e0bd39f528c6a79fe8695d6fc5f9350c8e293'
45             '4b6de45753856a890f4482055666e77f9b01bdfb7e0df08bafaa3a4d9937eed3'
46             '4fa604c579cb90ceedd6385e7757a56187f9696f0c62ff415e7ef7aec7b92179'
47             'b72ea353b44fb0cbd6aecf17704711dc70090a8d4afe1320c871309c969cf33a'
48             'd4948cc5878b2100b4d19b0fbc09119c34377593c5847678d5788db2b4e0fe43'
49             '0ca095ff2af57297f615877a7e79ddc84d1a3f62509a8af6ca50aad7a8671f6a'
50             '6c36e825ad6a35f33561678e27995e26601a91f6951af3144908560ef513d134'
51             '802d3c14f5c040c225450131147d4c19bbcc0225910c4b573616851583c66886'
52             '25885629767e42d06d93083b5748c95e94304bf5637997bf6446ab9b3893d1a5'
53             '0e9631fdad5efa3fd7a95b59171f5d15420d10aa61748b920cc994ee9227915c'
54             '20f558efbf4ed1960b390c353c7eeb94108fcdb8aaf33f1fea6caf44468aeb7c'
55             'e6b8345215eb0c595cadfd6b1abb3a12a1cad8b8b1f3528e6affc58900695215'
56             '00f3a5f2aa709786d5b1739cb4e212feddfd9ef3b0200848715280c87024d3f3'
57             'bf53a9712aada73dbecb45516bf932b52e7b8debf25cf19294adbfcc54d80028')
59 install='firefox.install'
62 build() {
63         msg "* Note: If the build fails, try again, try without jemalloc PGO, try without *"
64         msg "* PGO at all, and if you're using x86_64, try without TraceMonkey. Also, try *"
65         msg "* with 'potential-pgo-fix.patch'. PGO can be very temperamental -- it can    *"
66         msg "* sometimes take two or three builds before you'll get a good one.           *"
67         sleep 10
68         cd "$srcdir"/mozilla-$_mozver
70         cp "$srcdir"/mozconfig .mozconfig
71         # Don't strip if the user doesn't want us to... ;p
72         if [ "$(check_option strip)" = "n" ]; then
73                 sed -i 's/--enable-strip/--disable-strip/' .mozconfig
74                 sed -i 's/--enable-install-strip/--disable-install-strip/' \
75                         .mozconfig
76         fi
78         if [ "$_soundsystem" = "oss" ]; then
79                 msg "Using OSS instead of ALSA."
80                 sed -i 's/sydney_audio_alsa/sydney_audio_oss/' \
81                        media/libsydneyaudio/src/Makefile.in
82                 # Get rid of ALSA config system stuff (requires autoconf rerun)
83                 sed -i '/alsa\//d' config/system-headers
84                 sed -i '/alsa\//d' js/src/config/system-headers
85                 sed -i '/LIB(asound/d' configure.in
86         fi
89         msg "Patching source."
90         msg "Patches from distro packages..."
91         # Adjust default URLs - Arch
92         patch -Np1 -i "$srcdir"/browser-defaulturls.patch
93         # Fix stub launcher - Arch
94         patch -Np0 -i "$srcdir"/fix-mozilla-launcher.patch
95         # Use LANG environment variable to choose locale
96         patch -Np1 -i "$srcdir"/mozilla-firefox-1.0-lang.patch
97         # Version patches(?)
98         patch -Np1 -i "$srcdir"/xulrunner-version.patch
99         patch -Np1 -i "$srcdir"/firefox-version.patch
100         # Fix build with libpng 1.4.0 - Arch
101         patch -Np0 -i "$srcdir"/xulrunner-png14.patch
102     # Fix GNOME notify system
103     patch -Np1 -i "$srcdir"/gnome-notify.patch 
106         msg "Patches from this package..."
107         # PGO compilation LDFLAGS fix
108         patch -Np1 -i "$srcdir"/ldflags-namespec.patch
109         # Enable TraceMonkey engine on x86_64; normally only firefox>=3.7
110         # has 64-bit TM.  See Mozilla bug #489146.  Requires autoconf run.
111         # Does not affect 32-bit builds. This can be problematic, but it should
112         # boost speed FAR more than PGO. So, if only PGO and only TM build,
113         # but not both, go with TM.
114         patch -Np0 -i "$srcdir"/enable-x86_64-tracemonkey.patch
115         # Enable experimental PGO for jemalloc (speed).
116         # See Mozilla bugs #418866 and #419470.
117         patch -Np0 -i "$srcdir"/jemalloc-enable-pgo.patch
118         # Sometimes necessary for PGO build to work, especially when PGO compile
119         # aborts with an error about control sum mismatch (thx to methuselah!)
120 #       patch -Np1 -i "$srcdir/potential-pgo-fix.patch"
123         msg "Setting up build."
124         # Changing the user's optimization flags is justified, because this is
125         # a package specifically for an optimized software build, and because of
126         # the official branding, binaries can't be redistributed anyways.
127         # These flags just set guidelines for the build, they are overridden in
128         # most compile job pieces by Firefox's better judgement.
129         export CFLAGS="-march=native -O2 -pipe"
130         export CXXFLAGS="-march=native -O2 -pipe"
131         # The hash-style and as-needed flags are in Arch defaults anyways,
132         # and the other optimization flags are almost definitely safe.
133         export LDFLAGS="-Wl,-rpath,/usr/lib/firefox-$pkgver -Wl,-O1,--sort-common,--hash-style=gnu,--as-needed"
134         export PYTHON=python2
136         autoconf-2.13
139         msg "Actual build."
140         # Yes, all this is SMP -- MOZ_MAKE_FLAGS takes care of it.
141         # Compile a non-PGO build first to reduce chance of error in PGO build.
142         make -j1 -f client.mk build MOZ_MAKE_FLAGS="$MAKEFLAGS"
143         # Comment out remaining lines for a non-PGO build.
144         msg "Profiled build now."
145         # Don't let PGO disrupt the user, use a virtual framebuffer.
146         LD_PRELOAD="" /usr/bin/Xvfb -nolisten tcp -extension GLX :99 &
147         XPID=$!  # Store the PID of the framebuffer
148         DISPLAY=:99 LD_PRELOAD="" make -j1 -f client.mk profiledbuild \
149                 MOZ_MAKE_FLAGS="$MAKEFLAGS"
150         RC=$?  # Store the make return code
151         kill -9 $XPID  # Kill the framebuffer
152         if [ $RC != 0 ]; then  # Build did not succeed, fail
153                 return 1
154         fi
156 package() {
157         cd "$srcdir/mozilla-$_mozver"
159         msg "Installing to $pkgdir."
160         make -j1 DESTDIR="$pkgdir" -C ff-pgo install
162         install -Dm644 "$srcdir/mozilla-$_mozver/other-licenses/branding/firefox/mozicon128.png" \
163                 "$pkgdir/usr/share/pixmaps/firefox.png"
164         install -Dm644 "$srcdir/firefox.desktop" \
165                 "$pkgdir/usr/share/applications/firefox.desktop"
166         install -Dm644 "$srcdir/firefox-safe.desktop" \
167                 "$pkgdir/usr/share/applications/firefox-safe.desktop"
169         # Remove devel stuff.
170         rm -rf "$pkgdir/usr/include/"
171         rm -rf "$pkgdir/usr/lib/firefox-devel-$pkgver/"
172         rm -rf "$pkgdir/usr/share/idl/"