misc/building/rnote-windows-build.md
The following instructions assume that the default installation directories were used.
Add the Rust binary directory to the MSYS2 PATH by adding the following line to ~/.bashrc.
export PATH="$PATH:/c/Users/<user>/.cargo/bin"
If you installed Inno Setup, append :/c/Program Files (x86)/Inno Setup 6 to the path as well.
To install dependencies, install just and run the prerequisites-win command inside the MSYS2 terminal
cargo install --locked just
just prerequisites-win
Or run the corresponding prerequisites-win section in the justfile in a MSYS2 terminal manually.
Next, Rust's toolchain needs to be changed.
rustup toolchain install stable-gnu
rustup default stable-gnu
To be able to create symlinks present in the project when its sources are cloned, make sure that the Developer Mode
in Windows is enabled.
It doesn't say it, but it enables permissions for users to create symlinks.
Then clone the repository and initialize the submodules.
git clone -c core.symlinks=true https://github.com/flxzt/rnote
cd rnote/
git submodule update --init --recursive
Or (from the mingw64 terminal):
MSYS=winsymlinks:native git clone https://github.com/flxzt/rnote.git
git submodule update --init --recursive
Verify that you see in /crates/rnote-ui/po the four files zh_CN.po, zh_HK.po, zh_SG.po and zh_TW.po as symlinks
(and not as a text file with a single line inside).
For unknown reasons, libpthread.a and libpthread.dll.a exist in /mingw64/lib/´
and rustc apparently wants to link with both, resulting in "multiple definitions of pthread_..." linker errors.
To solve this (in a very hacky way), rename libpthread.dll.a to libpthread.dll.a.bak.
mv /mingw64/lib/libpthread.dll.a /mingw64/lib/libpthread.dll.a.bak
In the directory that you cloned Rnote into, run the following command to setup meson.
meson setup --prefix=C:/msys64/mingw64 _mesonbuild
Then, the project can be compiled...
meson compile -C _mesonbuild
...and installed.
meson install -C _mesonbuild
The installed binary can now be executed.
It is located at C:\msys64\mingw64\bin\rnote.exe and depends on the environment provided by MSYS2.
It is not portable.
In order to build the installer, run the commands below.
meson compile rnote-gmo -C _mesonbuild
meson compile build-installer -C _mesonbuild
If successful, the generated installer will be located at _mesonbuild/rnote-win-installer.exe.
If you did not install MSYS2 into the default directory (C:\msys64),
then you will have to adjust the meson option called msys-path prior to building.
meson configure -Dmsys-path='C:\path\to\msys64' _mesonbuild
Likewise, you can adjust the output name of the installer using the win-installer-name option
(which defaults to rnote_installer).