For Linux engine authors

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
hgm
Posts: 28455
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

For Linux engine authors

Post by hgm »

Authors of engines for Linux will in the future be able to make use of a novel mechanism to automatically get their engine incorporated in the XBoard engine list:

by including a line like

xboard -addMasterOption {-installEngine '"Fruit 2.1" -fcp "fruit" -fUCI'} -autoClose || true
xboard -addMasterOption {-installEngine '"Crafty 23.7" -fcp "crafty"'} -autoClose || true

in their Makefile for the make install target, they can cause the mentioned -installEngine option to be appended to the XBoard master settings file. This will notify users that later run XBoard of the fact that a new engine is available, and will add its engine line to their private list of installed engines.

The "|| true" behind the command is to prevent abortion of the make-install process on systems where XBoard is not installed, or where an older XBoard version aborts because it doesn't recognize -addMasterOption as a valid option name.
User avatar
jshriver
Posts: 1372
Joined: Wed Mar 08, 2006 9:41 pm
Location: Morgantown, WV, USA

Re: For Linux engine authors

Post by jshriver »

Very nice feature!
User avatar
hgm
Posts: 28455
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: For Linux engine authors

Post by hgm »

We added another one, for people that want to produce 'theme packages' for XBoard (piece images, board textures, and settings files to activate them). The problem there is that the files have to be copied to XBoard private data files. And the location of these doesn't only differ between Linux distros, but can differ even within a distro, depending on if you have installed XBoard from source or as binary package from the distro repositories. E.g. in Debian systems it can be /usr/share/games/xboard or /usr/local/share/games/xboard.

Everything that comes with the XBoard package itself of course knows where XBoard and its data should be going. The ./configure step takes care of that, and defines symbols like DATADIR that are used in the source to access the data files. But for a 'supplementary package', it should work whether you installed XBoard from source or as binary, and how you install the supplementary package is independent of that.

So we added a 'special option' --show-config that can be used to let the XBoard binary print the value of its DATADIR, and other such parameters, and then exit. 'Special' here means that it cannot be mixed with other options, and is only recognized as first parameter. Similar to --version. The --show-config option can have a value parameter with it, specifying which parameter XBoard will print. E.g. "xboard --show-config Datadir" will cause XBoard to print its DATADIR. Without such a parameter it prints a list of all its config parameters.

This can be used in install scripts of supplementary packages. E.g. in the make-install target of the Makefile, there could be commands like

install -m 0755 `xboard --show-config Datadir`/themes/chu_kanji
cp pieces\*.svg `xboard --show-config Datadir`/themes/chu_kanji

which would invoke XBoard to provide the path name of its data directory, and create a subdirectory themes/chu_kanji there.