forked from mozilla/releases-comm-central
-
Notifications
You must be signed in to change notification settings - Fork 0
Build Thunderbird with current RNP on Windows
Johannes Roth edited this page Oct 23, 2023
·
2 revisions
- We clone the mozilla-central repo and our fork of the comm-central repo.
- mozilla-build doesn't offer new enough MSVC to compile Botan 3.2.0. It seems to be Visual Studio 17 with a missing implementation for the
requires
keyword. (This is only my quick assessment that could be wrong). - Thus, we compile RNP as a standalone .dll first, and then link dynamically when running Thunderbird.
Basically follow the official instructions https://developer.thunderbird.net/thunderbird-development/building-thunderbird with some tweaks:
- For mozilla-central, download the mercurial bundles:
- https://firefox-source-docs.mozilla.org/contributing/vcs/mercurial_bundles.html
- https://hg.cdn.mozilla.net/
- this is a) faster and b) works reliably in contrast to
hg clone
failing to clone the big repo.
For the comm-central repo, we use our Fork of the Github mirror (this project).
Detailled commands that I executed (in the mozilla build shell):
- export http_proxy=crusher.mtg.de:3128 && export https_proxy=crusher.mtg.de:3128
- cd /d/Projekte/PQC_Thunderbird/AP4-5
- mkdir mozilla-central
- hg init mozilla-central
- hg unbundle ../bundle.hg
- hg config --local --edit
- add the lines:
[paths]
default = https://hg.mozilla.org/mozilla-central
- hg pull
- hg update
Now we add the comm subdirectory:
- mkdir comm
- hg init comm
- cd comm
- hg unbundle ../../bundle-comm-central.hg
- hg config --local --edit
- add the lines:
[paths]
default = https://hg.mozilla.org/comm-central
- hg pull
- hg update
- cd in the mozilla-central repo
- ./mach bootstrap
- choose 2 (firefox desktop)
- choose yes for mercurial optimization
- enter data and say yes to the extensions
- ... wait
- echo 'ac_add_options --enable-project=comm/mail' > mozconfig
- echo 'ac_add_options --enable-debug' >> mozconfig
- enable cache:
- ac_add_options --with-ccache=sccache >> mozconfig
Build & run:
- ./mach build
- ./mach run -P development
Roughly follow https://github.com/rnpgp/rnp/blob/main/docs/installation.adoc
We first build some dependencies via vcpkg since it's easier than to setup and configure each project:
- git clone https://github.com/Microsoft/vcpkg.git
- .\vcpkg\bootstrap-vcpkg.bat
- cd vcpkg
- vcpkg install --triplet x64-windows bzip2 zlib botan json-c getopt dirent python3[core,enable-shared]
- remove python if it fails, not needed (?)
- also remove botan since we build it seperately (3.2.0 release)
Botan:
- git clone https://github.com/randombit/botan.git
- cd botan
- git checkout 3.2.0
- python3 configure.py --cc=msvc --os=windows
- nmake
- nmake check
- (nmake install)
RNP:
- git clone https://github.com/rnpgp/rnp.git
- cd rnp
- git submodule init
- git submodule update
- copy C:\Users\jroth\rnp_for_tb\vcpkg\vcpkg\installed\x64-windows\include to C:\Users\jroth\rnp_for_tb\rnp\include
- somehow this works but setting the respective CMake Variable for include directories didn't.
- PATH=C:\Users\jroth\rnp_for_tb\vcpkg\vcpkg\installed\x64-windows\bin;%PATH%
- it's important to set it at the beginning, otherwise any installed msys2/cygwin/.. installation might be found instead.
cmake -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=off -DCRYPTO_BACKEND="botan" . -DENABLE_CRYPTO:=On -DENABLE_PQC=On -DENABLE_CRYPTO_REFRESH=On -DBOTAN_INCLUDE_DIR=C:\Users\jroth\rnp_for_tb\botan\build\include -DBOTAN_LIBRARY=C:\Users\jroth\rnp_for_tb\botan\botan-3.lib -DBUILD_TESTING=ON -DBUILD_SHARED_LIBS=yes
- cmake --build build --config Release
- If you want to install it system wide run as admin: cmake --install build
- Copy all .dll files (botan, zlib, rnp, ..) to one location.
- add to mozconfig (in mozilla-central dir):
- ac_add_options --with-system-librnp
- build Thunderbird new with ./mach clobber && ./mach build
- before running TB:
- export PATH=$PATH:"/c/Program Files/RNP/bin"
- the path has to contain all necessary .dll files (rnp and dependencies)