14 July 2010

"Installing" handmade Firefox 3.6 in Debian Squeeze

[Update 2011-06-25: You should consider this post obsolete. See this post for more info.]

Yesterday we saw how to build Firefox 3.6 from sources. This post shows you how to "install" it.

The reason I put "install" in quotes is because it's arguable that what we're going to do is a real installation. In a real Linux installation, you splay the various bits and pieces of your app into /usr/local/bin, /usr/local/share, /usr/local/lib, and various other places (or /usr/bin, /usr/share, /usr/lib if it's an official distribution package). What we are going to do here is take the easy way out--but a way that lots of "packages" take. We're going to dump stuff into /opt.

If you open up {whatever}/firefox-mercurial/192src/objdir-ff-release/dist/bin/ (or wherever you built your sources), you'll see that quite a few of the items in the bin directory are relative links to resources outside bin. If we try a conventional copy of the bin directory to /opt, what we get won't work because the targets of those links won't be copied. You could copy the whole objdir-ff-release to /opt, which will copy the needed link targets, but this will produce something many MB more than we need. The solution is to convert the links into targets themselves when you copy the file. This is actually pretty easy to do using the command line.

Copy the bin
Open a terminal in {whatever}/firefox-mercurial/192src/objdir-ff-release/dist. From there, become root (using su) and then:

# cp -R -L bin /opt/ff-from-src
# chown root:root -R /opt/ff-from-src

You should now have a new directory in /opt called ff-from-src. Inside it will be an executable file called firefox, and what used to be links will now be actual files. If all went well, executing this file (NOT as root) will launch the browser.

Making commands
We will next do a couple things to let you launch your new Firefox as a command and add an item to your menu.

1. Using whatever mechanism you are most comfortable with, make a softlink called firefox in /usr/local/bin to /opt/ff-from-src/firefox. You'll need to do this as root.

2. Add a png icon called firefox-namoroka.png to /usr/local/share/pixmaps/mozilla. You'll probably need to add the pixmaps and mozilla directories. Again you'll have to be root to do this. The icon can be whatever you want the icon to be in your menu. I used this one, even though it's the same one that Swiftfox uses. I wanted an icon that said "Firefox" but that differentiated itself from the stock FF icon. I scaled the icon to 128x128. Another nice icon is this one, but in spite of the attribution given on the page, I'm not sure it's actually GPL or where it originally came from.

3. Create a file called firefox-namoroka.desktop in /usr/local/share/applications again adding any directories you need and again as root. Copy/paste the following into firefox-namoroka.desktop:

[Desktop Entry]
Name=Firefox Namoroka
Comment=Browse the World Wide Web
GenericName=Web Browser
X-GNOME-FullName=Firefox Web Browser
Exec=firefox %u
Name[en_US]=Firefox Namoroka

You should now have an entry in your desktop menu and other desktop integration niceness.

No comments: