You are not logged in.

#1 2008-07-05 02:42:02

pogeymanz
Member
Registered: 2008-03-11
Posts: 1,020

New to ABS stuff. Help me edit PKGBUILD for Firefox, please.

I want to recompile firefox to be quick like swiftweasel. How can I edit the Firefox package to compile it for Core2Duo? And what other options does swiftfox/weasel do differently than default Firefox? Also, while I'm in here, I'd like to enable official branding.

I just rather do this than use swiftfox, which someone else just recompiled for me.

If this is easy and straight-forward, I'll probably recompile several big apps, to make them load a little quicker.

# $Id: PKGBUILD 3722 2008-06-29 21:42:47Z jgc $
# Maintainer: Dan McGee <dan@archlinux.org>
# Contributor: Jakub Schmidtke <sjakub@gmail.com>

pkgname=firefox
pkgver=3.0
pkgrel=2
pkgdesc="Standalone web browser from mozilla.org"
arch=(i686 x86_64)
license=('MPL' 'GPL' 'LGPL')
depends=('xulrunner>=1.9' 'startup-notification' 'desktop-file-utils')
makedepends=('zip' 'pkgconfig' 'diffutils' 'libgnomeui>=2.22.1')
replaces=('firefox3')
install=firefox.install
url="http://www.mozilla.org/projects/firefox"
source=(http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${pkgver}/source/firefox-${pkgver}-source.tar.bz2
        mozconfig
        firefox.desktop
        firefox-safe.desktop
        mozilla-firefox-1.0-lang.patch
    mozilla-firstrun.patch
    firefox.sh)
md5sums=('4210ae0801df2eb498408533010d97c1'
         'b7cc507da321ccac96282e938f2fdf36'
         '68cf02788491c6e846729b2f2913bf79'
         '5e68cabfcf3c021806b326f664ac505e'
         'bd5db57c23c72a02a489592644f18995'
         '0f935d428ae3a94c00d06d92c4142498'
     'afc69657a5881cc264a8b2e7ded146e3')

build() {
  cd ${srcdir}/mozilla

  patch -Np1 -i ${srcdir}/mozilla-firefox-1.0-lang.patch || return 1
  patch -Np1 -i ${srcdir}/mozilla-firstrun.patch || return 1
  cp ${srcdir}/mozconfig .mozconfig

  unset CFLAGS
  unset CXXFLAGS

  export LDFLAGS="-Wl,-rpath,/usr/lib/firefox-3.0"

  make -j1 -f client.mk build MOZ_MAKE_FLAGS="${MAKEFLAGS}" || return 1
  make -j1 DESTDIR=${pkgdir} install || return 1

  rm -f ${pkgdir}/usr/bin/firefox
  install -m755 ${srcdir}/firefox.sh ${pkgdir}/usr/bin/firefox || return 1

  rm -f ${pkgdir}/usr/lib/firefox-3.0/libjemalloc.so

  install -m755 -d ${pkgdir}/usr/share/applications
  install -m755 -d ${pkgdir}/usr/share/pixmaps
  install -m644 ${srcdir}/mozilla/browser/app/default48.png ${pkgdir}/usr/share/pixmaps/firefox.png || return 1
  install -m644 ${srcdir}/firefox.desktop ${pkgdir}/usr/share/applications/ || return 1
  install -m644 ${srcdir}/firefox-safe.desktop ${pkgdir}/usr/share/applications/ || return 1
}

Last edited by pogeymanz (2008-07-05 03:43:28)

Offline

#2 2008-07-05 03:47:29

kwurzel
Member
Registered: 2008-03-25
Posts: 14

Re: New to ABS stuff. Help me edit PKGBUILD for Firefox, please.

No need to edit PKGBUILD, see http://wiki.archlinux.org/index.php/Makepkg.conf for optimize your packages. Then, search mozconfig for anything related to official-branding and uncomment/add ac_add_options --enable-official-branding and your done.

Offline

#3 2008-07-05 03:51:39

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: New to ABS stuff. Help me edit PKGBUILD for Firefox, please.

to use custom CFLAGS, you need to edit the mozconfig file. check the optimize option and adjust it to your needs. here's mine for example:
ac_add_options --enable-optimize="-march=core2 -mtune=native -O2 -pipe -fomit-frame-pointer"

edit/ in addition, i'd recommend to build xulrunner as well, which is the rendering engine.

Last edited by bangkok_manouel (2008-07-05 03:52:49)

Offline

#4 2008-07-05 03:59:02

pogeymanz
Member
Registered: 2008-03-11
Posts: 1,020

Re: New to ABS stuff. Help me edit PKGBUILD for Firefox, please.

Thanks for the help, guys.

I'll report back with success or failure.


EDIT: Since I'm compiling Firefox, should I not let pacman update Firefox and just recompile it from ABS everytime?

Last edited by pogeymanz (2008-07-05 04:40:03)

Offline

#5 2008-07-05 04:18:57

sam
Member
Registered: 2008-05-23
Posts: 82

Re: New to ABS stuff. Help me edit PKGBUILD for Firefox, please.

The arch version of firefox is already pretty well optimized.  Its already i686 optimized, and optimizing it for a specific i686 version (like core 2 duo) won't really give performance boosts that you are expecting.  When I ran slackware, which is i386 optimized, it kind of made sense.  However, after all the optimizations and recompilations (which take about 1/2 an hour) I was able to only get the same speed as the official build from mozilla.  I can understand the need to brand firefox (so it says firefox instead of minefield) because certain websites won't recognize it as a "firefox" system.  You can fix that by going to about:config and changing the useragent configuration.

Optimizing firefox configs
Having said that, if you want to continue (perhaps because it's the start of a long weekend), the way you optimize firefox is by optimizing firefox options and by optimizing the compiler.  The firefox options are all in mozconfig and you should have a gander at sites like http://developer.mozilla.org/en/docs/Co … ld_Options.

Branding
If you want to build with official branding you have to add the options ac_add_options --enable-official-branding to mozconfig.  This will cause firefox to compile as "firefox" and use the regular icons in the taskbar.  To complete the branding you will need to change the icons that get installed (currently, the pkgbuild install the minefield icons in /var/abs/extra/firefox).

Compiler
This is where you optimize firefox, or any program for that matter, for your processor.  What you want to do is pass certain variables or flags to the compiler (gcc or g++) to tell it what processor you have specifically.  This will optimize anything you will compile on your computer for that computer.  These configurations are located in /etc/makepkg.conf under the "ARCHITECTURE, COMPILE FLAGS" sections.  Check http://wiki.archlinux.org/index.php/Saf … ium_4_P6xx and http://gentoo-wiki.com/CFLAGS for the best flags to set.

Nothing needs to be done to the pkgbuild (except removing/changing the md5sum after you compile).  As I have already mentioned, I have done this process before, and I got very little performance gains.  It's not even worth doing all of this to change the branding to "firefox".  Besides, chicks dig guys who use a program that has a firecracker in the logo and is called "Minefield" wink

Offline

#6 2008-07-05 04:29:48

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: New to ABS stuff. Help me edit PKGBUILD for Firefox, please.

sam wrote:

Compiler
This is where you optimize firefox, or any program for that matter, for your processor.  What you want to do is pass certain variables or flags to the compiler (gcc or g++) to tell it what processor you have specifically.  This will optimize anything you will compile on your computer for that computer.  These configurations are located in /etc/makepkg.conf under the "ARCHITECTURE, COMPILE FLAGS" sections.  Check http://wiki.archlinux.org/index.php/Saf … ium_4_P6xx and http://gentoo-wiki.com/CFLAGS for the best flags to set.

Notice the
  unset CFLAGS
  unset CXXFLAGS
in the PKGBUILD.

That's why one should use the
ac_add_options --enable-optimize="--omg-optimized"

Offline

#7 2008-07-05 04:43:10

pogeymanz
Member
Registered: 2008-03-11
Posts: 1,020

Re: New to ABS stuff. Help me edit PKGBUILD for Firefox, please.

Why would it unset the Cflags in the PKGBUILD, anyway? What's the point of that?

Offline

#8 2008-07-05 04:51:15

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: New to ABS stuff. Help me edit PKGBUILD for Firefox, please.

No exact idea about Firefox package. If you look at the mplayer PKGBUILD for example, here's the comment from the maintainer:

  # Custom CFLAGS break the mplayer build
  unset CFLAGS

Offline

#9 2008-07-05 05:04:54

sam
Member
Registered: 2008-05-23
Posts: 82

Re: New to ABS stuff. Help me edit PKGBUILD for Firefox, please.

I actually hadn't notice them.  I don't think custom cflags would break firefox, it may break mplayer because there are many libraries involved with mplayer.  I think ac_add_options --enable-optimize="--omg-optimized" does the same thing as passing cflags (because the options are similar like -o2 and -jx).  This maybe incase you compile a lot, and you want specific options for firefox because its so big.  For example the -o2 option helps many programs, but it doesn't really help firefox, it even states so on the mozilla's wiki (http://developer.mozilla.org/en/docs/Configuring_Build_Options.).  However, this options doubles the time it takes for compiling.

Offline

#10 2008-07-05 05:09:35

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: New to ABS stuff. Help me edit PKGBUILD for Firefox, please.

sam wrote:

I actually hadn't notice them.  I don't think custom cflags would break firefox, it may break mplayer because there are many libraries involved with mplayer.  I think ac_add_options --enable-optimize="--omg-optimized" does the same thing as passing cflags (because the options are similar like -o2 and -jx).

Yes it does work the same indeed (I'm actually using that) and does not break anything. I just wanted to point out that OP should not rely on makepkg.conf but should definitely add the option the his mozconf (or delete UNSET CFLAGS from the PKGBUILD).

Offline

#11 2008-07-05 05:14:11

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,405
Website

Re: New to ABS stuff. Help me edit PKGBUILD for Firefox, please.

Custom CFLAGS broke thunderbird recently so the can definitely break firefox...  The mozilla guys have fairly good optimization by default anyway and know what parts fail with different CFLAGS.   Also, given firefox is now just a shell on top of xulrunner, optimization of firefox is not going to help you much at all.

Offline

#12 2008-07-05 05:20:54

sam
Member
Registered: 2008-05-23
Posts: 82

Re: New to ABS stuff. Help me edit PKGBUILD for Firefox, please.

Allan wrote:

Custom CFLAGS broke thunderbird recently so the can definitely break firefox...  The mozilla guys have fairly good optimization by default anyway and know what parts fail with different CFLAGS.   Also, given firefox is now just a shell on top of xulrunner, optimization of firefox is not going to help you much at all.

You're right, my experience came from firefox 1.5, and even there I didn't feel much of a difference.  So with FF3, the performance benefits would be even less.  Perhaps the heavy xulrunner dependency is more likely to give cflags problems.  With FF 1.5, I broke FF (often) by playing with mozconfig not with cflags.

Last edited by sam (2008-07-05 05:23:39)

Offline

#13 2008-07-06 18:53:48

kwurzel
Member
Registered: 2008-03-25
Posts: 14

Re: New to ABS stuff. Help me edit PKGBUILD for Firefox, please.

Ever considered firefox-optimized (-->http://aur.archlinux.org/packages.php?ID=18090)? It may fit your needs w/o having much trouble...

Offline

Board footer

Powered by FluxBB