Group: IceCat/Compile and package/build 31.4.0 on Debian Wheezy 7.0

From LibrePlanet
< Group:IceCat‎ | Compile and package
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • The text in this page was last modified on: 27/02/2018.

Introduction

This page contains a report, with comments and hints, on a successful build of Gnuzilla IceCat 31.4.0 on a updated Debian Wheezy or Ubuntu Trusty.

The procedure below might apply, eventually with some differences, also to newer Debian releases and diverse Debian ports.

Prepare the developing environment

  • System update

First of all, it is highly reccomended having an updated system:

 $ sudo apt-get update
 $ sudo apt-get upgrade
  • Install common development tools

The most common development tools should be installed on your system. Please install (this is required only once):

$ sudo apt-get install gcc g++ make patch zip unzip
$ sudo apt-get install autoconf automake build-essential checkinstall debhelper devscripts dpkg-dev fakeroot gdb-minimal libc6-dev libtool intltool pbuilder pkg-config 
  • Install and configure ccache (optional)

If you want to use ccache during the build process (see below), please install and configure it (this is required only once):

$ sudo apt-get install ccache
$ export CCACHE_DIR=/tmp/ccache
$ CCache_SizeGB=5
$ mkdir -p $CCACHE_DIR
# If you want to put ccache on RAM:
$ mount -t tmpfs -o exec,noiversion,norelatime,size=0,nr_inodes=0 tmpfs $CCACHE_DIR
$ ccache --max-size ${CCache_SizeGB}G
$ export CCACHE_COMPRESS=""

where:

$CCACHE_DIR: is the full path of a directory you want choose as base where storing cccache files
$CCache_SizeGB: is the maximum size (in GB) of the cache

Prepare the requested libraries and dependencies

To successfully build IceCat you need some libraries to be installed and some dependencies to be satisfied. Please install (this is required only once):

  • Linux environment files
$ sudo apt-get install zip mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev libidl-dev mesa-common-dev autoconf2.13 yasm libgtk2.0-dev libdbus-1-dev libdbus-glib-1-dev python-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libpulse-dev

(see: Linux_Prerequisites at the Mozilla Developer Network)

  • Default IceCat libraries
$ sudo apt-get install libpango libpangoxft libpangoft2 libfreetype libxft libgtk2 libx11
(see: 'README.IceCat' file contained in the IceCat 31.4.0 sources)
Ubuntu 14: sudo apt-get install libpangoxft-1.0-0 libfreetype6 libgtk2.0-0 libx11-6
  • Other suggested libraries and dependencies
$ sudo apt-get install libxml2-dev libglib2.0-dev libevent-dev libiw-dev libglu1-mesa-dev xulrunner-dev python python-virtualenv python-pip
$ sudo apt-get build-dep iceweasel
Ubuntu 14: sudo apt-get install libxml2-dev libglib2.0-dev libevent-dev libiw-dev libglu1-mesa-dev python python-virtualenv python-pip ; sudo apt-get build-dep firefox

Prepare the building environment

IMPORTANT NOTE: Every time the build process fails, it is highly recommended to repeat all the entire process, starting again from a completely clean building environment (see here below): cleaned and cleared ccache, empty src and obj directories etc. A system reboot is also suggested.

The building environment should be set up before to start the building process. Please do the following:

  • Clean and check ccache

If ccache is in use, it should be clear and clean:

$ ccache --clear --cleanup
$ ccache -s
  • Set the building base directory

You should have a directory to use as base for all the building process:

$ build_basepath=/tmp/compile
$ mkdir -p $build_basepath
# If you want to work on RAM:
$ mount -t tmpfs -o exec,noiversion,norelatime,size=0,nr_inodes=0 tmpfs $build_basepath
$ cd $build_basepath
$ mkdir icecat-31.4.0
$ cd icecat-31.4.0

where:

<build_basepath>: is the path of a directory you should choose as base for all the building process
icecat-31.4.0: is the sub-directory of <build_basepath> where to work
  • Download the sources

To download the sources into the <build_basepath>/icecat-31.4.0 directory, please run:

$ curl -O -J -L 'https://ftp.gnu.org/gnu/gnuzilla/31.4.0/icecat-31.4.0.tar.bz2' 
$ curl -O -J -L 'https://ftp.gnu.org/gnu/gnuzilla/31.4.0/icecat-31.4.0.tar.bz2.sig' 
  • Verify the downloaded sources

The Gnuzilla IceCat releases are signed with a gpg key. The new gpg key has ID:D7E04784. Please download the key and check its fingerprint:

$ gpg --keyserver keys.gnupg.net --recv-keys D7E04784
$ gpg --fingerprint D7E04784

The fingerprint of the gpg key used to sing the Gnuzilla IceCat releases should be:

A573 69A8 BABC 2542 B5A0  368C 3C76 EED7 D7E0 4784

Then verify the downloaded sources:

$ gpg --verify icecat-31.4.0.tar.bz2.sig 
  • Prepare the sources

To prepare the sources tree in the <build_basepath>/icecat-31.4.0/src directory, please run:

$ tar -xjf icecat-31.4.0.tar.bz2
$ mv icecat-31.4.0  src

Configure the build

Configuration of the build process could be obtained through:

configuration parameters
which can be passed to the command script configure as command-line parameters (discouraged) or, better, through a configuration file named src/.mozconfig (or src/mozconfig) which should be created into the source directory (reccomended)
configuration variables
which can be set via the src/browser/confvars.sh file

The configuration parameters are used by the command script configure to set the corresponding configuration variables.

Please note that *not* all the configuration variables can be set through the command script configure: these variables can be set only directly in the src/browser/confvars.sh file.

Set the configuration parameters (file: src/mozconfig)

The reccomended way to set any of the configuration parameters is through a configuration file src/.mozconfig (or src/mozconfig) which should be created into the source directory. Calling configure with command-line options is discouraged.

A complete list of the available parameters can be obtained running:

$ ./src/configure --help

Here below is listed the content of the src/mozconfig file which is needed building IceCat 31.4.0 as shown below.

Use your favourite text editor to create this src/mozconfig file and modify it if necessary.

Please note that:

  • this file has been tested since it has been successfully used building IceCat 31.4.0 on a updated Debian Wheezy amd64 (64bit) machine
  • before to start the build process is *highly reccomended* to check carefully all the content of this file, in order to comment/uncomment the options accordingly with your system and your preferences
###
### - icecat mozconfig file - debian wheezy amd64
###

### - the following two are from: 'build/mozconfig.common' (should not be changed)
### - WARNING: THE FOLLOWING TWO SHOULD NOT BE CHANGED

mk_add_options AUTOCLOBBER=1
ac_add_options --enable-release

### - app & paths  (should not be changed)
### - WARNING: THE FOLLOWING SHOULD NOT BE CHANGED

# application to build
ac_add_options --enable-application=browser

# path: sources for locales
ac_add_options --with-l10n-base=$topsrcdir/l10n

# build using an objdir (to keep sources clean)
mk_add_options MOZ_OBJDIR=$topsrcdir/../obj

# path: system install dir
ac_add_options --prefix=/usr

### - ccache (comment out if you do not use ccache!!!)
### - WARNING: THE FOLLOWING ONE SHOULD BE COMMENT OUT IF NOT USING CCACHE

# build using ccache 
ac_add_options --with-ccache

### - building...  (should not be changed)
### - WARNING: THE FOLLOWING SHOULD NOT BE CHANGED

# build with optimization
ac_add_options --enable-optimize="-pipe -O3"

# elf-hack
ac_add_options --enable-elf-hack

# avoid dependency on libstdc++ 4.7
ac_add_options --enable-stdcxx-compat

# stripping
ac_add_options --enable-strip
ac_add_options --enable-install-strip

### - app options  (should not be changed)
### - WARNING: THE FOLLOWING SHOULD NOT BE CHANGED

# branding
ac_add_options --enable-official-branding
ac_add_options --with-distribution-id=org.gnu 

# enable wanted options
ac_add_options --enable-safe-browsing 
ac_add_options --enable-gio 
ac_add_options --disable-gnomevfs 
ac_add_options --enable-gstreamer=0.10 
ac_add_options --enable-default-toolkit=cairo-gtk2

# disable unwanted options (not necessary and/or privacy related stuff)
ac_add_options --disable-debug
ac_add_options --disable-debug-symbols
ac_add_options --disable-tests 
ac_add_options --disable-crashreporter 
ac_add_options --disable-updater 
ac_add_options --disable-update-channel
ac_add_options --disable-update-packaging
ac_add_options --disable-maintenance-service
ac_add_options --disable-parental-controls 
ac_add_options --disable-webapp-runtime
ac_add_options --disable-necko-wifi 

### - other recommended options (comment out what you do not want/need)

# webm (VP8 video and Vorbis audio) support 
# WARNING: VP8 and Vorbis must be installed in your system!
ac_add_options --enable-webm 

# use alsa instead of pulseaudio
# WARNING: Alsa must be installed in your system!
# WARNING: comment/uncomment TOGETHER the following two
ac_add_options --enable-alsa  
ac_add_options --disable-pulseaudio 

# wave support
ac_add_options --enable-wave 

### - to be tested (uncomment the options you want to use)
### - WARNING: THE FOLLOWING NOT TESTED!!! USE WITH CARE: THE BUILD MIGHT FAIL!!!

# ac_add_options --with-system-zlib 
# ac_add_options --with-system-bz2 
# ac_add_options --enable-system-hunspell 

# ac_add_options --with-system-libxul
# ac_add_options --with-system-libvpx
# ac_add_options --enable-system-pixmap

# ac_add_options --enable-canvas
# ac_add_options --enable-raw
# ac_add_options --enable-xinerama


### - DO NOT WORK WITH DEBIAN WHEEZY (should not be changed) - Maybe they work with newer Debian releases
### - WARNING: AVOID USING THE FOLLOWING WITH DEBIAN WHEEZY!!! THE BUILD WILL PROBABLY FAIL!!!

# error: NSPR too old
# ac_add_options --with-system-nspr 

# error: system's libpng doesn't have APNG support
# ac_add_options --with-system-png 

# error: SQLITE too old (should be sqlite3 >= 3.8.4.2)
# ac_add_options --enable-system-sqlite 

# error: Insufficient JPEG library version for --with-system-jpeg
# ac_add_options --with-system-jpeg 
# ac_add_options --disable-libjpeg_turbo

# error: NSS wrong version (should be >= 3.16.2.2)
# ac_add_options --with-system-nss 

Set the configuration variables (file: src/browser/confvars.sh)

Some configuration variables can only be set directly, editing the src/browser/confvars.sh file provided with the sources.

Use your favourite text editor to modify the src/browser/confvars.sh file if necessary.

Please note that:

  • a very deep knowledge and comprehension of the source code and the build process is needed to safely modify this file
  • the documentation about these variables is often poor and/or unclear
  • is *highly reccomended* to avoid changes in this file if unnecessary

Here below are listed some variables settings which can be safely add (trying to increase privacy) at the bottom of the src/browser/confvars.sh file, being tested to produce a successful build of IceCat 31.4.0 on a updated Debian Wheezy amd64 (64bit) machine:

# 
# ## src/browser/confvars.sh CUSTOM SETTINGS (HOPING TO INCREASE PRIVACY)
# 
# ## ADD THIS AT THE BOTTOM OF 'src/browser/confvars.sh'
# 
MOZ_SERVICES_METRICS=
MOZ_SOCIAL=
MOZ_DATA_REPORTING=
MOZ_TELEMETRY_REPORTING=
MOZ_SERVICES_HEALTHREPORT=
MOZ_CRASHREPORTER=

Build IceCat

Building the binaries means run configure and make. It 'a heavy task, requiring significant system resources and can last for a very long time. On a machine with 64bit CPU 4-core 3.8GHz and 8GB RAM, it takes about 40-45 minutes.

  • Prepare the directory <build_basepath>/icecat-31.4.0/obj where to build

The build will take place in a separate so-called objdir sub-directory (whose path has been previously set in the src/mozconfig file), in order to leave clean the sources tree.:

$ mkdir obj
$ cd obj
  • Run configure

Staying in the <build_basepath>/icecat-31.4.0/obj directory, please run:

$ ../src/configure

or, if you want to capture and save the output of the command to the terminal:

$ ../src/configure 2>&1 | tee config.txtout

The command script log will be in the config.log file.

The command script output to the terminal will be (if saved as above using tee) in the config.txtfile file.

  • Run make

Staying in the <build_basepath>/icecat-31.4.0/obj directory, please run:

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word; font-size:larger;">
CpuCores=$(ArgumentsNumber () { echo $#; }; ArgumentsNumber $(grep "processor" /proc/cpuinfo | cut -f2 -d":"))

$ make --jobs=$CpuCores --load-average=${CpuCores}.0 -f ../src/client.mk

or, if you want to capture and save the output of the command to the terminal:

$ make --jobs=$CpuCores --load-average=${CpuCores}.0 -f ../src/client.mk 2>&1 | tee make.txtout

The command script output to the terminal will be (if saved as above using tee) in the make.txtfile file.

  • Langpack (optional)

You can simply download the pre-built langpacks for IceCat 31.4.0 you need.

Otherwise, if you prefer to build yourself a langpack, please run:

$ cd browser/locales
$ make langpack-$LANG LOCALE_MERGEDIR=.
$ cd ../..

where:

$LANG: is the locale of the langpack to build

You can build all language packs too:

$ cd browser/locales
$ Available="$(ls -1 ../../../src/l10n/*/browser | grep -e '/browser:$' | sed -e 's|.*/l10n/||g' | cut -f 1 -d '/')"
$ for Current in $Available ; do make --quiet langpack-$Current LOCALE_MERGEDIR=. ; done
$ cd ../..

Installation

After the building process has been successfully completed, you might want to install IceCat on your system.

Standalone installation

To install the binaries as a "standalone" program, staying in the <build_basepath>/icecat-31.4.0/obj directory, please run:

$ make install DESTDIR=<build_basepath>/icecat-31.4.0/bin

where:

<build_basepath>: is the path of a directory you should choose as base for all the building process (please, now use a *full* path here)

The "standalone" binaries will be generated into the <build_basepath>/icecat-31.4.0/bin/usr/lib/icecat-31.4.0 directory.

To install just copy the directory with the "standalone" binaries in an appropriate place to be used in your system. A common suggested place is /opt/icecat.

DEB package creation

Create a file "description-pak" with a content like this:

GNU version of the Firefox browser

GNUzilla is the GNU version of the Mozilla suite, and GNU
IceCat is the GNU version of the Firefox browser. Its main advantage
is an ethical one: it is entirely free software. While the source code
from the Mozilla project is free software, the binaries that they
release include additional non-free software. Also, they distribute
and recommend non-free software as plug-ins.
.
This package doesn't install any flash decoder.

Run:

sudo checkinstall -D --fstrans --default --reset-uids --maintainer="user@system.local" "--pakdir=$build_basepath" --pkgname=icecat --pkgversion=31.4.0 "--requires=libc6,debianutils" --install=no make install

Tarball package creation

To create a binary tarball, staying in the <build_basepath>/icecat-31.4.0/obj directory, please run:

$ cd browser/installer
$ make
$ cd ../..

The tarball package will be generated into the <build_basepath>/icecat-31.4.0/obj/dist directory.


Enjoy Gnuzilla IceCat!