Building Firefox, SeaMonkey and Thunderbird from mercurial repositories

Build esr, release, beta, or central from the mozilla-unified repository.

SeaMonkey is no longer maintained in the comm-.... repositories, so to build an historical version, checkout an earlier revision of this page.

This page has been laid out around a mainly distro-independent build script, defaulting to an en-US build on unmodified source.
Packaging is Slackware specific, but installation for that is to DESTDIR, so I guess would be adaptable to other packaging systems.

Build Firefox with gtk3, using mach, and rust; and package it to install to /opt/firefox-{version} ...
and/or Thunderbird based on that mozilla source.

Builds default to x86_64 with additional setting up for cross compiling Firefox & Thunderbird for aarch64 [optimized for Raspberry Pi3], or i686.

Customization options with user preferences and single localization.


References
LFS for mozconfig setup and the inspiration to do this
Simple Firefox build
Linux Build Prerequisites
… and other Mozilla Developer pages …


Latest builds
These are builds which have been completed and run.
Armv7 builds complete, but randomly crash since skia was updated and are therefore not shown here.
$L10N repositories are reverted from l10n-central/$L10N during Localization
From release 113, Thunderbird $L10N repositories are reverted from projects/comm-l10n
built to {released} revision/changeset Firefox Thunderbird mozilla comm-$REL $L10N Options

esr115
115.6.0 aa9f02961b2b n/a 9aae743f32df aarch64 115.6.0 aa9f02961b2b n/a 9aae743f32df i686 115.6.0 aa9f02961b2b n/a 9aae743f32df 115.6.0 aa9f02961b2b 841b81606c88 ab83e93dc1bb aarch64 115.6.0 aa9f02961b2b 841b81606c88 ab83e93dc1bb i686 115.6.0 aa9f02961b2b 841b81606c88 ab83e93dc1bb

release
121.0 8b7f7fd1873f n/a e838a6841a8a aarch64 121.0 8b7f7fd1873f n/a e838a6841a8a i686 121.0 8b7f7fd1873f n/a e838a6841a8a 121.0b6 33d20ee6d74a 3fec1db4fd9d 961f97dafad5
See Firefox cross compiling [7] for 'i8mm' work-around

beta
122.0b1 1f258ddd281c n/a 1805a373d8d5 aarch64 122.0b1 1f258ddd281c n/a 1805a373d8d5 i686 122.0b1 1f258ddd281c n/a 1805a373d8d5 122.0b1 1f258ddd281c 564cc0f70657 8de1156415f4

central [Nightly]
123.0a1 7b04f85fcd04 n/a dc74e01114f2
the revision is the changeset of the latest Nightly build at the time of compiling


Build times
Machine dual-core 2.2 GHz 2x quad-core 3GHz Ram 6 GB 32 GB MOZ_MAKE_FLAGS -j4 -j8 Firefox ~520 mins [91esr] ~57 mins Thunderbird ~555 mins [91esr] ~62 mins
Typical usage on the dual-core machine is 6GB actual, with up to 10GB swap.


Directory structure
The build is done within this directory structure [key directories only]:
$MOZBUILD ├── mozilla # unpacked mozilla-unified bundle │ └── comm # mount point for comm-$REL ├── sources │ ├── llvm-$ARCH # for LLVM_CONFIG for stylo build │ ├── mozilla-unified.zstd.hg # mercurial bundle │ └── rust… # download and installation ├── comm-l10n├── $L10N # mercurial repository clone for TB113+── l10n├── $L10N # mercurial repository clone└── wip # temporary workspace for localized builds └───$REL # build tree for each of esr, release, beta, central ├── comm-$REL # mercurial repository clone ├── {firefox,thunderbird}-build-dir-$PKG_ARCH # build directories ├── packaging-{FF,TB}-$PKG_ARCH # installation DESTDIR for packaging │ └── usr │ └── lib # package created from here └── built ├── firefox-{version}$LOCZN-$PKG_ARCH.txz # the Firefox Slackware package └── thunderbird-{version}$LOCZN-$PKG_ARCH.txz # the Thunderbird Slackware package


Set variables
export MOZBUILD=/mozbuild ## Set which repositories to clone: export REPOS="esr115 release beta central" ## choose which to build: export REL=esr115 ## set number of parallel jobs export NUMJOBS=-j8 export ARCH=x86_64 export PKG_ARCH=$ARCH export LOCZN=-$(echo en-US | tr - _) export L10N=en-GB && export LOCZN=-$(echo $L10N | tr - _)

Create build directories
mkdir -p $MOZBUILD/l10n/wip mkdir -p $MOZBUILD/sources ## Set which directories to create: REPOS=$REPOS (for repo in $REPOS do mkdir -p $MOZBUILD/$repo/built done)

Mercurial bundles and repositories
mozilla-unified is downloaded as a compressed bundle [~1GB] and is unbundled to a sub-directory of $MOZBUILD.
The key advantage of using a bundle rather than cloning the repo is that an interrupted download can be resumed.
It also puts less of a load on the server - see here and here.
Requires mercurial with zstd support [v4.1.2 works], otherwise view 'bundles' file and choose compression type.
cd $MOZBUILD/sources ## get mozilla-unified bundle wget -O bundles https://hg.cdn.mozilla.net/ BUNDLE=$(grep mozilla-unified.*zstd bundles | sed 's|.*href="||;s|">.*$||') wget -O mozilla-unified.bundle https://hg.cdn.mozilla.net/$BUNDLE cd $MOZBUILD ## unbundle mozilla-unified hg init mozilla hg unbundle sources/mozilla-unified.bundle -R mozilla ## set default repo to pull from echo "[paths] default = https://hg.mozilla.org/mozilla-unified/" > mozilla/.hg/hgrc ## get new changesets since bundle was created hg pull -R mozilla ## update local repo hg update -R mozilla
comm-$REL and locale have to be cloned as no bundle is available.
There is a comm-central bundle, but to keep things consistent, let's clone that too …
## Set which repositories to clone: REPOS=$REPOS (for repo in $REPOS do cd $MOZBUILD/$repo RELEASES="/releases" && [[ $repo == central ]] && unset RELEASES hg clone https://hg.mozilla.org${RELEASES:-""}/comm-$repo/ done)

non-US locale
Use l10n mozilla-central repository and revert as necessary to the revisions required as per l10n-changesets.json.
(cd $MOZBUILD/l10n/ hg clone https://hg.mozilla.org/l10n-central/$L10N/)

From Thunderbird 113, localization for calendar, chat, and mail has been moved to a project repository
(cd $MOZBUILD/ hg clone -U https://hg.mozilla.org/projects/comm-l10n/)

Once these locally cloned repositories have been set up, they can be kept up-to-date for future builds - see 'Add new changesets'.

Dictionaries
Download a dictionary - links to dictionaries are available at Mozilla addons:
cd $MOZBUILD/sources wget -O $L10N-dict.xpi https://addons.mozilla.org/firefox/downloads/latest/british-english-dictionary-2/addon-461570-latest.xpi


Add new changesets  to all cloned repositories prior to any future release builds [or as required].

close ## Set which repositories to update: REPOS=$REPOS cd $MOZBUILD hg pull -R mozilla hg pull -R l10n/$L10N hg pull -R comm-l10n for repo in $REPOS do hg pull -R $repo/comm-$repo done ## De-clutter the mozilla[-unified] bookmarks list sed -i '/ au/d;/esr[1-9][0-9]$/d;/fx-team/d;/inbound/d' $MOZBUILD/mozilla/.hg/bookmarks close


Set up the local repositories for chosen $REL, removing any changes made for previous builds:
cd $MOZBUILD hg update $REL -C -R mozilla hg update default -C -R $REL/comm-$REL/ hg update default -C -R l10n/$L10N hg update default -C -R comm-l10n


Building to a specific revision

close Firefox: [a] Building to the same revision as the latest official or bug fix release, including βeta: cd $MOZBUILD/mozilla/ ## Get the latest release candidate from the repository log Tg_STR=$(hg log -l 500 -Gr ::$REL | grep -o Tagging.*FIREFOX_.*_RELEASE|head -n1) echo $Tg_STR ## which will show, for example: ##  Tagging aa9f02961b2bbb92e17fea5d6b8fd14c097baf72 with FIREFOX_115_6_0esr_RELEASE ## Set the changeset for the build REL_CS=$(echo $Tg_STR | cut -d" " -f2 | colrm 13) echo $REL_CS ## Set a name for the bookmark REL_TAG=$(echo $Tg_STR | cut -d" " -f4 | sed 's|FIREFOX_||;s|_RELEASE||') echo $REL_TAG ## Create new bookmark to that release changeset hg bookmark -r $REL_CS $REL_TAG ## Set the new bookmark active hg checkout $REL_TAG OR: [b] Building to any other revision: Find the changesets within mozilla-unified applicable to REL only. ## List last NUM_CS changesets: cd $MOZBUILD/mozilla/ NUM_CS=5 hg log -l $NUM_CS -Gr ::$REL | colrm 1 3 ## Select a changeset from that list ## Close to the release date, the log might show the latest release candidate revision which will most likely be the actual release revision - select the changeset tagged as 'Tagging ... with FIREFOX_115_...esr_BUILD... a=release'. BUILD_CS=............ ## Create new bookmark to that changeset hg bookmark -r $BUILD_CS ${REL}_$BUILD_CS ## Set the new bookmark active hg checkout ${REL}_$BUILD_CS Thunderbird [comm-$REL]: [a] Building to the same revision as the latest esr release: The Thunderbird revision hashes for mozilla are available from the candidates repository. Thunderbird builds at the same major revision as Firefox release use the beta repositories. cd $MOZBUILD/sources/ ## Get the latest TB release revision from the local repository log Tg_STR=$(hg log -l 500 -R $MOZBUILD/$REL/comm-$REL | grep -o Tagging.*THUNDERBIRD_.*_RELEASE|head -n1) echo $Tg_STR ## which will show, for example ##  Tagging 841b81606c88cabafbaf075f01e0e6a71747155e with THUNDERBIRD_115_6_0_BUILD2, THUNDERBIRD_115_6_0_RELEASE ## Get the release version TB_REL=$(echo $Tg_STR | cut -d" " -f5 | sed 's|THUNDERBIRD_||;s|_RELEASE||' | tr _ .) echo $TB_REL ## Get the candidate build TB_BUILD=$(echo $Tg_STR | grep -o BUILD[0-9]* | tr [:upper:] [:lower:] ) echo $TB_BUILD ## Download the .txt file to get the mozilla changeset for that build wget https://archive.mozilla.org/pub/thunderbird/candidates/$TB_REL-candidates/$TB_BUILD/linux-x86_64/en-US/thunderbird-$TB_REL.txt #For example for TBesr 115.6.0, build2 [tagged as 115.6.0 release], the contents of this file are: # 20231215200246 # https://hg.mozilla.org/releases/comm-esr115/rev/841b81606c88cabafbaf075f01e0e6a71747155e # https://hg.mozilla.org/releases/mozilla-esr115/rev/aa9f02961b2bbb92e17fea5d6b8fd14c097baf72 ## … and extract the changesets COMM_BUILD_CS=$(grep comm- thunderbird-$TB_REL.txt | cut -d"/" -f7 | colrm 13) echo $COMM_BUILD_CS TB_MOZ_BUILD_CS=$(grep mozilla- thunderbird-$TB_REL.txt | cut -d"/" -f7 | colrm 13) echo $TB_MOZ_BUILD_CS OR: [b] Building beta releases or pre-release latest esr builds +[δ]: For builds at FF release or beta versions, the TB build uses the comm- and mozilla beta repositories [α] However, the build revision data is contained in the candidates repository for the corresponding FF version [β] ## [β] - find the mozilla major version MAJ_VER=$(cat $MOZBUILD/mozilla/browser/config/version.txt | cut -d. -f1) echo $MAJ_VER ## [α] [[ $REL == release ]] && { export REL=beta ## Only the release repositories will have been updated, so update beta repositories: hg update $REL -C -R $MOZBUILD/mozilla hg update default -C -R $MOZBUILD/$REL/comm-$REL/ } cd $MOZBUILD/sources ## [1] Get list of release candidates and find the latest for this mozilla major version wget -O TB-candidates.html https://archive.mozilla.org/pub/thunderbird/candidates/ TB_REL_CAND=$(grep -o ${MAJ_VER}.[0-9]b[0-9][0-9]* TB-candidates.html | sort -V | tail -n 1) ## OR [δ]: ## TB_REL_CAND=$(grep -o ${MAJ_VER}.[0-9][0-9]*.[0-9] TB-candidates.html | sort -V | tail -n 1) echo $TB_REL_CAND ## [2] Get list of release candidate builds and find the latest wget -O $TB_REL_CAND.html https://archive.mozilla.org/pub/thunderbird/candidates/$TB_REL_CAND-candidates/ TB_BUILD=$(grep build $TB_REL_CAND.html|tail -n1|cut -d"/" -f6) echo $TB_BUILD ## [3] Download the .txt file which includes the changeset reference for that build ... TB_TXT="thunderbird-$(echo $TB_REL_CAND |cut -d- -f1).txt" echo $TB_TXT wget https://archive.mozilla.org/pub/thunderbird/candidates/$TB_REL_CAND-candidates/$TB_BUILD/linux-$ARCH/en-US/$TB_TXT ## … and find the changesets COMM_BUILD_CS=$(grep comm- $TB_TXT | cut -d"/" -f7 | colrm 13) echo $COMM_BUILD_CS TB_MOZ_BUILD_CS=$(grep mozilla- $TB_TXT | cut -d"/" -f7 | colrm 13) echo $TB_MOZ_BUILD_CS ## Set a name for the mozilla bookmark TB_REL=$TB_REL_CAND OR: [c] Building to any other revision: ## The comm-$REL revision COMM_BUILD_CS= ## The mozilla revision TB_MOZ_BUILD_CS= ## Set a name for the bookmark TB_REL= Checkout: ## Thunderbird: hg checkout -r $COMM_BUILD_CS -R $MOZBUILD/$REL/comm-$REL ## Mozilla: ## Create new bookmark to TB changeset hg bookmark -r $TB_MOZ_BUILD_CS TB_$TB_REL -R $MOZBUILD/mozilla ## Set the new bookmark active hg checkout TB_$TB_REL -R $MOZBUILD/mozilla Record the mozilla revision that the Thunderbird build is based on to add to application.ini in the package. export Gecko_Rev=$TB_MOZ_BUILD_CS Check that the repositories are set up for the correct revisions: ## FF: hg bookmarks -R $MOZBUILD/mozilla ## TB: hg parent -R $MOZBUILD/$REL/comm-$REL Delete any bookmark when no longer required: hg bookmark --delete xxxxxx -R $MOZBUILD/mozilla close

Find the Firefox major version for later version dependent settings
export MAJ_VER=$(cat $MOZBUILD/mozilla/browser/config/version.txt | cut -d. -f1) echo $MAJ_VER

Latest versions of rust can cause build problems, so let's use the minimum required for the mozilla build:
grep MINIMUM_RUST_VERSION $MOZBUILD/mozilla/python/mozboot/mozboot/util.py

Rust
Download and install the x86_64 version of rust which includes the rustc and cargo binaries, and the x86_64 crate.
Aarch64, armv7[hf], and i686 crates for cross compiling will be downloaded and added to this installation as required. cd $MOZBUILD/sources/ wget -O rust.html https://forge.rust-lang.org/infra/other-installation-methods.html URL=$(sed 's|https|\n&|;s|tar.gz|tar.xz|' rust.html | grep -o https://.*$ARCH-unknown-linux-gnu.tar.xz |head -n1) ## check for latest version and adjust if the minimum version is required - ## will be something like https://static.rust-lang.org/dist/rust-1.70.0-x86_64-unknown-linux-gnu.tar.xz echo $URL wget $URL tar xf rust*$ARCH-unknown-linux-gnu.tar.xz cd rust*$ARCH-unknown-linux-gnu ./install.sh --prefix=$MOZBUILD/sources/rust-$ARCH --components=rustc,cargo,rust-std-$ARCH-unknown-linux-gnu
As rustc and cargo are installed off-PATH, their locations are included in mozconfig.common.

Check the minimum versions of nodejs and cbindgen required for the build:
grep 'NODE_MIN_VERSION =' $MOZBUILD/mozilla/python/mozbuild/mozbuild/nodeutil.py grep 'cbindgen_min_version =' $MOZBUILD/mozilla/build/moz.configure/bindgen.configure

cbindgen - download, build, and install to the same directory as rustc & cargo, as a convenient place to put it
cd $MOZBUILD/sources ## for the latest version: wget -O cbindgen-releases.html https://github.com/mozilla/cbindgen/releases CBINDGEN_REL=$(grep -o expanded_assets.* cbindgen-releases.html | head -n1 | cut -d'"' -f1 | cut -d'/' -f2) echo $CBINDGEN_REL wget -O cbindgen-$CBINDGEN_REL.tar.gz https://github.com/mozilla/cbindgen/archive/refs/tags/$CBINDGEN_REL.tar.gz tar xf cbindgen-$CBINDGEN_REL.tar.gz cd cbindgen-[0-9]*/ PATH=$MOZBUILD/sources/rust-$ARCH/bin:$PATH cargo install --root $MOZBUILD/sources/rust-$ARCH cbindgen
As cbindgen is installed off-PATH, its location is included in mozconfig.common.

gcc optimization for HOST, so only use if building for same machine architecture
- will be overridden in mozconfig.cross if cross compiling
- should be something like:
 -march=core2 -mtune=core2
export OPTM=$(echo $(gcc -Q -O2 -march=native --help=target | grep -E "^ -march=|^ -mtune=" | tr -d [:blank:])) ## … and suppress [-w] compiler warnings which are only useful for developers … OPTM="$OPTM -w" echo $OPTM
- otherwise, if required, set OPTM=<user_defined> for 'target' machine …

Create mozconfigs
As there are common variables between the FF and TB builds, set up a common mozconfig
'mach' will install wherever '--prefix=' points to.
Other options can be seen in 'old-configure'

mozconfig.common:
(cd $MOZBUILD/mozilla cat > mozconfig.common << "EOF" ## export everything to be found by the js/src configuration mk_add_options "export MOZ_MAKE_FLAGS=$NUMJOBS" mk_add_options "export NO_MERCURIAL_SETUP_CHECK=1" ## llvm installed off PATH for the use of this build only mk_add_options "export LLVM_CONFIG=$MOZBUILD/sources/llvm-$ARCH/usr/bin/llvm-config" ## Changeset 187c2fbed36e for bug 1839743 breaks LLVM_OBJDUMP being found, so add the path here [[ $MAJ_VER -ge 116 ]] && { mk_add_options "export LLVM_OBJDUMP=$MOZBUILD/sources/llvm-$ARCH/usr/bin/llvm-objdump" } ## locations of off-path rustc and cargo mk_add_options "export RUSTC=$MOZBUILD/sources/rust-$ARCH/bin/rustc" mk_add_options "export CARGO=$MOZBUILD/sources/rust-$ARCH/bin/cargo" ## location of off-path cbindgen mk_add_options "export CBINDGEN=$MOZBUILD/sources/rust-$ARCH/bin/cbindgen" CC="gcc ${OPTM:-}" CXX="g++ ${OPTM:-}" ac_add_options --prefix=/usr ## If dbus-glib is installed, comment out this line: #ac_add_options --disable-dbus ## If dbus-glib is installed, and wireless-tools is or will be installed, ## and geolocation web services are required, comment out this line ac_add_options --disable-necko-wifi ## Build with cairo-gtk3 [other option is cairo-gtk3-wayland] ac_add_options --enable-default-toolkit=cairo-gtk3 ## Uncomment this option if PulseAudio isn't installed #ac_add_options --disable-pulseaudio ac_add_options --disable-crashreporter ac_add_options --disable-updater ac_add_options --disable-tests ac_add_options --enable-optimize ## build Firefox as 'Nightly' and Thunderbird as 'Daily' ac_add_options --disable-official-branding ac_add_options --with-system-zlib ## From FF69, bindgen needs clang ac_add_options --with-clang-path=$MOZBUILD/sources/llvm-x86_64/usr/bin/clang++ ## From FF95 - choose whether to build with a wasi sysroot #ac_add_options --with-wasi-sysroot=<location> ## or: ac_add_options --without-wasm-sandboxed-libraries ## From FF96 - choose whether to build with a bootstrapped toolchain ac_add_options --disable-bootstrap ## With debug symbols, the build time is increased by 50% ac_add_options --disable-debug-symbols ## The last expression in mozconfig determines its exit status, ## so ensure that it is always 0 : EOF )

mozconfig.firefox:
(cd $MOZBUILD/mozilla cat > mozconfig.firefox << "EOF" ## include the common mozconfig source $MOZBUILD/mozilla/mozconfig.common ac_add_options --enable-application=browser mk_add_options MOZ_OBJDIR=$MOZBUILD/$REL/firefox-build-dir-$PKG_ARCH EOF )

With mozilla as the topsrcdir, need to set the mail application to the 'comm' directory
mkdir -p $MOZBUILD/mozilla/comm

mozconfig.thunderbird:
(cd $MOZBUILD/$REL/comm-$REL cat > mozconfig.thunderbird << "EOF" ## include the common mozconfig source $MOZBUILD/mozilla/mozconfig.common ## $MOZBUILD/$REL/comm-$REL will be mounted to comm for the build ac_add_options --enable-application=comm/mail mk_add_options MOZ_OBJDIR=$MOZBUILD/$REL/thunderbird-build-dir-$PKG_ARCH EOF )

Remove any stale configure file:
rm -f $MOZBUILD/mozilla/configure


User preferences  Customize the builds with personal preferences

close User preferences options cd $MOZBUILD [1] Change some of '… {my,your} …' to '… the …' ## Firefox: sed -i 's| [a-z]* selections| the selections|' mozilla/browser/locales/en-US/browser/preferences/{colors,fonts}.ftl sed -i 's|your computer’s|the computer’s|;s|your operating|the operating|' \ mozilla/browser/locales/en-US/browser/preferences/preferences.ftl ## Thunderbird: sed -i 's| [a-z]* selections| the selections|' $REL/comm-$REL/mail/locales/en-US/messenger/preferences/colors.ftl [2] Change default page options: ## Firefox: ## Default to blank page on start … ## This "about:blank"; replacement could be "file:///path/to/my/startup_page.html"; to load a customized page: sed -i 's|pref("browser.startup.homepage".*$|pref("browser.startup.homepage","about:blank");|' mozilla/browser/app/profile/firefox.js ## … and stop the privacy page loading: sed -i 's|dataSubmissionEnabled", true);|dataSubmissionEnabled", false);|' mozilla/modules/libpref/init/all.js ## Load a blank page with Ctrl+T or new tab button. patch -p0 << EOF --- mozilla/modules/libpref/init/StaticPrefList.yaml +++ mozilla/modules/libpref/init/StaticPrefList.yaml @@ -1306,5 +1306,5 @@ - name: browser.newtabpage.enabled type: bool - value: true + value: false mirror: always EOF ## Don't show an upgrade dialogue on major upgrades sed -i 's|upgradeDialog.enabled".*$|upgradeDialog.enabled", false);|' mozilla/browser/app/profile/firefox.js ## Don't check for default browser sed -i 's|checkDefaultBrowser".*$|checkDefaultBrowser", false);|' mozilla/browser/app/profile/firefox.js ## Remove drop down pre-set list of sites from URL bar [[ $MAJ_VER -ge 115 ]] && EXTN15=sys.mjs sed -i '/youtube/d;/baidu/d' mozilla/browser/components/newtab/lib/DefaultSites.${EXTN15:-jsm} sed -i 's| true| false|' mozilla/browser/components/newtab/test/browser/head.js sed -i 's|".*youtube.*$|"",|' mozilla/browser/components/newtab/test/browser/head.js sed -i 's|browser.urlbar.suggest.bookmark.*$|browser.urlbar.suggest.bookmark", false);|;s|browser.urlbar.suggest.history.*$|browser.urlbar.suggest.history", false);|;s|browser.urlbar.suggest.openpage.*$|browser.urlbar.suggest.openpage", false);|;s|browser.urlbar.suggest.remotetab.*$|browser.urlbar.suggest.remotetab", false);|;s|browser.urlbar.suggest.searches.*$|browser.urlbar.suggest.searches", false);|;s|browser.urlbar.suggest.topsites.*$|browser.urlbar.suggest.topsites", false);|;s|browser.urlbar.suggest.engines.*$|browser.urlbar.suggest.engines", false);|;s|browser.urlbar.suggest.quicksuggest.*$|browser.urlbar.suggest.quicksuggest", false);|' \ mozilla/browser/app/profile/firefox.js [3] Include the search box by default: ## Firefox: sed -i 's|urlbar-container",|&\n "search-container",|' mozilla/browser/components/customizableui/CustomizableUI.${EXTN15:-jsm} [4] Alternative tabs display: Left-to-right the tabs are [ Open ] … [ Hover over ] … [ Unselected ] ## add background colour, border, and rounded corners to unselected tabs patch -p0 << EOF --- mozilla/browser/base/content/browser.css +++ mozilla/browser/base/content/browser.css @@ -190,1 +190,6 @@ + background-color: #dddddd; + border-top: 1px solid none; + border-right: 1px solid #bfbfbf; + border-left: 1px solid #000000; + border-radius: 15px 15px 0px 0px; transition: min-width 100ms ease-out, EOF ## change the tab minimum height ## remove padding from selected tab patch -p0 << EOF --- mozilla/browser/themes/shared/tabs.css +++ mozilla/browser/themes/shared/tabs.css @@ -8 +8 @@ - --tab-min-height: 36px; + --tab-min-height: 32px; @@ -97 +97 @@ - padding: 0 2px; + padding: 0; EOF ## add rounded corners on selected tab ## remove the shadowed box for selected tab ## remove shadow from selected tab patch -p0 << EOF --- mozilla/browser/themes/shared/tabs.css +++ mozilla/browser/themes/shared/tabs.css @@ -549,2 +549,2 @@ - border-radius: var(--tab-border-radius); - margin-block: var(--tab-block-margin); + border: 1px none transparent; + border-radius: 15px 15px 0px 0px; @@ -561,3 +561,3 @@ #tabbrowser-tabs:not([noshadowfortests]) .tab-background:is([selected], [multiselected]) { - box-shadow: 0 0 4px rgba(0,0,0,.4); + border-top: 1px solid; } EOF ## change colour/opacity of hover over unselected tab ## and add a top border line patch -p0 << EOF --- mozilla/browser/themes/shared/tabs.css +++ mozilla/browser/themes/shared/tabs.css @@ -556,3 +556,4 @@ .tabbrowser-tab:hover > .tab-stack > .tab-background:not([selected=true], [multiselected]) { - background-color: color-mix(in srgb, currentColor 11%, transparent); + background-color: rgba(255,255,255,.7); + border-top: 1px solid #bfbfbf; } EOF Default to no firefox view tab - about:firefoxview [FF106+] sed -i 's|pref("browser.tabs.firefox-view", true);|pref("browser.tabs.firefox-view", false);|' mozilla/browser/app/profile/firefox.js Default to no 'View recent browsing ...' tab [FF119+] sed -i 's|firefox-view-next", true);|firefox-view-next", false);|' mozilla/browser/app/profile/firefox.js Avoid tab open/close pop-ups [FF115+] sed -i 's|view-count.*$|view-count", 1);|' mozilla/browser/app/profile/firefox.js sed -i 's|cfr.features.*$|cfr.features", false);|' mozilla/browser/app/profile/firefox.js Default to never show bookmarks toolbar under the address bar [FF108+] sed -i 's|bookmarks.visibility", "newtab");|bookmarks.visibility", "never");|' mozilla/browser/app/profile/firefox.js [5] Set search engines [a] Enable an Add button in about:preferences#search [Edit|Settings|Search] See bug 1106626 and changeset aa3aa3881ba4 for details. The disadvantages with this are that the search engine has to be added after installation and the icon is generic. #### The line to change is 3 lines beyond the unique identifier 'addEngineButton': LINE_NO=$[$(grep -n addEngineButton mozilla/browser/components/preferences/search.inc.xhtml | cut -d: -f1)+3] sed -i ''${LINE_NO}'s|hidden="true"|hidden="false"|' mozilla/browser/components/preferences/search.inc.xhtml [b] Choose search engines Add a search extension mkdir mozilla/browser/components/search/extensions/onelook ( cd mozilla/browser/components/search/extensions/onelook echo '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' | base64 -d > onelook.png echo '{ "name": "Onelook", "description": "Search 900+ dictionaries using wildcards or by meaning.", "manifest_version": 2, "version": "1.0", "applications": { "gecko": { "id": "onelook@search.mozilla.org" } }, "icons": { "16": "onelook.png" }, "chrome_settings_overrides": { "search_provider": { "name": "Onelook", "search_url": "https://www.onelook.com/", "search_form": "https://www.onelook.com/?w={searchTerms}", "search_url_get_params": "w={searchTerms}" } } }' > manifest.json ) Reinstate a removed search extension hg revert --cwd mozilla -r 2bad4a67f807 browser/components/search/extensions/chambers-en-GB Rewrite search-config.json, with DuckDuckGo as the default search engine ## Re: bug 1725660, CS b25c6fb8520a TIMESTAMP=', "timestamp": 1648132005528 ' echo $'{"data":[ {"schema":1609962110792,"appliesTo":[{"included":{"everywhere":true}}],"webExtension":{"id":"ebay@search.mozilla.org"},"id":"cbe309e0-f638-4996-9dfc-ea5c19ef16e9","last_modified":1610163579843}, {"schema":1605047692074,"appliesTo":[{"included":{"everywhere":true}}],"webExtension":{"id":"google@search.mozilla.org"},"id":"cb8e7210-9f0b-48fa-8708-b9a03df79eea","last_modified":1605203142486}, {"schema":1599421304249,"appliesTo":[{"included":{"everywhere":true}}],"webExtension":{"id":"amazondotcom@search.mozilla.org"},"id":"071c671c-7c1b-469d-a771-ab16ff6e8beb","last_modified":1599574471320}, {"schema":1594312388385,"appliesTo":[{"included":{"everywhere":true}}],"webExtension":{"id":"ddg@search.mozilla.org"},"default":"yes","id":"c0b26c0e-63e6-4235-b2ce-5f16b6a8bf87","last_modified":1595254832054}, {"schema":1592948527171,"appliesTo":[{"included":{"everywhere":true}}],"webExtension":{"id":"bing@search.mozilla.org"},"id":"7ec766f6-639a-4618-91bc-33eb3d4378c6","last_modified":1593025575021}, {"schema":1588177692141,"appliesTo":[{"included":{"everywhere":true}}],"webExtension":{"id":"wikipedia@search.mozilla.org"},"id":"3f3beb1d-e32e-40a4-b6ed-56741803e1d8","last_modified":1589299342069}, {"schema":1582890778608,"appliesTo":[{"included":{"everywhere":true}}],"webExtension":{"id":"chambers-en-GB@search.mozilla.org"},"id":"270000f0-8527-4f98-aa17-879820209f68","last_modified":1583937832350}, {"schema":1582890802298,"appliesTo":[{"included":{"everywhere":true}}],"webExtension":{"id":"onelook@search.mozilla.org"},"id":""} ]'"${TIMESTAMP:-}"'} ' > mozilla/services/settings/dumps/main/search-config.json From FF98, there is a forced replacement of the user set default search engine in some circumstances - [1] [2] [3]. This search-config.json fails verification checks and is overridden by the app default, so to avoid replacement of the user set search engines: [[ $MAJ_VER -ge 112 ]] && EXTN12=sys.mjs sed -i 's|retry: true|retry: false|' mozilla/services/settings/RemoteSettingsClient.${EXTN12:-jsm} ## … the phone-home URLs aren't then needed [[ $MAJ_VER -ge 104 ]] && EXTN=sys.mjs [[ $MAJ_VER -ge 108 ]] && EXTN8=sys.mjs sed -i 's|"https:.*$|"",|' mozilla/toolkit/components/search/SearchUtils.${EXTN:-jsm} sed -i 's| "https:.*$| "",|' mozilla/toolkit/modules/AppConstants.${EXTN8:-jsm} ## … and let's see the data as plain text -> search.json in the profile directory is created without compression sed -i 's|compress: true|compress: false|;s|SETTINGS_FILENAME = .*$|SETTINGS_FILENAME = "search.json";|' \ mozilla/toolkit/components/search/SearchSettings.${EXTN:-jsm} Get DuckDuckGo results page without javascript - can also be used from the command line. sed -i 's|duckduckgo.com/"|html.duckduckgo.com/html/"|' mozilla/browser/components/search/extensions/ddg/manifest.json [6] Disable predictive search in URL bar sed -i 's|keyword.enabled", true|keyword.enabled", false|' mozilla/browser/app/profile/firefox.js [[ $MAJ_VER -ge 105 ]] && EXTN5=sys.mjs sed -i 's|browser.search.suggest.enabled", true|browser.search.suggest.enabled", false|' \ mozilla/{modules/libpref/init/all.js,browser/components/urlbar/{UrlbarPrefs.${EXTN5:-jsm},tests/browser/browser_speculative_connect.js}} sed -i 's|Search with .* or enter address|Search or enter address|' mozilla/browser/locales/en-US/browser/browser.ftl ## Remove bookmarks, history, and tabs icons from urlbar search options sed -i 's|bookmarks", true|bookmarks", false|;s|tabs", true|tabs", false|;s|shortcuts.history", true|shortcuts.history", false|' mozilla/browser/app/profile/firefox.js [7] Set the mouse-wheel controlled zoom increments to other than the default 10% - for example 5% [The cache in an existing installation will need to be cleared for this to be effective] sed -i 's|0.1);|0.05);|' mozilla/browser/base/content/browser-fullZoom.js Ctrl+|- incremental values can be set with toolkit.zoomManager.zoomValues in prefs.js or about:config; or here - in this case without extending pre-set min/max values - for example to 86% and 100%: sed -i 's|pref("toolkit.zoomManager.zoomValues.*$|pref("toolkit.zoomManager.zoomValues", ".86,1");|' \ mozilla/modules/libpref/init/all.js [8] Default to https if no protocol given in the URL bar This overrides dom.security.https_only_mode whether it's set to true or false so, if implemented, the URLs for sites with http only will have to be entered with the http:// prefix [The cache in an existing installation will need to be cleared for this to be effective] [[ $MAJ_VER -ge 107 ]] && EXTN7=sys.mjs patch -p0 << EOF --- mozilla/docshell/base/URIFixup.${EXTN7:-jsm} +++ mozilla/docshell/base/URIFixup.${EXTN7:-jsm} @@ -863 +863 @@ - uriString = "http://" + uriString; + uriString = "https://" + uriString; EOF [9] Set default scrollbar values for non-native themes. set scrollbar width set slider relative width add stepper buttons to scrollbars - requires Gtk3 configuration [2]. keep scrollbar at set width patch -p0 << EOF --- mozilla/modules/libpref/init/StaticPrefList.yaml +++ mozilla/modules/libpref/init/StaticPrefList.yaml @@ -13359,5 +13359,5 @@ - name: widget.non-native-theme.scrollbar.size.override type: uint32_t - value: 0 + value: 15 mirror: always @@ -13393,5 +13393,5 @@ - name: widget.non-native-theme.gtk.scrollbar.thumb-size type: float - value: 0.75 + value: 0.85 mirror: always @@ -13411,5 +13411,5 @@ - name: widget.non-native-theme.gtk.scrollbar.allow-buttons type: bool - value: false + value: true mirror: always @@ -13487,5 +13487,5 @@ - name: widget.gtk.overlay-scrollbars.enabled type: RelaxedAtomicBool - value: true + value: false mirror: always EOF [10] Default to scaled printing ## Firefox: sed -i 's|mShrinkToFit.*$|mShrinkToFit = false;|' mozilla/widget/nsPrintSettingsImpl.h sed -i 's|print.more-settings.open", false|print.more-settings.open", true|' \ mozilla/modules/libpref/init/all.js ## For the "Mozilla Save to PDF" printer - default to 70% sed -i 's|print.more-settings.open.*$|&\npref("print.printer_Mozilla_Save_to_PDF.print_scaling", "0.7");|' \ mozilla/modules/libpref/init/all.js [11] Record the mozilla revision that the Thunderbird build is based on to add to application.ini in the package. ## Thunderbird: [[ ! $Gecko_Rev ]] && export Gecko_Rev=$(hg bookmarks -R $MOZBUILD/mozilla | grep \* |cut -d: -f2) close

Gtk3 configuration  Not a part of the build, just some customization options, for example where the defaults for gtk2/gtk3 differ …

close [1] The tooltip box for the default gtk3 Adwaita theme has white text on a black background with some padding: which is set by the tooltip section in gtk/theme/Adwaita/gtk-contained.css in the gtk3 source:
tooltip {
  padding: 4px;
  /* not working */
  border-radius: 5px;
  box-shadow: none;
  text-shadow: 0 1px black; }
tooltip.background {
  background-color: rgba(0, 0, 0, 0.8);
  background-clip: padding-box;
  border: 1px solid rgba(255, 255, 255, 0.1); }
tooltip decoration {
  background-color: transparent; }
tooltip * {
  padding: 4px;
  background-color: transparent;
  color: white; }
Overriding this in ~/.config/gtk-3.0/gtk.css with:
tooltip {
  border-radius: 5px;
  text-shadow: none;}
tooltip.background {
  background-color: #eee1b3;
  border-radius: 5px;
  border: 1px solid gray;}
tooltip * {
  padding: 0px;
  color: black;}
will show the tooltip as: [2] ~/.config/gtk-3.0/gtk.css To show scrollbar stepper icons, add:
* {
  -GtkScrollbar-has-backward-stepper: true;
  -GtkScrollbar-has-forward-stepper: true; }
[3] /etc/gtk-3.0/settings.ini To scroll by one page when clicking in the scrollbar, add:
[Settings]
gtk-primary-button-warps-slider=false
See ../gtk-doc/html/gtk3/GtkSettings.html for defaults and more options. close

Localization 

close Remove any previously created file lists: rm -rf $MOZBUILD/l10n/wip/* Checkout localization To build to a release version, the l10n revisions are contained in the l10n-changesets.json file: export L10N_CS=$(grep -A 16 $L10N $MOZBUILD/mozilla/browser/locales/l10n-changesets.json | grep revision | colrm 34 | colrm 1 21) ## For central, set to tip revision: [[ $L10N_CS == default* ]] && L10N_CS=$(hg log -l 1 -R $MOZBUILD/l10n/$L10N | head -n1 | cut -d":" -f3 | colrm 13) echo $L10N_CS hg checkout -r $L10N_CS -C -R $MOZBUILD/l10n/$L10N Or, for a known changeset: export L10N_CS=xxxxxxxxxxxx hg checkout -r $L10N_CS -C -R $MOZBUILD/l10n/$L10N For TB 113+: [[ $MAJ_VER -ge 113 ]] && { export TB_L10N_CS=$(grep -A 16 $L10N $MOZBUILD/$REL/comm-$REL/mail/locales/l10n-changesets.json | grep revision | colrm 34 | colrm 1 21) echo $TB_L10N_CS hg checkout -r $TB_L10N_CS -C -R $MOZBUILD/comm-l10n ## Copy calendar,chat,mail to location prior to release 113 to maintain compatibility with the current localization method cp -a $MOZBUILD/comm-l10n/$L10N/{calendar,chat,mail} $MOZBUILD/l10n/$L10N } Bugs Make any changes pending upstream fixes ## for 'British' english locale: sed -i 's|dialog…|dialogue|' $MOZBUILD/l10n/en-GB/toolkit/toolkit/printing/printUI.ftl sed -i 's|This dialog |This dialogue |' $MOZBUILD/l10n/en-GB/mail/messenger/accountcreation/accountSetup.ftl sed -i 's|dialog:|dialogue:|' $MOZBUILD/l10n/en-GB/mail/chrome/messenger/chat.dtd sed -i 's|dialog window|dialogue window|' $MOZBUILD/l10n/en-GB/calendar/calendar/preferences.ftl sed -i 's|the dialog has|the dialogue has|' $MOZBUILD/l10n/en-GB/calendar/chrome/calendar/calendar.properties User Preferences Change some of '… {my,your} …' to '… the …' ## Firefox: sed -i 's| [a-z]* selections| the selections|' $MOZBUILD/l10n/$L10N/browser/browser/preferences/{colors,fonts}.ftl sed -i 's|your computer’s|the computer’s|;s|your operating|the operating|' \ $MOZBUILD/l10n/$L10N/browser/browser/preferences/preferences.ftl ## Thunderbird: sed -i 's| [a-z]* selections| the selections|' $MOZBUILD/l10n/$L10N/mail/messenger/preferences/colors.ftl As for [part of] User Preference [6] Disable predictive search in URL bar sed -i 's|Search with .* or enter address|Search or enter address|' \ $MOZBUILD/l10n/en-GB/browser/{chrome/browser/browser.properties,browser/browser.ftl} Locale Use the operating system settings to format dates, times, numbers, and measurements sed -i 's|"intl.regional_prefs.use_os_locales",.*$|"intl.regional_prefs.use_os_locales", true);|' \ $MOZBUILD/mozilla/{modules/libpref/init/all,browser/app/profile/firefox}.js Workaround for FF57+. The localization build method was changed for FF57 [blog, bugzilla, single locale build]. This alternative method copies localized files to the corresponding en-US locations so the default en-US build uses localized files. A minor issue is that internal localization directories are referenced as en-US, but the dictionary, texts and messages in the final build are in the intended localization. Dictionary Replace en-US with dictionary for localization (cd $MOZBUILD/mozilla/extensions/spellcheck/locales/en-US/hunspell/ rm en-US* unzip -oj $MOZBUILD/sources/$L10N-dict.xpi dictionaries/* rename $L10N en-US *) Comparing en-US and $L10N localizations … Create a list of default en-US localization files, searching directories for which localizations exist in l10n/$L10N: for file in $MOZBUILD/mozilla/{browser,devtools,dom,netwerk,security,services,toolkit} do find $file -type f | grep locales/en-US done > $MOZBUILD/l10n/wip/en-US-l10n-files for file in $MOZBUILD/$REL/comm-$REL/{calendar,chat,mail} do find $file -type f | grep locales/en-US done >> $MOZBUILD/l10n/wip/en-US-l10n-files Create a list of all localized files: for file in $MOZBUILD/l10n/$L10N do find $file -type f | grep -vE "/.hg|/irc/|/suite/|/editor/|/android/|/mobile/" done > $MOZBUILD/l10n/wip/$L10N-l10n-files Copy localized files to en-US locations with a test run if required: TEST_CP=yes ## Read from the list of localized files ... cat $MOZBUILD/l10n/wip/$L10N-l10n-files | while read localized_file do ## [a] remove l10n/$L10N/ from localized file path localized_edited_path=$(echo $localized_file | sed "s|l10n/$L10N/||") ## extract the filename ... filename=$(echo $localized_file | rev | cut -d/ -f1 | rev) ## ... find the path of all en-US filename occurrences ... en_US_file_paths=$(grep $filename $MOZBUILD/l10n/wip/en-US-l10n-files) ## [b] ... for each en-US file occurrence, remove locales/en-US/ and mozilla/ or $REL/comm-$REL/ from en-US path for en_US_file in $en_US_file_paths do en_US_edited_path=$(echo $en_US_file \ | sed 's|locales/en-US/||' \ | sed 's|mozilla/||' \ | sed "s|$REL/comm-$REL/||") ## if the edited strings match [a == b], copy the localized file to the en-US location [[ $localized_edited_path == $en_US_edited_path ]] && { [[ $TEST_CP != yes ]] && { cp $localized_file $en_US_file echo -e " copying $localized_file to $en_US_file" } || { echo -e " would copy $localized_file to $en_US_file" } } || { [[ $TEST_CP == yes ]] && { echo -e " $localized_file would NOT be copied to $en_US_file" } } done done Search engines Requires User Preference [5b] - edit the search engines manifest.json and messages.json files as required. cd $MOZBUILD/mozilla ## search Google.co.uk: sed -i 's|google.com|google.co.uk|;s|Google|&.co.uk|' browser/components/search/extensions/google/_locales/en/messages.json ## search Amazon.co.uk: sed -i '/suggest_url/d' browser/components/search/extensions/amazondotcom/manifest.json cp browser/components/search/extensions/amazon/_locales/en-GB/messages.json browser/components/search/extensions/amazondotcom/_locales/en/messages.json ## search eBay.co.uk: sed -i '/suggest/d;s|GetParams__",|GetParams__"|' browser/components/search/extensions/ebay/manifest.json (cd browser/components/search/extensions/ebay/_locales/en/ sed -i 's|eBay|eBay.co.uk|;s|ebay.com|ebay.co.uk|;s|sId=0|sId=3|' messages.json sed -i 's|/sch/|/sch/i.html|' messages.json sed -i 's|toolid=.*$|_nkw={searchTerms}"|' messages.json) close


Building Firefox [ Nightly] unset XCOMPILE Cross compiling  … additional setting up for cross compiling.
close The additions fit into the build tree like this: $MOZBUILD ├── sources │ └── rust-… x86_64 installation │ └── lib │ └── rustlib │ ├── x86_64-unknown-linux-gnu x86_64 crate - already in place for native build │ ├── aarch64-unknown-linux-gnu aarch64 crate │ ├── armv7-unknown-linux-gnueabihf armv7 crate │ └── i686-unknown-linux-gnu i686 crate └── $TARGET_INSTN target libs and headers installation - bind mounted to sysroot * /opt └── cross-pi-gcc    ├── bin cross compiler    └── sysroot * directory set when building cross compiler [1] Set variables for an aarch64, armv7, or i686 build. Unset any optimization which might have been set for a x86_64 build unset OPTM Don't use variables used by mozilla - confuses libloading for example .. and setting flags with CC etc in the shell environment will fail configure, so set architecture specific variables here and re-assign them in mozconfig.cross. The toolchain used is a custom built gcc cross compiler, which includes some compiler optimizations for the arm versions, and creating a kernel headers package. 64-bit aarch64 export CRATE=aarch64-unknown-linux-gnu export X_TARGET=aarch64-linux-gnu ## -march=armv8-a+crc is the compiler default, so just add -mtune=cortex-a53 ## and suppress compiler warnings? OPTM="-w" export X_CC="$X_TARGET-gcc -mtune=cortex-a53 ${OPTM:-}" export X_CXX="$X_TARGET-g++ -mtune=cortex-a53 ${OPTM:-}" export LIBDIRSUFFIX=64 ## Slack_base = where the Slarm64 packages a-y directories are: ## Download from a Slackware mirror - for example slackware.uk export Slack_base=/path_to_Slarm64 export TARGET_INSTN=FF-RPi3-aarch64-sysroot export PKG_ARCH=aarch64 ## 'elf-hack' is ok export DISABLE_ELFHACK='' OR: 32-bit armv7_hf export CRATE=armv7-unknown-linux-gnueabihf export X_TARGET=arm-linux-gnueabihf ## -march=armv8-a+crc and -mtune=cortex-a53 are the compiler defaults ## and suppress compiler warnings? OPTM="-w" export X_CC="$X_TARGET-gcc ${OPTM:-}" export X_CXX="$X_TARGET-g++ ${OPTM:-}" export LIBDIRSUFFIX="" ## Slack_base = where the Slackware packages a-y directories are: ## Download from a Slackware mirror - for example slackware.uk export Slack_base=/path_to_Slackware_arm_current export TARGET_INSTN=FF-RPi3-arm-sysroot ## Set variable for the package name export PKG_ARCH=armv7_hf ## running elfhack during the build doesn't fail, but corrupts libxul.so export DISABLE_ELFHACK='ac_add_options --disable-elf-hack' OR: 32-bit i686 export CRATE=i686-unknown-linux-gnu export X_TARGET=i686-linux-gnu ## gcc optimization for HOST, so only use if TARGET == same machine architecture OPTM="$(echo $(gcc -Q -O2 -march=native --help=target | grep -E "^ -march=|^ -mfpmath=|^ -mtune=" | tr -d [:blank:])) -msse -msse2" ## should be something like: # -march=core2 -mfpmath=sse -mtune=core2 -msse -msse2 ## otherwise, if required, set OPTM=<user_defined> for TARGET machine … ## and suppress compiler warnings? OPTM="$OPTM -w" echo $OPTM export X_CC="$X_TARGET-gcc ${OPTM:-}" export X_CXX="$X_TARGET-g++ ${OPTM:-}" export LIBDIRSUFFIX="" ## Slack_base = where the Slackware32 packages a-y directories are: ## Download from a Slackware mirror - for example slackware.uk export Slack_base=/path_to_Slackware32 export TARGET_INSTN=FF-i686-sysroot export PKG_ARCH=i686 ## 'elf-hack' is ok export DISABLE_ELFHACK='' [2] Additional rust requirements For rust, host relates to the architecture that the program is built on, and target relates to the architecture that the program will run on. rustc and cargo and the rust-std crate are already installed for x86_64 [host]. Download and install the target crate for the cross build. This must be the same version as the host crate, and installed to the same prefix. cd $MOZBUILD/sources/ RUST_VER=$($MOZBUILD/sources/rust-$ARCH/bin/rustc -V|cut -d" " -f2) echo $RUST_VER wget https://static.rust-lang.org/dist/rust-std-$RUST_VER-$CRATE.tar.xz tar xf rust-std-$RUST_VER-$CRATE.tar.xz cd rust-std-$RUST_VER-$CRATE ./install.sh --prefix=$MOZBUILD/sources/rust-$ARCH [3] Cross compiler Set the cross tools directories export XGCC_DIR=/opt/cross-pi-gcc export SYSROOT=$XGCC_DIR/sysroot Install the cross compiler installpkg /tmp/xgcc910-glibc2.29-4.19.27-<re: $PKG_ARCH>.txz There is an issue with the different limits.h priorities which occurs in cross compiling for Firefox. The error is: /opt/cross-pi-gcc/arm-linux-gnueabihf/include/bits/stdlib.h:90:3: error: #error "Assumed value of MB_LEN_MAX wrong" … /opt/cross-pi-gcc/arm-linux-gnueabihf/include/bits/wchar2.h:448:3: error: #error "Assumed value of MB_LEN_MAX wrong" I've used the solution here to resolve this. (cd $XGCC_DIR/lib/gcc/*-linux-gnu*/9.1.0/plugin/include/ cat limitx.h glimits.h limity.h > ../../include-fixed/limits.h) [4] Set up a sysroot for the target libs and headers needed for the Firefox build. OR Skip this and use an existing installation. My preference is to install the target libs and headers in a separate directory and bind-mount it to the cross compiler sysroot directory. Install kernel headers and Slackware/Slarm64 libs/headers as used for the target OS export ROOT=$MOZBUILD/$TARGET_INSTN installpkg /tmp/kernel-headers-4.19.27-<re: $PKG_ARCH>.txz cd $Slack_base installpkg l/pango-*.txz installpkg l/glib2-*.txz installpkg l/pcre-*.txz installpkg l/fribidi-*.txz installpkg l/freetype-*.txz installpkg l/zlib-*.txz installpkg a/bzip2-*.txz installpkg l/libpng-*.txz installpkg x/fontconfig-*.txz installpkg a/util-linux-*.txz installpkg l/expat-*.txz installpkg l/harfbuzz-*.txz installpkg l/cairo-*.txz installpkg x/pixman-*.txz installpkg x/mesa-*.txz installpkg x/libglvnd-*.txz installpkg x/libdrm-*.txz installpkg x/libX11-*.txz installpkg x/xorgproto-*.txz installpkg x/libxcb-*.txz installpkg x/libpthread-stubs-*.txz installpkg x/libXau-*.txz installpkg x/libXdmcp-*.txz installpkg x/libXext-*.txz installpkg x/libXdamage-*.txz installpkg x/libXfixes-*.txz installpkg x/libXxf86vm-*.txz installpkg x/libXrender-*.txz installpkg l/gtk+3-3.*.txz installpkg l/gdk-pixbuf2-*.txz installpkg x/libXtst-*.txz installpkg x/libXinerama-*.txz installpkg x/libXi-*.txz installpkg x/libXrandr-*.txz installpkg x/libXcursor-*.txz installpkg x/libXcomposite-*.txz installpkg x/libepoxy-*.txz installpkg l/atk-*.txz installpkg l/at-spi2-atk-*.txz installpkg l/at-spi2-core-*.txz installpkg a/dbus-*.txz installpkg l/gtk+2-*.txz installpkg l/dbus-glib-*.txz installpkg l/pulseaudio-*.txz installpkg x/libXt-*.txz installpkg x/libSM-*.txz installpkg x/libICE-*.txz installpkg l/libffi-*.txz installpkg x/libxshmfence-*.txz installpkg n/openssl-1.1.*.txz installpkg x/glu-*.txz installpkg l/graphite2-*.txz installpkg l/shared-mime-info-*.txz ## added for FF97+ installpkg l/alsa-lib-*.txz installpkg x/libXtst-*.txz ## move ldconfig out of the way - links will be set up by doinst.sh mv /sbin/ldconfig /sbin/ldconfig-bak installpkg l/glibc-2.29*.txz mv /sbin/ldconfig-bak /sbin/ldconfig unset ROOT Mount to $SYSROOT mount -B $MOZBUILD/$TARGET_INSTN $SYSROOT [5] Set up shell variables. pkg-config needs to access the libs and headers for the target system and these exports set it up to prefix $SYSROOT to the -L and -I paths in the .pc files export PKG_CONFIG_PATH= export PKG_CONFIG_SYSROOT_DIR=$SYSROOT export PKG_CONFIG_LIBDIR=$SYSROOT/usr/lib$LIBDIRSUFFIX/pkgconfig:$SYSROOT/usr/share/pkgconfig Add the cross compiler [$X_TARGET-gcc etc..] bin directory to the PATH export PATH=$XGCC_DIR/bin:$PATH Set suffix for additional mozconfigs export XCOMPILE=.cross [6] The build needs to be set up to use the cross compiler [CC=] and the rust target crate [--target=] Create an additional common mozconfig ⇒ mozconfig.cross cd $MOZBUILD/mozilla cat > mozconfig.cross << "EOF" ac_add_options --target=$CRATE ## Set CC/CXX to enable compiler optimization set in X_CC and X_CXX CC=$X_CC CXX=$X_CXX ## the i686 build sets host == target if HOST_C* not set, [[ $CRATE == *i686* ]] && { HOST_CC=gcc HOST_CXX=g++ } ## elfhack corrupts libxul.so on an armv7-hf build $DISABLE_ELFHACK ## use LD_LIBRARY_PATH to find libstdc++ etc crosstools versions mk_add_options "export LD_LIBRARY_PATH=$XGCC_DIR/$X_TARGET/lib$LIBDIRSUFFIX" ## use the cross tools to strip the arm libraries during installation mk_add_options "export STRIP=$XGCC_DIR/$X_TARGET/bin/strip" ## Add BINDGEN_CFLAGS for the servo/style [stylo] build, ## setting include paths for the cross compiler being used. ## BINDGEN_PLUS adds some includes specific to each x86/arm architecture [[ $CRATE == *i686* ]] && { ## … prioritize the mozilla nss.h for the neqo-crypto build to prevent ## error[E0425]: cannot find function, ... `NSS_Shutdown` in module `nss` etc. BINDGEN_PLUS="-I$MOZBUILD/mozilla/security/nss/lib/nss/ -I$XGCC_DIR/$X_TARGET/include" } || { BINDGEN_PLUS="-I$XGCC_DIR/lib/gcc/$X_TARGET/9.1.0/include \ -I$XGCC_DIR/lib/gcc/$X_TARGET/9.1.0/include-fixed" } mk_add_options "export BINDGEN_CFLAGS=--sysroot=$SYSROOT \ -I$XGCC_DIR/$X_TARGET/include/c++/9.1.0 \ -I$XGCC_DIR/$X_TARGET/include/c++/9.1.0/$X_TARGET \ ${BINDGEN_PLUS:-}" EOF Create mozconfig.firefox.cross cd $MOZBUILD/mozilla cat > mozconfig.firefox.cross << "EOF" ## include the native build mozconfig source $MOZBUILD/mozilla/mozconfig.firefox ## include the common cross build mozconfig source $MOZBUILD/mozilla/mozconfig.cross EOF [7] Error patches: fatal error: main_FIX.h: No such file or directory cd $MOZBUILD/mozilla/ echo $'--- media/libopus/silk/arm/arm_silk_map.c +++ media/libopus/silk/arm/arm_silk_map.c @@ -31 +31 @@ -#include "main_FIX.h" +#include "../fixed/main_FIX.h" ' | patch -p0 ERROR: No package 'libpulse' found This is a failure to find the SYSROOT libraries for an aarch64 build … fixed for FF118 cd $MOZBUILD/mozilla/ [[ ! $(grep usr/lib64/pkgconfig build/moz.configure/pkg.configure) ]] && { echo $'--- build/moz.configure/pkg.configure +++ build/moz.configure/pkg.configure @@ -65,2 +65,3 @@ for d in ( + "usr/lib64/pkgconfig", "usr/lib/pkgconfig", ' | patch -p0 } error: failed to run custom build command for `swgl v0.1.0 (/mozbuild/mozilla/gfx/wr/swgl)` Caused by the 'Pick cc upstream patch for GCC 11 on armhf linux' changeset … This work-around is to substitute the fpu parameter with the default from the gcc toolchain. Use arm-linux-gnueabihf-gcc -Q -march=armv7-a --help=target | grep "^  -mfpu" to find out what it is. cd $MOZBUILD/mozilla/ echo $'--- third_party/rust/cc/src/lib.rs +++ third_party/rust/cc/src/lib.rs @@ -1685,5 +1685,5 @@ if target.ends_with("eabihf") { // lowest common denominator FPU - cmd.args.push("-mfpu=vfpv3-d16".into()); + cmd.args.push("-mfpu=neon-fp-armv8".into()); } } ' | patch -p0 CHK_SUM_OLD=$(grep -o src/lib.rs\":\"[0-9a-f]* third_party/rust/cc/.cargo-checksum.json | cut -d'"' -f3) CHK_SUM_NEW=$(sha256sum third_party/rust/cc/src/lib.rs | cut -d' ' -f1) sed -i "s|$CHK_SUM_OLD|$CHK_SUM_NEW|" third_party/rust/cc/.cargo-checksum.json error: invalid feature modifier ‘i8mm’ in ‘-march=armv8.2-a+dotprod+i8mm’ Error: unknown architectural extension `i8mm' This affects an aarch64 build for FF120+ and is a work-around for gcc <= v9 not having i8mm support. [[ $MAJ_VER -ge 120 ]] &&\ [[ $(aarch64-linux-gnu-gcc -march=armv8.2-a+dotprod+i8mm -Q --target-help 2>&1> /dev/null)\ == *"invalid feature modifier ‘i8mm’"* ]] && { cd $MOZBUILD/mozilla/ sed -i 's|--target=arm64-linux-gcc|& --disable-neon_i8mm|' media/libvpx/generate_sources_mozbuild.sh sed -i 's|gen_rtcd_header linux/arm64 arm64|& --disable-neon_i8mm|' media/libvpx/generate_sources_mozbuild.sh (cd media/libvpx ./generate_sources_mozbuild.sh) } close
cd $MOZBUILD/mozilla/ export MOZCONFIG=$MOZBUILD/mozilla/mozconfig.firefox${XCOMPILE:-} [[ $MAJ_VER -ge 108 ]] && \ export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system || export MACH_USE_SYSTEM_PYTHON=1 export MOZBUILD_STATE_PATH=$MOZBUILD/.mozilla ./mach build A successful build will end with a message like: mmm:ss.xx We know it took a while, but your build finally finished successfully! To take your build for a test drive, run: |mach run| Let's take it for a test drive: ./mach run Installation: Install to $DESTDIR for packaging: DESTDIR=$MOZBUILD/$REL/packaging-FF-$PKG_ARCH ./mach install

Create package Includes setting up a relative link for /usr/bin/firefox … cd $MOZBUILD/$REL/packaging-FF-$PKG_ARCH/usr/lib mkdir -p pkg/{opt,usr/bin} mv firefox pkg/opt/firefox-$(cat $MOZBUILD/mozilla/browser/config/version_display.txt) ## 'for the record', add the l10n revision that this build is based on: sed -i "s|SourceStamp.*$|&\nL10n_revision=${L10N_CS:-}|" pkg/opt/firefox-*/application.ini (cd pkg/usr/bin ln -s ../../opt/firefox-*/firefox .) cd pkg makepkg -l y -c n ../../../../built/firefox-$(cat $MOZBUILD/mozilla/browser/config/version_display.txt)$LOCZN-$PKG_ARCH.txz


Building Thunderbird [ Daily] unset XCOMPILE Mount comm-$REL to comm … cd $MOZBUILD/mozilla mount -B $MOZBUILD/$REL/comm-$REL comm Cross compiling  … additional setting up for cross compiling.
close 1] Firstly, set up mozilla. 2] Create a mozconfig.thunderbird.cross cd $MOZBUILD/$REL/comm-$REL cat > mozconfig.thunderbird.cross << "EOF" ## include the native build mozconfig source $MOZBUILD/$REL/comm-$REL/mozconfig.thunderbird ## include the common cross build mozconfig source $MOZBUILD/mozilla/mozconfig.cross EOF 3] Set suffix for mozconfig export XCOMPILE=.cross close
cd $MOZBUILD/mozilla/comm export MOZCONFIG=$MOZBUILD/mozilla/comm/mozconfig.thunderbird${XCOMPILE:-} [[ $MAJ_VER -ge 108 ]] && \ export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system || export MACH_USE_SYSTEM_PYTHON=1 export MOZBUILD_STATE_PATH=$MOZBUILD/.mozilla ../mach build A successful build will end with a message like: mmm:ss.xx We know it took a while, but your build finally finished successfully! To take your build for a test drive, run: |mach run| Let's take it for a test drive: ../mach run Installation Install to $DESTDIR for packaging: DESTDIR=$MOZBUILD/$REL/packaging-TB-$PKG_ARCH ../mach install OTR  … add libotr for Off-the-Record Messaging.
close This is based on the script comm-*/taskcluster/scripts/build-libotr.sh. For cross compiling, sysroot is defined in the cross-compiler and the relevant libraries and headers are mounted to that point so setting --with-sysroot= is not needed. ## Build in the existing third_party directory DEST=$MOZBUILD/$REL/thunderbird-build-dir-$PKG_ARCH/third_party ## Install dependencies to the build tree as only libotr.so is required export DESTDIR=$DEST/build-libotr ## Where to find the libgpg-error and libgcrypt headers export CFLAGS=-I$DESTDIR/include ## Build static libraries for libgpg-error and libgcrypt CONF_STATIC="--enable-static --disable-shared" NUMJOBS=-j2 ## X_ variables are from the TB cross build CC=${X_CC:-"gcc ${OPTM:-}"} HOST=${X_TARGET:-} STRIP=${HOST:+$HOST-}strip ## Copy sources to build directory (cd $MOZBUILD/$REL/comm-$REL/third_party cp -a {libgcrypt,libgpg-error,libotr} $DEST) ## Set gpg-error-config and libgcrypt-config prefix directory sed -i "s|^prefix=.*$|prefix=$DESTDIR|" $DEST/*/src/*-config.in ## Build libgpg-error cd $DEST/libgpg-error ./configure --prefix=/ --host=$HOST $CONF_STATIC --with-pic #gpg-error.h:112x:1: error: expected identifier or '(' before numeric constant ## This is caused by the lock-obj-pub.native.h generated by ./configure when cross compiling. ## It should be generated by gen-posix-lock-obj which isn't built when cross compiling, ## so replace that lock-obj-pub.native.h with the pre-built file included with the source. [[ $PKG_ARCH == aarch64 ]] && \ cp src/syscfg/lock-obj-pub.aarch64-unknown-linux-gnu.h src/lock-obj-pub.native.h [[ $PKG_ARCH == armv7_hf ]] && \ cp src/syscfg/lock-obj-pub.arm-unknown-linux-gnueabi.h src/lock-obj-pub.native.h [[ $PKG_ARCH == i686 ]] && \ cp src/syscfg/lock-obj-pub.i686-unknown-gnu.h src/lock-obj-pub.native.h make $NUMJOBS -C src code-to-errno.h make $NUMJOBS -C src code-from-errno.h make $NUMJOBS -C src gpg-error.h make -C src install-nodist_includeHEADERS install-binSCRIPTS install-libLTLIBRARIES ## Build libgcrypt cd $DEST/libgcrypt ./configure --prefix=/ --host=$HOST --with-libgpg-error-prefix=$DESTDIR $CONF_STATIC --with-pic make $NUMJOBS -C cipher libcipher.la make $NUMJOBS -C random librandom.la make $NUMJOBS -C mpi libmpi.la make $NUMJOBS -C compat libcompat.la make -C src install-nodist_includeHEADERS install-binSCRIPTS install-libLTLIBRARIES ## Build libotr cd $DEST/libotr #/usr/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] sed -i "s|-D_FORTIFY_SOURCE=2|-O2 &|" configure ## update timestamps on libotr files which need to be the same as or later than for libgpg-error & libgcrypt ## to avoid 'cd .. && make am--refresh' when running make TSTMP=$(date +%Y%m%d%H%M) [[ $REL != esr91 ]] && { for file in $DEST/libotr/* do touch -t $TSTMP $file done } ./configure --host=$HOST --with-libgcrypt-prefix=$DESTDIR --enable-shared --with-pic cd src make $NUMJOBS $CC -shared .libs/*.o $DESTDIR/lib/libgcrypt.a $DESTDIR/lib/libgpg-error.a \ -Wl,-soname -Wl,libotr.so -o $MOZBUILD/$REL/packaging-TB-$PKG_ARCH/usr/lib/thunderbird/libotr.so $STRIP $MOZBUILD/$REL/packaging-TB-$PKG_ARCH/usr/lib/thunderbird/libotr.so ## Check that otr chat is enabled zipgrep chat.otr.enable $MOZBUILD/$REL/packaging-TB-$PKG_ARCH/usr/lib/thunderbird/omni.ja \ defaults/pref/all-thunderbird.js ## Should be #defaults/pref/all-thunderbird.js:pref("chat.otr.enable", true); close

Create package Includes setting up a relative link for /usr/bin/thunderbird … cd $MOZBUILD/$REL/packaging-TB-$PKG_ARCH/usr/lib mkdir -p pkg/{opt,usr/bin} mv thunderbird pkg/opt/thunderbird-$(cat $MOZBUILD/$REL/comm-$REL/mail/config/version_display.txt) ## Set SourceStamp to comm-$REL revision: [[ ! $COMM_BUILD_CS ]] && COMM_BUILD_CS=$(hg parent -R $MOZBUILD/$REL/comm-$REL | head -n1 | cut -d":" -f3) sed -i "s|SourceStamp=.*$|SourceStamp=$COMM_BUILD_CS|" pkg/opt/thunderbird-*/application.ini ## 'for the record', add the mozilla and l10n revisions that this build is based on: [[ $MAJ_VER -ge 113 ]] && L10N_CS=${TB_L10N_CS:-} sed -i "s|SourceStamp.*$|&\nL10n_revision=${L10N_CS:-}|" pkg/opt/thunderbird-*/application.ini sed -i "s|SourceStamp.*$|&\nGecko_revision=${Gecko_Rev:-}|" pkg/opt/thunderbird-*/application.ini (cd pkg/usr/bin ln -s ../../opt/thunderbird-*/thunderbird .) cd pkg makepkg -l y -c n ../../../../built/thunderbird-$(cat $MOZBUILD/$REL/comm-$REL/mail/config/version_display.txt)$LOCZN-$PKG_ARCH.txz

Unmount the bind mounts:
umount $MOZBUILD/$REL/comm-$REL/mozilla/comm umount $MOZBUILD/$REL/comm-$REL/mozilla umount $SYSROOT


To clone this page from Github:
git clone -n https://github.com/Ray-V/mozbuild.git cd mozbuild git checkout gh-pages

To build SeaMonkey, revert to an earlier revision …
git log … choose the revision required, and for example for a SeaMonkey 2.57 build git checkout e87845fb07