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

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Mar 15 12:43:49 CET 2012


patspiper <patspiper at gmail.com> hat am 15. März 2012 um 12:26 geschrieben:

> 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:
>
> ---------------------------------------
> #!/bin/sh
>
> # Disable Ubuntu's overlay scroll bars which do not work with Lazarus
> export LIBOVERLAY_SCROLLBAR=0
>
> # Specify FPC version
> FPC_VER=2.6.1
>
> # 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
> /home/me/Programs/lazarus/lazarus-svn/lazarus
> --pcp="/home/me/Programs/lazarus/config-lazarus-svn"
> ---------------------------------------
>
> The downside is:
> 1- Having one script per FPC version

> 2- The FPC executable and sources path must be changed in the IDE
options.


You can use macros in the IDE options. For example:
export FPC_VER=2.6.1 && ./lazarus
Then you can use the macro $ENV(FPC_VER) in IDE options.



> 3- Rebuilding Lazarus from within does not relaunch the IDE
automatically.


For relaunching use startlazarus:
/home/me/Programs/lazarus/lazarus-svn/startlazarus
--pcp="/home/me/Programs/lazarus/config-lazarus-svn"



>
> 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).


Normally you set the compiler path to the fpc executable.
The IDE will then get the fpc version from it. So you can use the IDE's
FPCVer macro. For example you can use this macro in the FPC sources
directory.
Changing the compiler will automatically switch the FPC sources.
Changing the target OS of the project automatically switches compiler and
FPC sources.



>[...]I say leave fpc itself locate the actual compiler.


+1



>
> 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.


The compiler path of the IDE has already a history drop down list.



> - Allow the export of environment variables such as the PATH in the
> IDE's options.


Yes, it's a todo to implement run parameters for the compiler (and the
other external tools).



>
> 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.


When you use macros, you only need one pcp and then you can use the
default.

Mattias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120315/85d839d2/attachment-0003.html>


More information about the Lazarus mailing list