Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-03

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

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

patspiper

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

Stephano

Reply by email

Mattias Gaertner
to patspiper

patspiper hat am 15. M?rz 2012 um 12:26 geschrieben:

Show quoted text 33 lines
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.freepascal.org/pipermail/lazarus/attachments/20120315/85d839d2/attachment.html>

Reply by email

patspiper
to Mattias Gaertner
Mattias Gaertner wrote 7 lines
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.

+1

Show quoted text 5 lines
For relaunching use startlazarus: /home/me/Programs/lazarus/lazarus-svn/startlazarus --pcp="/home/me/Programs/lazarus/config-lazarus-svn"

My bad! It relaunches fine now.

Show quoted text 11 lines
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.

+1.

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

I'll stick for the time being to the script as it eliminates the need to set anything in the IDE options.

Show quoted text 8 lines
> - 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).

Great! Once implemented, the script would be reduced to: export LIBOVERLAY_SCROLLBAR=0
export FPC_VER=2.6.1
/home/me/Programs/lazarus/lazarus-svn/lazarus
--pcp="/home/me/Programs/lazarus/config-lazarus-svn"

Show quoted text 8 lines
> > 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.

I already use one config file (which is the pcp). What default are you referring to?

You are a treasure trove of info!

Stephano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120315/9fb4e5d9/attachment.html>

Reply by email

Mattias Gaertner
to patspiper
Show quoted text 5 lines
[...] > The compiler path of the IDE has already a history drop down list. > I'll stick for the time being to the script as it eliminates the need to set anything in the IDE options.

A script requires a restart of the IDE.

Show quoted text 9 lines
> > - 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). > Great! Once implemented, the script would be reduced to: export LIBOVERLAY_SCROLLBAR=0

This needs fixing.

Show quoted text 10 lines
[...] > > 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. > I already use one config file (which is the pcp). What default are you referring to?

The default pcp is ~/.lazarus
If you only need one pcp, why not use the default location?

You are a treasure trove of info!

I have my hours.

Mattias

Reply by email

patspiper
to Mattias Gaertner
Mattias Gaertner wrote 9 lines
On Thu, 15 Mar 2012 22:26:00 +0200 patspiper wrote: > [...] >> The compiler path of the IDE has already a history drop down list. >> > I'll stick for the time being to the script as it eliminates the need to > set anything in the IDE options. A script requires a restart of the IDE.

That's true. If only the fpc executable history dropdown list in the IDE options allowed items to be deleted by pressing the delete key (like in Firefox edit boxes), I would have gone with the option of changing the fpc version using that. Going through the config files to delete undesired entries is a little cumbersome, especially if you fiddle a lot with different installations.

Show quoted text 9 lines
>>> - 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). >> > Great! Once implemented, the script would be reduced to: > export LIBOVERLAY_SCROLLBAR=0 This needs fixing.

I sure hope it is fixed as it is very annoying not to have functional scrollbars especially in the resulting applications.

Show quoted text 11 lines
> [...] >>> 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. >> > I already use one config file (which is the pcp). What default are you > referring to? The default pcp is ~/.lazarus If you only need one pcp, why not use the default location?

I always leave it in case I ever do an install from the Ubuntu repository. My regular Lazarus is from trunk.

Stephano

Reply by email

Mattias Gaertner
to patspiper
Show quoted text 16 lines
On 15/03/12 23:36, Mattias Gaertner wrote: > On Thu, 15 Mar 2012 22:26:00 +0200 > patspiper wrote: > >> [...] >>> The compiler path of the IDE has already a history drop down list. >>> >> I'll stick for the time being to the script as it eliminates the need to >> set anything in the IDE options. > A script requires a restart of the IDE. That's true. If only the fpc executable history dropdown list in the IDE options allowed items to be deleted by pressing the delete key (like in Firefox edit boxes), I would have gone with the option of changing the fpc version using that. Going through the config files to delete undesired entries is a little cumbersome, especially if you fiddle a lot with different installations.

Items that you don't use are at the end.

Show quoted text 7 lines
[...] >> I already use one config file (which is the pcp). What default are you >> referring to? > The default pcp is ~/.lazarus > If you only need one pcp, why not use the default location? I always leave it in case I ever do an install from the Ubuntu repository. My regular Lazarus is from trunk.

An installation does not alter the user config files. Only starting an IDE does.

Mattias

Reply by email