Difference between revisions of "Distributing Lazarus - Installers"

From Lazarus wiki
Jump to navigationJump to search
m (Fixed syntax highlighting)
 
(6 intermediate revisions by 5 users not shown)
Line 13: Line 13:
  
 
The easiest way to get the config files is to start an IDE, setup and install packages and then use the created configs. You should remove everything personal.
 
The easiest way to get the config files is to start an IDE, setup and install packages and then use the created configs. You should remove everything personal.
 +
 +
==environmentoptions.xml==
  
 
Here is an example for the environmentoptions.xml:
 
Here is an example for the environmentoptions.xml:
  
<pre>
+
<syntaxhighlight lang="xml">
 
<?xml version="1.0"?>
 
<?xml version="1.0"?>
 
<CONFIG>
 
<CONFIG>
Line 29: Line 31:
 
   </EnvironmentOptions>
 
   </EnvironmentOptions>
 
</CONFIG>
 
</CONFIG>
</pre>
+
</syntaxhighlight>
  
 
'''Notes:'''
 
'''Notes:'''
Line 36: Line 38:
 
*The other values can use macros.
 
*The other values can use macros.
 
*See [[IDE_Macros_in_paths_and_filenames|Macros]], especially the '''env''' macro.
 
*See [[IDE_Macros_in_paths_and_filenames|Macros]], especially the '''env''' macro.
 +
 +
==Changing/Creating a config file==
 +
 +
<syntaxhighlight lang=pascal>
 +
uses laz2_xmlcfg;
 +
var
 +
  cfg: TXMLConfig;
 +
begin
 +
  cfg:=TXMLConfig.Create('/home/username/.lazarus/environmentoptions.xml');
 +
  try
 +
    cfg.SetDeleteValue('EnvironmentOptions/LazarusDirectory/Value','/home/username/new/path/lazarus','');
 +
    cfg.Flush;
 +
  finally
 +
    cfg.Free;
 +
  end;
 +
end;
 +
</syntaxhighlight>
 +
 +
The IDE saves all file names as relative file names(except for history lists and some minor items). So stop the IDE, change the value in the xml and start the IDE and that's it. The IDE will automatically load the new lpk files, the new fpdoc files, etc.
  
 
=Include third party packages=
 
=Include third party packages=
  
 
If you want to use third party packages, you can put them somewhere and create a '''lpl''' file in '''packager/globallinks'''. You can put the package into the '''components''' directory or at a fixed location on the users machine.
 
If you want to use third party packages, you can put them somewhere and create a '''lpl''' file in '''packager/globallinks'''. You can put the package into the '''components''' directory or at a fixed location on the users machine.
 +
 +
 +
[[Category:Lazarus internals]]

Latest revision as of 08:41, 13 February 2020

This page is for expert users who know how to use/install Lazarus and want to write an installer for a platform.

If you have trouble installing Lazarus see Installation.

Primary and secondary config files

For a multi user environment you can install default config files in the secondary config path. When a user starts the IDE, Lazarus will automatically copy these files to the primary config path. It does not copy all files; it copies each file when needed (i.e. the primary file does not exist).

Config files

All config files are created on the fly. They only contain values that differ from defaults. Note: If they contain more, then it means there is no default or you found a bug.

The easiest way to get the config files is to start an IDE, setup and install packages and then use the created configs. You should remove everything personal.

environmentoptions.xml

Here is an example for the environmentoptions.xml:

<?xml version="1.0"?>
<CONFIG>
  <EnvironmentOptions>
    <Version Value="106"/>
    <LazarusDirectory Value="/usr/share/lazarus"/>
    <CompilerFilename Value="/usr/bin/fpc"/>
    <FPCSourceDirectory Value="/usr/share/fpcsrc/$(FPCVer)/fpc/"/>
    <MakeFilename Value="make"/>
    <TestBuildDirectory Value="/tmp"/>
    <DebuggerFilename Value="/usr/bin/gdb"/>
  </EnvironmentOptions>
</CONFIG>

Notes:

  • LazarusDirectory can not contain any macro.
  • CompilerFilename can use macros, sets the macro CompPath. You can not use the FPCVer macro, because the IDE fetches it from the compiler using the CompilerFilename.
  • The other values can use macros.
  • See Macros, especially the env macro.

Changing/Creating a config file

uses laz2_xmlcfg;
var
  cfg: TXMLConfig;
begin
  cfg:=TXMLConfig.Create('/home/username/.lazarus/environmentoptions.xml');
  try
    cfg.SetDeleteValue('EnvironmentOptions/LazarusDirectory/Value','/home/username/new/path/lazarus','');
    cfg.Flush;
  finally
    cfg.Free;
  end;
end;

The IDE saves all file names as relative file names(except for history lists and some minor items). So stop the IDE, change the value in the xml and start the IDE and that's it. The IDE will automatically load the new lpk files, the new fpdoc files, etc.

Include third party packages

If you want to use third party packages, you can put them somewhere and create a lpl file in packager/globallinks. You can put the package into the components directory or at a fixed location on the users machine.