首先下载源代码
但是最新的代码有语法错误,需要进入源码目录将其回退到最新的测试版
hg checkout FIREFOX_NIGHTLY_142_END
cd comm/
hg checkout BETA_142_BASE
然后为了能成功初始化,需要编辑文件python/mozboot/mozboot/bootstrap.py,使得初始化脚本能够认出loongnix发行版
DEBIAN_DISTROS = (
"debian",
"ubuntu",
"linuxmint",
"elementary",
"neon",
"pop",
"kali",
"devuan",
"pureos",
"deepin",
"tuxedo",
"loongnix" # 加入这行
)
因为最后编译出来的可执行文件较大,为了能够链接成功需要初始化一堆环境变量,其中很多文档里没提到,是从脚本里grep出来的,下个版本里不知道会不会加新的,但当前版本设置这些就可以了
export CFLAGS=' -mcmodel=extreme '
export CPPFLAGS=$CFLAGS
export CXXFLAGS=$CFLAGS
export LDFLAGS=$CFLAGS
export HOST_CFLAGS=$CFLAGS
export HOST_CPPFLAGS=$CFLAGS
export HOST_CXXFLAGS=$CFLAGS
export HOST_LDFLAGS=$CFLAGS
然后需要设置参数让编译脚本去编译thunderbird而不是firefox,并且由于用来编译牡丹加密库的脚本拒绝在非x86和arm的平台上编译,则需要设置参数让编译脚本改用openssl加密库
ac_add_options --enable-project=comm/mail
ac_add_options --without-wasm-sandboxed-libraries
ac_add_options --with-librnp-backend=openssl
ac_add_options --disable-gecko-profiler
然后执行初始化脚本
执行后会列出选项,选择第二项
Please choose the version of Firefox you want to build:
1. Firefox for Desktop Artifact Mode
2. Firefox for Desktop
3. GeckoView/Firefox for Android Artifact Mode
4. GeckoView/Firefox for Android
初始化脚本会失败,因为glean-sdk的问题,提示相关信息后改用autoconf构建
在源码目录里
mkdir build_thunderbird
cd build_thunderbird
../configure
make
sudo make install
这个过程会在五个小时以上,如果等不了可以在执行make之前进入bios的超频选项开启狂暴模式,但由于其后果不明,编译成功后建议退出超频模式
然后thunderbird就安装到了 /usr/local/lib/thunderbird 并且在 /usr/local/bin 中放置了符号链接
但无法直接运行,直接运行会在报错后退出
XPCOMGlueLoad error for file /usr/local/lib/thunderbird/libxul.so:
/usr/local/lib/thunderbird/libxul.so: cannot allocate memory in static TLS block
Couldn't load XPCOM.
解决方式是要么把/usr/local/lib/thunderbird目录加入/etc/ld.so.conf,或者用脚本启动,我选择用脚本启动,写一个脚本
#!/usr/bin/env bash
export LD_PRELOAD=/usr/local/lib/thunderbird/libfreeblpriv3.so:/usr/local/lib/thunderbird/libgkcodecs.so:/usr/local/lib/thunderbird/liblgpllibs.so:/usr/local/lib/thunderbird/libmozavcodec.so:/usr/local/lib/thunderbird/libmozavutil.so:/usr/local/lib/thunderbird/libmozgtk.so:/usr/local/lib/thunderbird/libmozsqlite3.so:/usr/local/lib/thunderbird/libmozwayland.so:/usr/local/lib/thunderbird/libnspr4.so:/usr/local/lib/thunderbird/libnss3.so:/usr/local/lib/thunderbird/libnssutil3.so:/usr/local/lib/thunderbird/libplc4.so:/usr/local/lib/thunderbird/libplds4.so:/usr/local/lib/thunderbird/librnp.so:/usr/local/lib/thunderbird/libsmime3.so:/usr/local/lib/thunderbird/libsoftokn3.so:/usr/local/lib/thunderbird/libssl3.so:/usr/local/lib/thunderbird/libxul.so
thunderbird
启动成功