This script uses CMake to build a Pidgin 2 (libpurple 2) protocol plug-in in a way that does not suck.
Because having one Makefile for each toolchain is annoying.
On Windows, this script will automatically setup a development environment. These compilers are known to work:
- MSYS2 with gcc 13.2.1.
- Microsoft Visual Studio 2022 with MSVC 14.
These compilers are noteworthy:
- MinGW with gcc 9.2.0 was used in the past.
- MinGW with gcc 4.7.2 is recommended by Pidgin developers, but never used with this script.
Note: Any binary produced by at least gcc 7.1.0 or newer may need static linkage of libgcc
for proper distribution. This script does not take care of this setting.
This script is used in purple-whatsmeow and purple-presage.
-
Configure project. Specify the path to this script:
cmake -DPurple_DIR=…/purple-cmake ..
-
Build project:
cmake --build .
-
Install binaries system-wide:
sudo cmake --install .
Note: During the configuration step, you can override PURPLE_DATA_DIR
and PURPLE_PLUGIN_DIR
request preparing a user-based installation:
cmake -DPurple_DIR=…/purple-cmake -DPURPLE_DATA_DIR:PATH=~/.local/share -DPURPLE_PLUGIN_DIR:PATH=~/.purple/plugins ..
You can then execute cmake --install .
without sudo
.
-
Configure:
This will set-up a development environment including a pidgin installation in your build directory.
cmake -DCMAKE_BUILD_TYPE=Debug ..
-G "MSYS Makefiles"
is recommended for MSYS/MinGW. When omitting the generator, CMake may default to MSBuild and you may need to specify-DCMAKE_GENERATOR_PLATFORM=WIN32
for MSVC x86.Note: You can use vcpkg-managed packages by adding the path like this:
-DCMAKE_TOOLCHAIN_FILE="…/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x86-mingw-static -DVCPKG_MANIFEST_MODE=OFF
Use
x86-mingw-static
for MinGW builds. Usex86-windows-static
for MSVC builds. -
Build:
cmake --build .
-
Install:
This will install into the pidgin installation in your build directory.
cmake --install .
-
Execute:
This will execute the Pidgin installation.
cmake --build . --target run
Note: You can specify the purple user configuration directory to be used by the run target:
-DPurple_CONFIG_DIR=…/.purple
Note: Building on Windows is most reliable when there are no existing installations of Pidgin, GTK+ and/or libgcc in your PATH.