Firefox is a stand-alone browser based on the Mozilla codebase.
This package is known to build and work properly using an LFS-7.10 platform.
Download (HTTP): https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/48.0.2/source/firefox-48.0.2.source.tar.xz
Download MD5 sum: bd6410592a8c608c0f771c056351493c
Download size: 180 MB
Estimated disk space required: 5.3 GB (84 MB installed)
Estimated build time: 12 SBU (with parallelism=4 on a recent intel i7, much longer on lesser CPUs)
Required patch if using gtk+-3.20 or later (do not use with earlier versions) http://www.linuxfromscratch.org/patches/blfs/7.10/firefox-48.0.2-gtk320-1.patch
Optional patch to allow system versions of Graphite2-1.3.8 and HarfBuzz-1.3.0 - this should be regarded as experimental http://www.linuxfromscratch.org/patches/blfs/7.10/firefox-48.0.2-system_graphite2_harfbuzz-2.patch
![[Note]](../images/note.png) 
          
            The tarball firefox-48.0.2.source.tar.xz will
            untar to firefox-48.0.2
            directory. However, if you do this in a directory where the
            sticky bit is set, such as /tmp it
            will end with error messages:
          
              tar: .: Cannot utime: Operation not permitted
              tar: .: Cannot change mode to rwxr-xr-t: Operation not permitted
              tar: Exiting with failure status due to previous errors
              
            This does finish with non-zero status, but it does NOT mean there is a real problem. Do
            not untar as the root user in a
            directory where the sticky bit is set - that will unset it.
          
alsa-lib-1.1.2, Autoconf-2.13, GTK+-3.20.9 (or GTK+-2.24.30 if you change the mozconfig where indicated), NSS-3.26, UnZip-6.0, yasm-1.3.0, and Zip-3.0
ICU-57.1, libevent-2.0.22, libvpx-1.6.0, and SQLite-3.14.1
![[Note]](../images/note.png) 
          If you don't install recommended dependencies, then internal copies of those packages will be used. They might be tested to work, but they can be out of date or contain security holes.
![[Note]](../images/note.png) 
          
            With Firefox-31.0 and later
            versions, you must have installed Openssl before Python 2 or the build system will quickly
            fail with output including "ImportError: cannot import name
            HTTPSHandler". If you are in any doubt about this (e.g. upgrading
            from an older version of Firefox), check if /usr/lib/python2.7/lib-dynload/_ssl.so exists.
            If it does not, reinstall Python-2.7.12
            (after installing OpenSSL-1.0.2h). The latest version of
            any currently maintained
            version of Openssl should be satisfactory if already installed.
          
cURL-7.50.1, dbus-glib-0.106, Doxygen-1.8.11, GConf-3.2.6, FFmpeg-3.1.3 (runtime), libwebp-0.5.1, OpenJDK-1.8.0.102, PulseAudio-9.0, startup-notification-0.12, Valgrind-3.11.0, Wget-1.18, Wireless Tools-29, Hunspell, liboauth, and libproxy, Rust, and (with the patch) Graphite2-1.3.8 and HarfBuzz-1.3.0
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/firefox
          The configuration of Firefox is
          accomplished by creating a mozconfig
          file containing the desired configuration options. A default
          mozconfig is created below. To see
          the entire list of available configuration options (and an
          abbreviated description of each one), issue ./configure --help. You may also
          wish to review the entire file and uncomment any other desired
          options. Create the file by issuing the following command:
        
cat > mozconfig << "EOF"
# If you have a multicore machine, all cores will be used by default.
# If desired, you can reduce the number of cores used, e.g. to 1, by
# uncommenting the next line and setting a valid number of CPU cores.
#mk_add_options MOZ_MAKE_FLAGS="-j1"
# If you have installed DBus-Glib comment out this line:
ac_add_options --disable-dbus
# If you have installed dbus-glib, and you have installed (or will install)
# wireless-tools, and you wish to use geolocation web services, comment out
# this line
ac_add_options --disable-necko-wifi
# Uncomment this option if you wish to build with gtk+-2
#ac_add_options --enable-default-toolkit=cairo-gtk2
# Uncomment these lines if you have installed optional dependencies:
#ac_add_options --enable-system-hunspell
#ac_add_options --enable-startup-notification
# Comment out following option if you have PulseAudio installed
ac_add_options --disable-pulseaudio
# If you have installed GConf, comment out this line
ac_add_options --disable-gconf
# Comment out following options if you have not installed
# recommended dependencies:
ac_add_options --enable-system-sqlite
ac_add_options --with-system-libevent
ac_add_options --with-system-libvpx
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-icu
# If you are going to apply the patch for system graphite
# and system harfbuzz, uncomment these lines:
#ac_add_options --with-system-graphite2
#ac_add_options --with-system-harfbuzz
# Stripping is now enabled by default.
# Uncomment these lines if you need to run a debugger:
#ac_add_options --disable-strip
#ac_add_options --disable-install-strip
# The BLFS editors recommend not changing anything below this line:
ac_add_options --prefix=/usr
ac_add_options --enable-application=browser
ac_add_options --disable-crashreporter
ac_add_options --disable-updater
ac_add_options --disable-tests
ac_add_options --enable-optimize
ac_add_options --enable-gio
ac_add_options --enable-official-branding
ac_add_options --enable-safe-browsing
ac_add_options --enable-url-classifier
# From firefox-40, using system cairo causes firefox to crash
# frequently when it is doing background rendering in a tab.
#ac_add_options --enable-system-cairo
ac_add_options --enable-system-ffi
ac_add_options --enable-system-pixman
ac_add_options --with-pthreads
ac_add_options --with-system-bz2
ac_add_options --with-system-jpeg
ac_add_options --with-system-png
ac_add_options --with-system-zlib
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-build-dir
EOF
        Compile Firefox by issuing the following commands:
If you are using gtk+-3.20 or later, apply a patch to restore the slider on scrollbars:
patch -Np1 -i ../firefox-48.0.2-gtk320-1.patch
          If you have installed system versions of graphite2 and harfbuzz and
          wish firefox to use those instead of its shipped versions, apply
          the patch and uncomment the appropriate entries in the mozconfig file:
        
patch -Np1 -i ../firefox-48.0.2-system_graphite2_harfbuzz-2.patch
![[Note]](../images/note.png) 
          
            If you are compiling Firefox in
            chroot, make sure you have $SHELL
            environment variable set or prepend SHELL=/bin/sh.
          
export CFLAGS_HOLD=$CFLAGS && export CXXFLAGS_HOLD=$CXXFLAGS && export CFLAGS+=" -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2" && export CXXFLAGS+=" -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2" && make -f client.mk
This package does not come with a test suite.
          Now, as the root user:
        
make -f client.mk install INSTALL_SDK= && chown -R 0:0 /usr/lib/firefox-48.0.2 && mkdir -pv /usr/lib/mozilla/plugins && ln -sfv ../../mozilla/plugins /usr/lib/firefox-48.0.2/browser
Set environment variables back to their values:
export CFLAGS=$CFLAGS_HOLD && export CXXFLAGS=$CXXFLAGS_HOLD && unset CFLAGS_HOLD CXXFLAGS_HOLD
CFLAGS= ... CXXFLAGS= ...: These settings work around code which gcc6 would otherwise regard as out-of-specification and allow it to produce a working program.
          make -f client.mk
          ...: Mozilla products are packaged to allow the use
          of a configuration file which can be used to pass the configuration
          settings to the configure command. make uses the client.mk file to get initial configuration and
          setup parameters.
        
          mkdir -p
          /usr/lib/mozilla/plugins: This checks that
          /usr/lib/mozilla/plugins exists.
        
          ln -sv ...
          /usr/lib/firefox-48.0.2/browser: This command
          creates a symbolic link to /usr/lib/mozilla/plugins. It's not really needed,
          as Firefox checks /usr/lib/mozilla/plugins by default, but the
          symbolic link is made to keep all the plugins installed in one
          folder.
        
          If you use a desktop environment like Gnome or KDE
          you may like to create a firefox.desktop file so that Firefox appears in the panel's menus. If you
          didn't enable startup-notification in your mozconfig change the
          StartupNotify line to false. As the root user:
        
mkdir -pv /usr/share/applications &&
mkdir -pv /usr/share/pixmaps &&
cat > /usr/share/applications/firefox.desktop << "EOF" &&
[Desktop Entry]
Encoding=UTF-8
Name=Firefox Web Browser
Comment=Browse the World Wide Web
GenericName=Web Browser
Exec=firefox %u
Terminal=false
Type=Application
Icon=firefox
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=application/xhtml+xml;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
EOF
ln -sfv /usr/lib/firefox-48.0.2/browser/icons/mozicon128.png \
        /usr/share/pixmaps/firefox.png
      Last updated on 2016-09-02 01:57:33 -0700