15 July 2010

Firefox 3.6 with pretty fonts in Debian Squeeze (easier version)

[Update 2011-06-25: You should consider this post obsolete. See this post for more info.] 
 
If all the Mercurial and Namoroka in my previous posts about building and installing Firefox 3.6 in Squeeze has your head spinning a bit, here's a simplified version that gets the sources via FTP. As was the case in the previous build, this version enables cairo so you get nicer font rendering. This version also configures the build to use official Mozilla Firefox branding so you don't get Deer Park icons and such.

Preproduction
1) Create a working directory. Use a file manger or whatever you are comfortable with to do this. I called mine ~/firefox-release.

2) Get all the tools and things you need to build Firefox. In a terminal as root (using su):

# apt-get build-dep iceweasel
# apt-get install libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev mesa-common-dev autoconf2.13 yasm
# apt-get install libidl-dev


Get and build
1) Get the source code. Open a web browser or ftp client and go to ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/3.6.6/source/. Download firefox-3.6.6.source.tar.bz2 into ~/firefox-release. (If 3.6.6 is no longer the most recent version, then replace 3.6.6 above with whatever the most recent 3.6 happens to be.)

2) Extract the archive you downloaded. Use tar -jxvf *.tar.bz2 on the command line or whatever GUI tool you are comfortable with. This will give you a mozilla-1.9.2 directory inside ~/firefox-release.

3) Make a configuration file. Create a new file inside ~/firefox-release/mozilla-1.9.2 called mozconfig. Open mozconfig inside a text editor and paste in the following text:

. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/ff-release
#mk_add_options MOZ_MAKE_FLAGS="-j4"
ac_add_options --disable-debug
ac_add_options --disable-tests
ac_add_options --enable-optimize
ac_add_options --enable-official-branding
ac_add_options --enable-system-cairo

Save the file and exit the editor.

3) Build the beast by opening a terminal in ~/firefox-release/mozilla-1.9.2 and entering the following command:

make -f client.mk

Once the compile is done, the binaries will be in
~/firefox-release/mozilla-1.9.2/ff-release/dist/bin/.
As a test, execute the file firefox to make it go.

"Install"
1) Copy the contents of the bin directory to /opt, converting links to actual files. Do not try to copy the files with a file manager because it probably won't convert the links to files--which will render your "install" nonfunctional. Instead, open a terminal and go to ~/firefox-release/mozilla-1.9.2/ff-release/dist/. Then become root (using su) and do:

# cp -R -L bin /opt/firefox-release
# chown root:root -R /opt/firefox-release


You should now have a new directory in /opt called firefox-release. Inside it will be an executable file called firefox. If all went well, executing this file (NOT as root) will launch the browser.

2) Create a command that lets you launch the browser. As root, make a softlink from /usr/local/bin/firefox to /opt/firefox-release/firefox:

# ln -s /opt/firefox-release/firefox /usr/local/bin/firefox

3) Create a desktop file to introduce the new stuff to the menu. As root, create a file called firefox-release.desktop in /usr/local/share/applications (adding any directories that aren't already present.) Paste the following into firefox-release.desktop:

[Desktop Entry]
Encoding=UTF-8
Name=Firefox Release
Comment=Browse the World Wide Web
GenericName=Web Browser
X-GNOME-FullName=Firefox Web Browser
Exec=firefox %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/opt/firefox-release/icons/mozicon128.png
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;
StartupWMClass=Firefox-bin
StartupNotify=true
Name[en_US]=Firefox Release

Save the file and exit the editor.

You're done.

5 comments:

Eric said...

You can make a package with these commands : cd mozilla-1.9.1/ff-opt/ &&make package
The new package will be located in ‘ff-opt/dist/’

Mithat said...

@Eric

Sweet! I'll give it a try this week.

Eric said...

Correction :
cd mozilla-1.9.2/ff-release
make package

Package in : mozilla-1.9.2/ff-release/dist/
(tar.bz2)

Eric said...

Link to your post on my blog : http://debian-bits-and-snips.blogspot.com/2010/11/compile-latest-firefox.html

Mithat said...

Re: making packages, apparently you can also make debs using checkinstall:
http://firefox-tutorials.blogspot.com/2010/07/compiling-firefox.html