How-to: Build an (apparently) libre version of Pale Moon browser on Trisquel

4 respostas [Última entrada]
andyprough
Desconectado
Joined: 02/12/2015

These instructions build an unbranded version of Pale Moon which should be libre software, since the branding is the portion of the browser that has trademark and licensing restrictions to my knowledge. Instead of calling it 'unbranded Pale Moon', I've taken to calling it "bbrowser" on my system, similar to how we have 'abrowser' on Trisquel. What follows is simple instructions on how I built it on Trisquel Mini 10. You are supposed to have at least 6gb of ram to build it - I've been building it on 6gb systems. Building takes me about 2 hours with an aging i7 processor, might take overnight with a Core Duo.

1. Install the build dependencies to your Trisquel system
sudo apt install build-essential libgtk2.0-dev libdbus-glib-1-dev autoconf2.13 yasm libegl1-mesa-dev libasound2-dev libxt-dev zlib1g-dev libssl-dev libsqlite3-dev libbz2-dev libpulse-dev libgconf2-dev libx11-xcb-dev zip python2.7 python-dbus git cmake
This command will probably pull in a lot of other dependencies, at least it did on Trisquel Mini. I recommend a reboot at this point.

2. Clone the git repo
mkdir ~/git && cd ~/git/
git clone https://repo.palemoon.org/MoonchildProductions/Pale-Moon.git
cd Pale-Moon/
git submodule init && git submodule update
git checkout release && git submodule update

3. Create a .mozconfig file with your build options
mousepad ~/git/Pale-Moon/.mozconfig
Inside that file, copy and paste these config options and then save and quit mousepad. This includes the instructions to NOT give the browser the "Pale Moon" branding, so the browser will just call itself "Browser" (and we'll call it "bbrowser"):
# Clear this if not a 64bit build
_BUILD_64=1
# Set GTK Version to 2 or 3
_GTK_VERSION=2
# Standard build options for Pale Moon
ac_add_options --enable-application=palemoon
ac_add_options --enable-optimize="-O2 -w"
ac_add_options --enable-default-toolkit=cairo-gtk$_GTK_VERSION
ac_add_options --enable-jemalloc
ac_add_options --enable-strip
ac_add_options --enable-devtools
ac_add_options --enable-av1
ac_add_options --disable-gamepad
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-necko-wifi
ac_add_options --disable-updater
ac_add_options --with-pthreads
# Please see https://www.palemoon.org/redist.shtml for restrictions when using the official branding.
# ac_add_options --enable-official-branding
# export MOZILLA_OFFICIAL=1
# Processor architecture specific build options
if [ -n "$_BUILD_64" ]; then
ac_add_options --x-libraries=/usr/lib64
else
ac_add_options --x-libraries=/usr/lib
fi
export MOZ_PKG_SPECIAL=gtk$_GTK_VERSION

4. Now build the browser:
./mach build
If you get any error messages, read them closely and see if you are missing a dependency and try installing it and building again.

5. If it builds successfully, you can take it for a test run with this command:
./mach run

6. Strip and package the browser into a tarball with a GNU/Linux binary that you can put on whatever pc you like:
./mach package
This will result in a tarball being created at ~/git/Pale-Moon/obj-x86_64-pc-linux-gnu/dist/palemoon-{version}.linux-x86_64-gtk2.tar.xz

7. To install it to your system, move the tarball to your home directory, unpack it, and link the resulting binary and its icons to the system directories:
mv ~/git/Pale-Moon/obj-x86_64-pc-linux-gnu/dist/palemoon-{version}.linux-x86_64-gtk2.tar.xz ~
cd ~
tar vxf palemoon-{version}.linux-x86_64-gtk2.tar.xz
sudo ln -s /home/[USER-NAME-GOES-HERE]/palemoon/palemoon /usr/local/bin/bbrowser
sudo ln -s /home/[USER-NAME-GOES-HERE]/palemoon/browser/chrome/icons/default/default16.png /usr/share/icons/hicolor/16x16/apps/bbrowser.png
sudo ln -s /home/[USER-NAME-GOES-HERE]/palemoon/browser/chrome/icons/default/default32.png /usr/share/icons/hicolor/32x32/apps/bbrowser.png
sudo ln -s /home/[USER-NAME-GOES-HERE]/palemoon/browser/chrome/icons/default/default16.png /usr/share/icons/hicolor/48x48/apps/bbrowser.png
sudo ln -s /home/[USER-NAME-GOES-HERE]/palemoon/browser/icons/mozicon128.png /usr/share/icons/hicolor/128x128/apps/bbrowser.png

8. Create a .desktop file so that bbrowser shows up in your Trisquel main menu:
sudo mousepad /usr/share/applications/bbrowser.desktop
Then copy and paste this text into it and save and quit from mousepad:
[Desktop Entry]
Version=1.0
Name=bbrowser Web Browser
Comment=Browse the World Wide Web
GenericName=Web Browser
Keywords=Internet;WWW;Browser;Web;Explorer
Exec=bbrowser %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/usr/share/icons/hicolor/32x32/apps/bbrowser.png
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;
StartupNotify=true

That's it, should work.
These build instructions are adopted from here: http://developer.palemoon.org/build/linux/
And the installation instructions are adopted from here: http://linux.palemoon.org/help/installation/

If you want to add some extensions, such as an adblocker or one of the many other Pale Moon extensions, you can find the officially supported ones here: https://addons.palemoon.org/extensions/ [you may need to access that page from bbrowser/Pale Moon]
and themes are here: https://addons.palemoon.org/themes/

jxself
Desconectado
Joined: 09/13/2010

Consider that the source code's the actual program. I'd go one step further in the rebranding by replacing the "palemoon" occurrences in the source code with the new browser name and the official icons, etc. with something different. This helps to get rid of more palemoon references, like the tarball doesn't get called palemoon, you don't end up with /home/[USER-NAME-GOES-HERE]/palemoon/ and etc.

andyprough
Desconectado
Joined: 02/12/2015

Yes, and at that point I should be able to make binaries available instead of writing out build instructions.

iShareFreedom
Desconectado
Joined: 12/20/2021

isnt more important have a Icecat installable from repositories in Trisquel GNU/Linux-libre?

andyprough
Desconectado
Joined: 02/12/2015

That's basically what you get with abrowser, since it is made with the Icecat build scripts. If your hearts desire is to have an Icecat branded browser, I did put up a how-to on installing it on Trisquel with the Guix package manager here - https://trisquel.info/en/forum/installing-guix-trisquel-10-w-luakit-and-ungoogled-chromium