updated on Wed Jan 25 20:08:56 UTC 2012
[aur-mirror.git] / firefox-pgo-hg / PKGBUILD
blob7085970b0a74756ee834335f051142356dcd5e9d
1 # Contributor: Flamelab <panosfilip@gmail.com>
2 # Based on: firerox-pgo-minefield PKGBUILD by ranguvar
4 pkgname=firefox-pgo-hg
5 pkgver=76168
6 pkgrel=1
7 _prever=9.0a1
8 _mozver=central
9 pkgdesc="Standalone web browser from mozilla.org, latest development version. XULRunner independent, PGO optimized."
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
15 #_soundsystem='oss'
17 depends=('gtk2>=2.20.1' 'gcc-libs>=4.5.1' 'libidl2>=0.8.13' 'mozilla-common'
18          'nss>=3.12.8' 'libxt' 'hunspell>=1.2.12' 'startup-notification>=0.10'
19          'libnotify>=0.4' 'mime-types' 'dbus-glib>=0.86' 'desktop-file-utils'
20          'cairo>=1.10.2-2' 'libpng>=1.4.0' 'libevent>=2.0.10'  'lcms>=1.19' 'nspr>=4.8.7'
21          'libvpx>=0.9.6-2' 'alsa-lib>=1.0.23' 'sqlite3>=3.7.4')
22 makedepends=('autoconf2.13' 'gcc>=4.5.1' 'yasm>=1.0.1' 'zip' 'pkg-config' 'diffutils'
23              'libgnomeui>=2.24.1' 'python2' 'wireless_tools' 'xorg-server-xvfb' 'mercurial' ${_soundsystem})
24 provides=("firefox=$_prever")
25 conflicts=('firefox')
27 source=(mozconfig
28         firefox.desktop
29         firefox-safe.desktop
30         ldflags-namespec.patch
31         jemalloc-enable-pgo.patch
32         potential-pgo-fix.patch
35 _hgroot="http://hg.mozilla.org/"
36 _hgrepo=mozilla-central
39 build() {
41   
42   cd ${srcdir}
43   if [ -d mozilla-central-build ];
44      then rm -r mozilla-central-build;
45   fi
46   msg "Creating a build directory..."
47   hg clone mozilla-central mozilla-central-build
48   msg "Entering build directory..."
49   cd mozilla-central-build
50   cp ${srcdir}/mozconfig .mozconfig
51         # Don't strip if the user doesn't want to... ;p
52         if [ "$(check_option strip)" = "n" ]; then
53                 msg "Source debugging symbols' stripping is disabled. This package can be used for debugging."
54                 sed -i 's/--enable-strip/--disable-strip/' \
55                         .mozconfig || return 1
56                 sed -i 's/--enable-install-strip/--disable-install-strip/' \
57                         .mozconfig || return 1
58         fi
60         if [ "$_soundsystem" = "oss" ]; then
61                 msg "Using OSS instead of ALSA..."
62                 sed -i 's/sydney_audio_alsa/sydney_audio_oss/' \
63                        media/libsydneyaudio/src/Makefile.in || return 1
64                 # Get rid of ALSA config system stuff (requires autoconf rerun)
65                 sed -i '/alsa\//d' config/system-headers || return 1
66                 sed -i '/alsa\//d' js/src/config/system-headers || return 1
67                 sed -i '/LIB(asound/d' configure.in || return 1
68         fi
71         msg "Patching source."
72         msg "Patches used for PGO optimisation..."
73         # PGO compilation LDFLAGS fix
74         patch -Np1 -i "$srcdir"/ldflags-namespec.patch || return 1
75         # Enable experimental PGO for jemalloc (speed).
76         patch -Np0 -i "$srcdir"/jemalloc-enable-pgo.patch || return 1
77         
78         #Fix, in case build fails.
79         #patch -Np1 -i "$srcdir/potential-pgo-fix.patch" || return 1
80     
81         msg "Setting up build."
82         export CFLAGS="-march=native -O2 -pipe"
83         export CXXFLAGS="-march=native -O2 -pipe"
85         export LDFLAGS="-Wl,-rpath,/usr/lib/firefox-$_prever -Wl,-O1,--sort-common,--hash-style=gnu,--as-needed"
87         autoconf-2.13 || return 1
90         msg "Actual build."
92         make -j1 -f client.mk build MOZ_MAKE_FLAGS="$MAKEFLAGS" || return 1
93         msg "Profiled build now."
94         # Don't let PGO disrupt the user, use a virtual framebuffer.
95         LD_PRELOAD="" /usr/bin/Xvfb -nolisten tcp -extension GLX :99 &
96         XPID=$!  # Store the PID of the framebuffer
97         DISPLAY=:99 LD_PRELOAD="" make -j1 -f client.mk profiledbuild \
98                 MOZ_MAKE_FLAGS="$MAKEFLAGS"
99         RC=$?  # Store the make return code
100         kill -9 $XPID  # Kill the framebuffer
101         if [ $RC != 0 ]; then  # Build did not succeed, fail
102                 return 1
103         fi
105 package() {
107         
109         cd "$srcdir/mozilla-central-build"
111         export PYTHON=python2
113         msg "Installing to $pkgdir."
114         make -j1 DESTDIR="$pkgdir" -C ff-pgo install || return 1
116         #install -Dm644 "$srcdir/mozilla-$_mozver/other-licenses/branding/firefox/mozicon128.png" \
117         #       "$pkgdir/usr/share/pixmaps/firefox.png" || return 1
118         install -Dm644 "$srcdir/firefox.desktop" \
119                 "$pkgdir/usr/share/applications/firefox.desktop" || return 1
120         install -Dm644 "$srcdir/firefox-safe.desktop" \
121                 "$pkgdir/usr/share/applications/firefox-safe.desktop" \
122                 || return 1
124         # Remove devel stuff.
125         rm -rf "$pkgdir/usr/include/"
126         rm -rf "$pkgdir/usr/lib/firefox-devel-$_prever/"
127         rm -rf "$pkgdir/usr/share/idl/"
131 md5sums=('76d59e0eef541ea99ccc3f8df9cb9f29'
132          '68cf02788491c6e846729b2f2913bf79'
133          '5e68cabfcf3c021806b326f664ac505e'
134          '9e461e5fc73b241d68d08be908405a5e'
135          'df6fde73c9fdb38245f50b9b5bb09024'
136          '9587e0e6da42c883e34a46ee35cc3b7d')