Suppose the system administrator has installed the SWI-Prolog runtime environment in /usr/local/lib/rt-pl-2.1.4. A user wants to install gnat, but gnat will look for its configuration in /usr/local/lib/rt-pl-2.1.4/gnat where the user cannot write.
The user decides to install the gnat runtime files in /users/bob/lib/gnat. For one-time usage, the user may decide to start gnat using the command:
% gnat -p gnatdir=/users/bob/lib/gnat
For a more widely used executable, this is not very comfortable. The user may decide to edit the shell-script part of gnat. Upto the line holding
# End Header
gnat is a simple /bin/sh script. After this line, the file is
binary and may contain long lines. Most editors are not capable of
editing such files.
Instead of editing the file directly, the program chpl may be
used to extract and replace the header of gnat. The following
editing sequence will work with any editor capable of editing ascii
files.
% chpl -x gnat > gnat.hdr % emacs gnat.hdr % chpl -h gnat.hdr gnat
The header may be changed to the following to install gnat properly:
#!/bin/sh # SWI-Prolog version: 2.1.4 # SWI-Prolog save-version: 25 exec ${SWIPL-/usr/local/lib/rt-pl-2.1.4/bin/pl} -x $0 \ -p gnatdir=/users/bob/lib/gnat "$@"