1 # Maintainer: Devin Cofer <ranguvar@archlinux.us>
2 # Contributor: wantilles <wantilles@adslgr.com>
3 # Contributor: blasse <koralik(at)gmail(dot)com>
5 # Package Maintenance Resources:
6 # http://projects.archlinux.org/svntogit/packages.git/tree/xulrunner/trunk/
7 # http://projects.archlinux.org/svntogit/packages.git/tree/firefox/trunk/
8 # http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-libs/xulrunner/
9 # http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-client/firefox/
10 # http://dev.gentoo.org/~anarchy/mozilla/patchsets/
11 # http://bazaar.launchpad.net/~mozillateam/xulrunner/xulrunner-2.0.head/files/head:/debian/patches/
12 # http://bazaar.launchpad.net/~mozillateam/firefox/firefox-4.0.head/files/head:/debian/patches/
13 # http://pkgs.fedoraproject.org/gitweb/?p=xulrunner.git;a=summary
14 # http://pkgs.fedoraproject.org/gitweb/?p=firefox.git;a=summary
15 # http://www.freebsd.org/cgi/cvsweb.cgi/ports/www/libxul/
16 # http://www.freebsd.org/cgi/cvsweb.cgi/ports/www/firefox/
17 # http://aur.archlinux.org/packages.php?ID=45446
19 pkgname=firefox-pgo-beta
22 _ffver=${_ffmajorver}.1
24 pkgver=${_ffver}${_build}
26 pkgdesc="Mozilla Firefox customizable web browser (XULRunner-independent, profile-guided optimization, beta)"
27 url="http://www.mozilla.com/firefox/"
28 arch=('i686' 'x86_64')
29 license=('MPL' 'GPL' 'LGPL')
31 _soundsystem='alsa-lib' # 'alsa-lib' for ALSA, 'oss' for OSS
33 makedepends=('autoconf2.13' 'zip' 'diffutils' 'python2' 'wireless_tools'
34 'yasm>=0.7.1' 'mesa' 'xorg-server-xvfb')
35 depends=('gtk2' 'gcc-libs' 'libidl2' 'mozilla-common' 'nspr' 'nss' 'libxt'
36 'hunspell' 'startup-notification' 'libnotify' 'mime-types' 'lcms'
37 'dbus-glib' 'desktop-file-utils' 'libpng' 'cairo>=1.10.2-2' 'libevent'
38 'libvpx>=0.9.6-2' ${_soundsystem})
39 optdepends=('firefox-i18n: Language packs')
40 provides=("firefox=$pkgver" "firefox-pgo=$pkgver")
41 conflicts=('firefox' 'firefox-beta' 'firefox-pgo' 'firefox-pgo-minefield' 'firefox-pgo-minefield-smp')
43 source=("ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/$_ffver/source/firefox-$_ffver.source.tar.bz2"
46 'firefox-safe.desktop'
49 'mozilla-pkgconfig.patch'
50 'xulrunner-version.patch'
51 'firefox-version.patch'
52 'xulrunner-omnijar.patch'
53 'port_gnomevfs_to_gio.patch'
54 'mozilla-firefox-1.0-lang.patch'
55 'crashreporter-remove-static.patch'
56 'mozilla-libjpeg-turbo.patch'
57 'fix-nsGIOService.patch'
58 'eliminate-deprecated-gtk-type-macros.patch'
59 'update-ply-2.5-to-3.3.patch'
60 'reload-new-plugins.patch'
61 'plugin-for-mimetype-pref.patch'
62 'firefox-browser-css.patch'
63 'ldflags-namespec.patch'
64 'jemalloc-enable-pgo.patch')
65 sha256sums=('cf3a39877facc229a67760915341fe95095cca647faab3a7adcb70046105199c'
66 '53fdf43532125d5b2e17eb2546dadbd2ea0abdc3c975f9cbfc4ad43b08cd80cb'
67 'cfb1b3442d94650ee3629d7a0a860f6e0ffd337773e4c25ec39c3a061af673f9'
68 '4b6de45753856a890f4482055666e77f9b01bdfb7e0df08bafaa3a4d9937eed3'
69 'd7e29cff81972da7008e9eb036fa2e74674a854134791d5df6ae94e3c536ef00'
70 'dbbdfa2edd8d45e1cdafa852877f2df0c9926f0407d78b49da9e6ab1856a0622'
71 '1530226270332c89c8debf5d638080c59dff05c328811a7321e1c31ae3d6d702'
72 '1aee4194691b2f1cc007117e9cd4f84128c3dfa8179a0a869466551f032d3ed0'
73 '101def78fe2959fb2c6cacd9b6abe2906faa74788a1e680496b521b1643bb5e5'
74 '85477a548a90d98446f618cecb280c5a5fdb74f83f39da74327653bbc41f653e'
75 'ef502dbaac234cda064abb060e6f8df033942c57bdf759396fd3f481fe4e32c8'
76 '0ca095ff2af57297f615877a7e79ddc84d1a3f62509a8af6ca50aad7a8671f6a'
77 '72d8ef7b40172a0cbef957b5f6d459fb53beb9c07e8b713f530b3d7844df091c'
78 'e1cad999850104b575f9a2e4471ebc0ceaadab26a592b13cd5b9f2c73395ebf9'
79 '991d0b968794b569d3b107b0aab8786d9c83007c892c7e76143b5af09ef94405'
80 'b325edc321808db9928a42316f2394e1df7c5e44c7e43664c74ef0f293fbfd78'
81 '50a72984b0b9c724960e9fafec761fcf8504bf4cf581247e492ca996cb8fae1a'
82 '0f48011fd69c5fdbbcf399feb47270f8d54d74f91da501d5e5d314a9eb0fcd4f'
83 '13924242f13f295867fe9108868ac6cfbb04cfc10dffe75f0fa69bbfa8688a92'
84 'd706a6e6febedf707f9f525cf7a3025cc64ebef96d25f486ce84e96941739dfa'
85 '0e9631fdad5efa3fd7a95b59171f5d15420d10aa61748b920cc994ee9227915c'
86 'e6b8345215eb0c595cadfd6b1abb3a12a1cad8b8b1f3528e6affc58900695215')
87 install='firefox.install'
91 # 93 length = 80 on output
92 msg "* Note: If the build fails, try again, try without jemalloc PGO, and try without"
93 msg "* PGO at all. PGO can be very temperamental -- it can sometimes take two or"
94 msg "* three builds before you'll get a good one."
96 cd "$srcdir"/mozilla-$_mozver
98 cp "$srcdir"/mozconfig .mozconfig
99 # Don't strip if the user doesn't want us to... ;p
100 if [ "$(check_option strip)" = "n" ]; then
101 sed -i 's/--enable-strip/--disable-strip/' .mozconfig
102 sed -i 's/--enable-install-strip/--disable-install-strip/' \
105 if [ "$_soundsystem" = "oss" ]; then
106 msg2 "Using OSS instead of ALSA."
107 sed -i 's/sydney_audio_alsa/sydney_audio_oss/' \
108 media/libsydneyaudio/src/Makefile.in
109 # Get rid of ALSA config system stuff (requires autoconf rerun)
110 sed -i '/alsa\//d' config/system-headers
111 sed -i '/alsa\//d' js/src/config/system-headers
112 sed -i '/LIB(asound/d' configure.in
116 msg2 "Patches from distro packages..."
117 # Fix libdir/sdkdir - Fedora, Arch
118 patch -Np1 -i "$srcdir"/mozilla-pkgconfig.patch
119 # Force installation to the same path for every version - Arch, Fedora
120 patch -Np1 -i "$srcdir"/xulrunner-version.patch
121 patch -Np1 -i "$srcdir"/firefox-version.patch
122 # Mozilla bug #620931 - Arch, Fedora
123 patch -Np1 -i "$srcdir"/xulrunner-omnijar.patch
124 # Mozilla bug #494163 - Arch, Fedora
125 patch -Np1 -i "$srcdir"/port_gnomevfs_to_gio.patch
126 # Use LANG environment variable to choose locale - Arch
127 patch -Np1 -i "$srcdir"/mozilla-firefox-1.0-lang.patch
128 # We don't have an old libstdc++ - Fedora
129 patch -Np1 -i "$srcdir"/crashreporter-remove-static.patch
130 # libjpeg-turbo - Fedora
131 patch -Np2 -i "$srcdir"/mozilla-libjpeg-turbo.patch
132 # nsGIOService fixes - Ubuntu
133 patch -Np1 -i "$srcdir"/fix-nsGIOService.patch
134 # Update deprecated GTK type macros - Ubuntu
135 patch -Np1 -i "$srcdir"/eliminate-deprecated-gtk-type-macros.patch
136 # Ensure that new plugins are reloaded - Ubuntu
137 patch -Np1 -i "$srcdir"/reload-new-plugins.patch
138 # Update PLY - Ubuntu
139 patch -Np1 -i "$srcdir"/update-ply-2.5-to-3.3.patch
140 # Add control over plugins used for each mime-type via preferences - Ubuntu
141 patch -Np1 -i "$srcdir"/plugin-for-mimetype-pref.patch
142 # Dark color theme support - OpenSUSE
143 patch -Np1 -i "$srcdir"/firefox-browser-css.patch
145 msg2 "Patches from this package..."
146 # PGO compilation LDFLAGS fix
147 patch -Np1 -i "$srcdir"/ldflags-namespec.patch
148 # Enable experimental PGO for jemalloc (speed).
149 # See Mozilla bugs #418866 and #419470.
150 patch -Np0 -i "$srcdir"/jemalloc-enable-pgo.patch
153 msg2 "Setting up build..."
154 # Changing the user's optimization flags is justified, because this is
155 # a package specifically for an optimized software build, and because of
156 # the official branding, binaries can't be redistributed anyways.
157 # These flags just set guidelines for the build, they are overridden in
158 # most compile job pieces by Firefox's better judgement.
159 export CFLAGS="-march=native -O2 -fpermissive -pipe"
160 export CXXFLAGS="-march=native -O2 -fpermissive -pipe"
161 # The hash-style and as-needed flags are in Arch defaults anyways,
162 # and the other optimization flags are almost definitely safe.
163 export LDFLAGS="-Wl,-rpath,/usr/lib/firefox-$_ffmajorver -Wl,-O1,--sort-common,--hash-style=gnu,--as-needed"
164 export PYTHON=python2
165 echo -n "mk_add_options MOZ_MAKE_FLAGS=\"$MAKEFLAGS\"" >> .mozconfig
169 msg2 "Actual build..."
170 # Yes, all this is SMP -- MOZ_MAKE_FLAGS take care of it.
171 # Uncomment to compile a non-PGO build first, to reduce
172 # chance of error in PGO build. Comment lines after this also if
173 # you want a non-PGO build.
174 make -j1 -f client.mk build
177 # Use this block instead of the next if you wish to manually profile Firefox.
178 # Just go to the desired sites and close the browser when done.
179 # cp "$srcdir"/profile-manual.sh ff-pgo/_profile/pgo/profile-manual.sh
180 # echo -e 'mk_add_options PROFILE_GEN_SCRIPT='\''dash $(MOZ_OBJDIR)/_profile/pgo/profile-manual.sh'\''' >> .mozconfig
181 # make -j1 -f client.mk profiledbuild
183 # Don't let auto-PGO disrupt the user, use a virtual framebuffer.
184 LD_PRELOAD="" /usr/bin/Xvfb -nolisten tcp -extension GLX -terminate :99 &
185 LD_PRELOAD="" DISPLAY=:99 make -j1 -f client.mk profiledbuild
188 cd "$srcdir"/mozilla-$_mozver
190 make -j1 DESTDIR="$pkgdir" -C ff-pgo install
192 for i in 16x16 22x22 24x24 32x32 48x48 256x256; do
193 install -Dm644 other-licenses/branding/firefox/default${i/x*/}.png \
194 "$pkgdir"/usr/share/icons/hicolor/$i/apps/firefox.png
197 install -Dm644 "$srcdir"/firefox.desktop \
198 "$pkgdir"/usr/share/applications/firefox.desktop
199 install -Dm644 "$srcdir"/firefox-safe.desktop \
200 "$pkgdir"/usr/share/applications/firefox-safe.desktop
203 rm -rf "$pkgdir"/usr/include/
204 rm -rf "$pkgdir"/usr/lib/firefox-devel-$_ffmajorver/
205 rm -rf "$pkgdir"/usr/share/idl/