[Lazarus] Issue #0020655: Ability to set environment variable at IDE launch

patspiper patspiper at gmail.com
Thu Mar 15 12:26:50 CET 2012

As per Vincent's request, the discussion has been moved from the bug 
tracker to the mailing list.

I will list my vague recollection of the ideas I had for brain storming 
purposes, as I used to cross-compile a lot (it has been some time since 
I haven't!), and switch different FPC versions. I thus devised a script 
that help me switch easily:


# Disable Ubuntu's overlay scroll bars which do not work with Lazarus

# Specify FPC version

# Add to the path the 3 required paths for the full operation of FPC and 
binutils for cross compilation
export PATH=/home/me/Programs/fpc/$FPC_VER/lib/fpc/$FPC_VER:$PATH
export PATH=/home/me/Programs/fpc/$FPC_VER/bin:$PATH
export PATH=/home/me/Programs/fpc/crossbinutils/bin:$PATH

echo $PATH
cd /tmp

The downside is:
1- Having one script per FPC version
2- The FPC executable and sources path must be changed in the IDE options.
3- Rebuilding Lazarus from within does not relaunch the IDE automatically.

Selecting the proper fpc version in the environment options the way it 
is now is difficult as 2 paths have to be edited and changed (once for 
the fpc executable and another for the fpc sources).

I am not sure about manually creating symlinks from 
/home/me/Programs/fpc/2.6.1/bin/ppc386 to 
/home/me/Programs/fpc/2.6.1/lib/fpc/2.5.1/ppc386, as this should be done 
by the FPC install itself if ever. Furthermore, this does not resolve 
how Lazarus will select the correct fpc executable among the different 
versions. I say leave fpc itself locate the actual compiler.

My proposal is:
- Add to the IDE's option a dropdown list where one can add versions and 
select the required one which will be used as an FPC_VER macro.
- Allow the export of environment variables such as the PATH in the 
IDE's options.

This will not solve downside #3, as a script is still needed for the 
--pcp option and the overlay scrollbars issue, but it will make 
switching FPC versions a breeze.


More information about the Lazarus mailing list