ch0wned – Building your own Thunderbird 3 on EL4 for X86_64 in your homedir

Written by max on 2010-04-06

ch0wned. adj. This is the state when you are a Linux user and don't have root access.

Intro

Having just gone through my guide on installing Firefox now you’re ready to do basically the same thing for Thunderbird.

This guide assumes you’re leaving off from my previous post : http://warped.org/blog/2009/03/04/chown3d-part-2-gtk-and-glib-in-your-own-home-directory/ where you’ve setup a script called config_gapp.

Prerequisites

Building

Follow my guide on installing Firefox for all the prereqs.

Thunderbird 3.0 Building

Configuring

Make a file called mozconfig-tbird

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-tb-release
mk_add_options MOZ_MAKE_FLAGS="-j4"
 
ac_add_options --enable-application=mail
ac_add_options --enable-official-branding
ac_add_options --prefix=/home/$USER/share/thunderbird
# required for make package for tbird now?
ac_add_options --enable-static
 
# Optimization
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --enable-optimize="-O2 -funroll-loops -fexpensive-optimizations"
ac_add_options --enable-strip
 
# Features
ac_add_options --disable-accessibility
ac_add_options --disable-updater
ac_add_options --disable-installer
#ac_add_options --enable-safe-browsing
ac_add_options --enable-xinerama
 
# Libraries / Dependencies
ac_add_options --disable-libnotify
ac_add_options --disable-gnomevfs
ac_add_options --enable-default-toolkit=cairo-gtk2
ac_add_options --enable-system-cairo
ac_add_options --with-system-nss
ac_add_options --with-nss-prefix=/home/$USER
ac_add_options --with-system-nspr
ac_add_options --with-nspr-prefix=/home/$USER
ac_add_options --enable-system-sqlite

Building

I had to patch firefox to use OSS instead of ALSA because EL4 doesn’t have a working ALSA by default. If you have ALSA working, you may not have to do this step. I got the guts of this patch from somewhere, but I can’t find it now, thanks whoever you are!

The patch is on my build firefox page referenced above.

The following is a fork of my config_gapp script. There are some tricky bits because I’ve left off some -L’s to avoid the NSS and NSPR libs that are installed in /usr/lib64.

#!/bin/sh
 
LOCAL_HOME=/home/$USER
export PATH=$LOCAL_HOME/bin:$PATH
 
export CPPFLAGS="-I$LOCAL_HOME/include -I$LOCAL_HOME/include/nss -I/usr/X11R6/include $CPPFLAGS"
export CFLAGS="-I$LOCAL_HOME/include -I$LOCAL_HOME/include/nss -I/usr/X11R6/include $CFLAGS"
export CXXFLAGS="-I$LOCAL_HOME/include -I$LOCAL_HOME/include/nss  -I/usr/X11R6/include  $CXXFLAGS"
#export LDFLAGS="-L$LOCAL_HOME/lib -L/usr/lib64 -L/usr/X11R6/lib64 $LDFLAGS"
export LDFLAGS="-L$LOCAL_HOME/lib -L/usr/X11R6/lib64 $LDFLAGS"
export PKG_CONFIG=$LOCAL_HOME/bin/pkg-config
export PKG_CONFIG_PATH="$LOCAL_HOME/lib/pkgconfig:/usr/lib64/pkgconfig:$PKG_CONFIG_PATH"
#export LD_LIBRARY_PATH="$LOCAL_HOME/lib:/usr/X11R6/lib64:/usr/lib64"
export LD_LIBRARY_PATH="$LOCAL_HOME/lib:/usr/X11R6/lib64"
 
# NOTE: I had to hardcode the path for some reason
export MOZCONFIG=/path/to/mozconfig-tbird
 
make -j 4 -f client.mk build 
 
# make package
# look in dist/*.tar.bz2

Installing

First you make a .tar.bz2, then you go install it.

cd objdir-tb-release
make package
cp mozilla/dist/*.tar.bz2 /somewhere
cd $HOME/share
tar xvfj /path/to/that/*.tar.bz2

Now make a wrapper script $HOME/bin/thunderbird :

#!/bin/sh
 
exec run_gapp /home/$USER/share/thunderbird/thunderbird "$@"

Errors

Here are some of the error messages I encountered along the way that were solved w/ the prerequisites and patch. Hopefully this helps future googlers.

nsUrlClassifierDBService.cpp:(.text+0x678): undefined reference to `inflateInit_'
nsUrlClassifierDBService.cpp:(.text+0x69c): undefined reference to `inflate'
nsUrlClassifierDBService.cpp:(.text+0x6d4): undefined reference to `inflateEnd'

Changed thunderbird-3.0.4/objdir-tb-release/mozilla/toolkit/components/build/Makefile to add libz to the compile. I’m sure there’s a classier way of doing this.

EXTRA_DSO_LDOPTS += \
    $(LIBS_DIR) \
    $(EXTRA_DSO_LIBS) \
    $(MOZ_UNICHARUTIL_LIBS) \
    $(MOZ_COMPONENT_LIBS) \
    $(MOZ_JS_LIBS) \
    $(NULL) \
    -lz
/path/to/thunderbird-3.0.4/directory/c-sdk/ldap/libraries/libprldap/ldappr-public.c:45:27: /$HOME/include/nss/private/pprio.h: Permission denied

Fix yer permissions. duh.