[Lazarus] How to use two different versions of FPC

Anthony Walter sysrpl at gmail.com
Sun May 13 04:50:18 CEST 2018


I am not sure if this will help, but I place this script as "setup" in any
fpc directory:

#!/bin/bash

if [ -z ${OLDPATH+x} ]; then
  OLDPATH=$PATH
else
  PATH=$OLDPATH
fi

BASE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export PPC_CONFIG_PATH=$BASE/bin
rm $PPC_CONFIG_PATH/fpc.cfg > /dev/null 2>&1
$PPC_CONFIG_PATH/fpcmkcfg -d basepath=$BASE/lib/fpc/\$FPCVERSION -o
$PPC_CONFIG_PATH/fpc.cfg
export PATH=$PPC_CONFIG_PATH:$OLDPATH

Then when I want to change compilers, I go to the fpc folder with the
version I want to use and execute:

. ./setup

This sources the script setup, and changes the fpc version. Example:

user at debian: fpc
*bash: fpc: command not found*
user at debian: cd $HOME/Development/FreePascal/fpc-trunk
user at debian: . ./setup
user at debian: fpc -iV
*3.1.1*
user at debian: cd $HOME/Development/FreePascal/fpc-3.0.0
user at debian: . ./setup
user at debian: fpc -iV
*3.0.0*

What this script does is save the old path, put the bin folder of fpc in
the path, set the PPC_CONFIG_PATH variable, and generate a new bin/fpc.cfg.
You can then have as many fpc compiler versions as will fit on disk, and
change compilers easily.

So in summary, copy my script above to each fpc folder, name it setup,
chmod +x setup, and . ./setup to change to a specific compiler.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180512/5b24de10/attachment.html>


More information about the Lazarus mailing list