Skip to content

Add support for a new tool or mod

McArcady edited this page Sep 19, 2020 · 2 revisions

Scripting the recipe for a new utility

To add support for new utility, create a new script here:
scripts/build/mytool.sh

Taking example on script/build/announcement.sh (installation script for Announcement Window), the main functions are:
do_mytool_get: recipe for downloading the archive or getting the source code from git (hg also supported)
do_mytool_extract: recipe for extracting the archive
do_mytool_build: recipe for building and installing the tool from code, or only installing if no compilation is necessary

Do not forget to declare your tool in ${get_lnp_dir}/LNP/Utilities/utilities.txt at the end of do_mytool_build, so that it appears in the LNP interface.

The other functions do_mytool_* are mandatory too but pretty straightforward: they provide description, credits, licence information...

Scripting the recipe for a mod

To add support for a mod, take example on script/build/dark.sh (installation script for the Dark Ages mod).

Declaring the new tool/mod in .config

The option will be identified by variable CT_MYTOOL, and automatically associated to the functions in mytool.sh. To activate the new script, add 'mytool' in CT_STEPS in steps.mk (preferably at the end, right before 'appimage, debian, ...' which are the options that perform the final packaging).

Add a new file:
config/mytool.in (taking example on config/announcement.in)
and include the config option in:
config/config.in

Testing

Modifications will be active after:
autoconf && ./configure --prefix=$PWD && make install

The new option will appear in:
bin/lnp-forge menuconfig

Finally test the new recipe with:
bin/lnp-forge build

Debugging

.build.log provides a log of execution of the scripts. Use decorators like CT_DoExecLog in your script so that everything gets logged properly.
The target directory for the game and tools (root directory of the final package), is the PyLNP source directory: .build/src/lnp-0.14a/