View Issue Details

IDProjectCategoryView StatusLast Update
0015741LazarusIDEpublic2011-12-01 11:23
ReporterMarco van de VoortAssigned ToMarc Weustink 
PrioritynormalSeveritytweakReproducibilityN/A
Status closedResolutionfixed 
Product VersionProduct Build 
Target VersionFixed in Version0.9.29 (SVN) 
Summary0015741: Lazarusdir settable on commandline [patch]
DescriptionIt would be great for portable app purposes, if the stored lazarusdir (in environment.xml) could be overriden on the cmdline.

While Lazarus can be made to rely on a certain basedir ($Lazarusdir) as much as possible, the location where a stick is mounted (unix) or what drive letter it becomes (Windows) might change.

Having a commandline parameter makes it possible for a starter script to detect the mountpoint and pass it to lazarus.
TagsNo tags attached.
Fixed in Revision24112
LazTarget-
Widgetset
Attached Files
  • lazarusdir.patch (4,023 bytes)
    Index: ide/lazarus.lpi
    ===================================================================
    --- ide/lazarus.lpi	(revision 24087)
    +++ ide/lazarus.lpi	(working copy)
    @@ -31,7 +31,7 @@
         <RunParams>
           <local>
             <FormatVersion Value="1"/>
    -        <CommandLineParams Value="--no-splash-screen"/>
    +        <CommandLineParams Value="--no-splash-screen --lazarusdir=bladieblablabla"/>
             <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
           </local>
         </RunParams>
    Index: ide/lazarusidestrconsts.pas
    ===================================================================
    --- ide/lazarusidestrconsts.pas	(revision 24087)
    +++ ide/lazarusidestrconsts.pas	(working copy)
    @@ -51,6 +51,7 @@
       EnableRemoteControlOpt='--remote-control';
       DebugLogOpt='--debug-log=';
       LanguageOpt='--language=';
    +  LazarusDirOpt ='--lazarusdir=';
     
     resourcestring
       lisErrInvalidOption = 'Invalid option at position %d: "%s"';
    @@ -82,6 +83,7 @@
       lisFileWhereDebugOutputIsWritten =
         'file, where debug output is written to. If it is '+
         'not specified, debug output is written to the console.';
    +  lisLazarusDirOverride = 'directory, to be used as a basedirectory'; 
     
       // component palette
       lisSelectionTool = 'Selection tool';
    Index: ide/lazbuild.lpr
    ===================================================================
    --- ide/lazbuild.lpr	(revision 24087)
    +++ ide/lazbuild.lpr	(working copy)
    @@ -52,6 +52,7 @@
         FBuildIDEOptions: string;
         FBuildRecursive: boolean;
         fCompilerOverride: String;
    +    fLazarusDirOverride : String;
         fCPUOverride: String;
         fOSOverride: String;
         FSkipDependencies: boolean;
    @@ -137,6 +138,7 @@
         property OSOverride: String read fOSOverride write fOSOverride;
         property CPUOverride: String read fCPUOverride write fCPUOverride;
         property CompilerOverride: String read fCompilerOverride write fCompilerOverride;
    +    property LazarusDirOverride: String read fLazarusDirOverride write fLazarusDirOverride;
       end;
     
     var
    @@ -785,6 +787,8 @@
         ExternalTools.OnFreeOutputFilter:=@OnExtToolFreeOutputFilter;
         if CompilerOverride<>'' then
           CompilerFilename:=CompilerOverride;
    +    if LazarusDirOverride<>'' then
    +      LazarusDirectory:=Lazarusdiroverride;
       end;
     end;
     
    @@ -1055,6 +1059,7 @@
         LongOptions.Add('os:');
         LongOptions.Add('cpu:');
         LongOptions.Add('compiler:');
    +    LongOptions.Add('lazarusdir:');
         ErrorMsg:=RepairedCheckOptions('lBrd',LongOptions,Options,NonOptions);
         if ErrorMsg<>'' then begin
           writeln(ErrorMsg);
    @@ -1117,6 +1122,9 @@
         if HasOption('compiler') then
           CompilerOverride := GetOptionValue('compiler');
     
    +    if HasOption('lazarusdir') then
    +      LazarusDirOverride := GetOptionValue('lazarusdir');
    +
       finally
         Options.Free;
         NonOptions.Free;
    Index: ide/main.pp
    ===================================================================
    --- ide/main.pp	(revision 24087)
    +++ ide/main.pp	(working copy)
    @@ -1123,6 +1123,11 @@
         AddHelp([lisCmdLineLCLInterfaceSpecificOptions]);
         AddHelp(['']);
         AddHelp([GetCmdLineParamDescForInterface]);
    +    AddHelp(['']);
    +    AddHelp([LazarusDirOpt,'<directory>']);
    +    AddHelp([BreakString(space+lisLazarusDirOverride, 75, 22)]);
    +    AddHelp(['']);
    +   
         WriteHelp(AHelp.Text);
         AHelp.Free;
         exit;
    @@ -1157,6 +1162,13 @@
             Application.GetOptionValue('language'));
           EnvironmentOptions.LanguageID := Application.GetOptionValue('language');
         end;
    +    if Application.HasOption('lazarusdir') then
    +    begin
    +      debugln('TMainIDE.LoadGlobalOptions overriding Lazarusdir with command line: ',
    +        Application.GetOptionValue('lazarusdir'));
    +      EnvironmentOptions.Lazarusdirectory:= Application.GetOptionValue('lazarusdir');
    +    end;
    +
         TranslateResourceStrings(EnvironmentOptions.LazarusDirectory,
                                  EnvironmentOptions.LanguageID);
     
    
    lazarusdir.patch (4,023 bytes)

Activities

Marco van de Voort

2010-03-18 17:03

manager   ~0035768

Any hints on how to deal with the multiple binaries (startlazarus/lazarus/lazbuild)

Which would need this, and which call others?

2010-03-18 20:03

 

lazarusdir.patch (4,023 bytes)
Index: ide/lazarus.lpi
===================================================================
--- ide/lazarus.lpi	(revision 24087)
+++ ide/lazarus.lpi	(working copy)
@@ -31,7 +31,7 @@
     <RunParams>
       <local>
         <FormatVersion Value="1"/>
-        <CommandLineParams Value="--no-splash-screen"/>
+        <CommandLineParams Value="--no-splash-screen --lazarusdir=bladieblablabla"/>
         <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
       </local>
     </RunParams>
Index: ide/lazarusidestrconsts.pas
===================================================================
--- ide/lazarusidestrconsts.pas	(revision 24087)
+++ ide/lazarusidestrconsts.pas	(working copy)
@@ -51,6 +51,7 @@
   EnableRemoteControlOpt='--remote-control';
   DebugLogOpt='--debug-log=';
   LanguageOpt='--language=';
+  LazarusDirOpt ='--lazarusdir=';
 
 resourcestring
   lisErrInvalidOption = 'Invalid option at position %d: "%s"';
@@ -82,6 +83,7 @@
   lisFileWhereDebugOutputIsWritten =
     'file, where debug output is written to. If it is '+
     'not specified, debug output is written to the console.';
+  lisLazarusDirOverride = 'directory, to be used as a basedirectory'; 
 
   // component palette
   lisSelectionTool = 'Selection tool';
Index: ide/lazbuild.lpr
===================================================================
--- ide/lazbuild.lpr	(revision 24087)
+++ ide/lazbuild.lpr	(working copy)
@@ -52,6 +52,7 @@
     FBuildIDEOptions: string;
     FBuildRecursive: boolean;
     fCompilerOverride: String;
+    fLazarusDirOverride : String;
     fCPUOverride: String;
     fOSOverride: String;
     FSkipDependencies: boolean;
@@ -137,6 +138,7 @@
     property OSOverride: String read fOSOverride write fOSOverride;
     property CPUOverride: String read fCPUOverride write fCPUOverride;
     property CompilerOverride: String read fCompilerOverride write fCompilerOverride;
+    property LazarusDirOverride: String read fLazarusDirOverride write fLazarusDirOverride;
   end;
 
 var
@@ -785,6 +787,8 @@
     ExternalTools.OnFreeOutputFilter:=@OnExtToolFreeOutputFilter;
     if CompilerOverride<>'' then
       CompilerFilename:=CompilerOverride;
+    if LazarusDirOverride<>'' then
+      LazarusDirectory:=Lazarusdiroverride;
   end;
 end;
 
@@ -1055,6 +1059,7 @@
     LongOptions.Add('os:');
     LongOptions.Add('cpu:');
     LongOptions.Add('compiler:');
+    LongOptions.Add('lazarusdir:');
     ErrorMsg:=RepairedCheckOptions('lBrd',LongOptions,Options,NonOptions);
     if ErrorMsg<>'' then begin
       writeln(ErrorMsg);
@@ -1117,6 +1122,9 @@
     if HasOption('compiler') then
       CompilerOverride := GetOptionValue('compiler');
 
+    if HasOption('lazarusdir') then
+      LazarusDirOverride := GetOptionValue('lazarusdir');
+
   finally
     Options.Free;
     NonOptions.Free;
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 24087)
+++ ide/main.pp	(working copy)
@@ -1123,6 +1123,11 @@
     AddHelp([lisCmdLineLCLInterfaceSpecificOptions]);
     AddHelp(['']);
     AddHelp([GetCmdLineParamDescForInterface]);
+    AddHelp(['']);
+    AddHelp([LazarusDirOpt,'<directory>']);
+    AddHelp([BreakString(space+lisLazarusDirOverride, 75, 22)]);
+    AddHelp(['']);
+   
     WriteHelp(AHelp.Text);
     AHelp.Free;
     exit;
@@ -1157,6 +1162,13 @@
         Application.GetOptionValue('language'));
       EnvironmentOptions.LanguageID := Application.GetOptionValue('language');
     end;
+    if Application.HasOption('lazarusdir') then
+    begin
+      debugln('TMainIDE.LoadGlobalOptions overriding Lazarusdir with command line: ',
+        Application.GetOptionValue('lazarusdir'));
+      EnvironmentOptions.Lazarusdirectory:= Application.GetOptionValue('lazarusdir');
+    end;
+
     TranslateResourceStrings(EnvironmentOptions.LazarusDirectory,
                              EnvironmentOptions.LanguageID);
 
lazarusdir.patch (4,023 bytes)

Marco van de Voort

2010-03-18 20:04

manager   ~0035777

Was easier than I thought, patched added.

Marco van de Voort

2010-03-19 12:56

manager   ~0035797

See also http://www.stack.nl/~marcov/Lazarus.bat

(a batchfile that wraps detects current drive, and assumes config is in $lazarusdir/config )

Marc Weustink

2010-03-20 16:07

administrator   ~0035835

I skipped the lazrus.lpi changes. I don't think "bladieblablabla" is a useful default :)
Thanks

Issue History

Date Modified Username Field Change
2010-02-11 22:55 Marco van de Voort New Issue
2010-02-11 22:55 Marco van de Voort LazTarget => -
2010-03-12 10:46 Vincent Snijders Status new => acknowledged
2010-03-18 17:03 Marco van de Voort Note Added: 0035768
2010-03-18 20:03 Marco van de Voort File Added: lazarusdir.patch
2010-03-18 20:04 Marco van de Voort Note Added: 0035777
2010-03-18 20:04 Marco van de Voort Summary Lazarusdir settable on commandline => Lazarusdir settable on commandline [patch]
2010-03-19 12:56 Marco van de Voort Note Added: 0035797
2010-03-20 16:07 Marc Weustink Fixed in Revision => 24112
2010-03-20 16:07 Marc Weustink Status acknowledged => resolved
2010-03-20 16:07 Marc Weustink Resolution open => fixed
2010-03-20 16:07 Marc Weustink Assigned To => Marc Weustink
2010-03-20 16:07 Marc Weustink Note Added: 0035835
2010-03-20 16:09 Marc Weustink Fixed in Version => 0.9.29 (SVN)
2011-12-01 11:23 Marc Weustink Status resolved => closed