Difference between revisions of "Getting Lazarus"

From Free Pascal wiki
Jump to navigationJump to search
m (filling make targets)
 
(190 intermediate revisions by 26 users not shown)
Line 1: Line 1:
 
{{Getting Lazarus}}
 
{{Getting Lazarus}}
  
== Downloading releases ==
+
==Download and install Lazarus release version==
  
 
=== From SourceForge ===
 
=== From SourceForge ===
  
Binary releases for various platforms are also available via the [http://sourceforge.net/project/showfiles.php?group_id=89339 Lazarus Sourceforge download area].
+
Binary releases for various platforms are available via the [https://sourceforge.net/projects/lazarus/files/ Lazarus Sourceforge download area].
  
=== Getting Lazarus from our Ubuntu repository ===
+
For people who are blocked by SF, the Lazarus releases from Sourceforge are mirrored at:
 +
*ftp://ftp.freepascal.org/pub/lazarus/releases/
 +
*and later at (after some time for synchronization) http://michael-ep3.physik.uni-halle.de/Lazarus/releases/
 +
*and http://mirrors.iwi.me/lazarus/
  
On www.hu.freepascal.org there is a Ubuntu repository with Lazarus and FPC debs.
+
=== Specific for platform ===
  
==== Short version: get Lazarus ====
+
Get Lazarus for Windows - use the Sourceforge link above.
  
In the sections that follow, there's a complete list of the commands you need to type at the console to download and install Lazarus on an Ubuntu system. If you're impatient, this section will just give you what you need to get it installed without going through every part of the process line by line.
+
[[ReactOS|Get Lazarus for ReactOS]]
  
Select and copy the following script, and save it as a file in your home directory named '''getlaz''':
+
[[Lazarus release version for Ubuntu|Get Lazarus for Ubuntu]]
  
  <nowiki>#!/bin/sh</nowiki>
+
[[Install_on_Fedora|Get Lazarus for Fedora]]
  <nowiki>gpg --keyserver hkp://pgp.mit.edu:11371 --recv-keys 6A11800F</nowiki>
 
  <nowiki>gpg --export 6A11800F | apt-key add -</nowiki>
 
  <nowiki>echo "deb http://www.hu.freepascal.org/lazarus/ lazarus-stable universe" \</nowiki>
 
  <nowiki>    >/etc/apt/sources.list.d/lazarus.list</nowiki>
 
  <nowiki>apt-get update</nowiki>
 
  <nowiki>apt-get install lazarus</nowiki>
 
  
At the shell prompt, type this to prepare the script for execution, and to execute it (you can copy these lines and paste them into your shell using Shift+Insert):
+
[[Lazarus release version for Suse|Get Lazarus for Suse]]
  
  <nowiki>chmod +x getlaz</nowiki>
+
[[Scientific Linux|Get Lazarus for Scientific Linux]]
  <nowiki>sudo ./getlaz</nowiki>
 
  
The process will download around 100Mb of data from the Lazarus repository and the standard ones.  It will take at least five minutes, even with a fast connection.  Any time it stops to ask for confirmation of any step, answer "Y" for yes.
+
[[Lazarus on Raspberry Pi|Get Lazarus for Raspberry Pi (Raspbian)]]
  
When it finishes and returns to the shell prompt, you're set.  Look in the "Development" section of your Ubuntu menu; Lazarus will be there and functional.
+
[[Installing Lazarus on macOS|Get Lazarus for Mac]]
  
==== Long version: step by step ====
+
[[Lazarus on Solaris]]
Now, for completists, here's the same instruction step by step.  You can ignore it if you followed the above instructions successfully.  Please remember to come back to the wiki and put in any tested, reliable changes that might clarify this section!
 
  
===== Add the key =====
+
== Getting a Git client ==
  
Download the key from the public key server:
+
=== TortoiseGit client ===
  gpg --keyserver hkp://pgp.mit.edu:11371 --recv-keys 6A11800F
 
  
Add it to the apt system:
+
TortoiseGit Client is for Windows only. You may download it from https://tortoisegit.org/
  gpg --export 6A11800F | sudo apt-key add -
 
  
You can see the list of apt keys with:
+
=== Git for Windows ===
  sudo apt-key list
 
  
===== Add the repository =====
+
Command line clients:
  
You can use synaptic for this or edit the /etc/apt/sources.list directly. For the stable repository, add the line:
+
https://gitforwindows.org/
  <nowiki>deb http://www.hu.freepascal.org/lazarus/ lazarus-stable universe</nowiki>
+
https://git-scm.com/download/win
Or using a console app. do:
 
  <nowiki>echo "deb http://www.hu.freepascal.org/lazarus/ lazarus-stable universe">/etc/apt/sources.list.d/lazarus.list</nowiki>
 
For the testing repository:
 
  <nowiki>deb http://www.hu.freepascal.org/lazarus/ lazarus-testing universe</nowiki>
 
Or similarly, using a console app. do:
 
  <nowiki>echo "deb http://www.hu.freepascal.org/lazarus/ lazarus-testing universe">/etc/apt/sources.list.d/lazarus.list</nowiki>
 
Note that trying the echo command you may get "bash: /etc/apt/sources.list.d/lazarus.list: Access denied" and the same with sources.list, even with sudo. Fortunately manually editing the file also works in this case.
 
  
===== Install Lazarus =====
+
=== Other clients ===
  
Now You can install Lazarus with apt:
+
A GIT command line client is available from https://git-scm.com/downloads for many platforms.
  <nowiki>sudo apt-get update; apt-get install lazarus</nowiki>
 
  
=== Install Lazarus on Fedora ===
+
On Linux, it is recommended to install ''git'' using the package management system offered by your distribution. For example:
  
Lazarus is part of the standard Fedora-repositories since Fedora version 9. You can install it using the command-line ('yum install lazarus') or by using the 'add/remove software' wizard. If you want to install Lazarus during the installation of Fedora, you have to enable the additional repositories during install.
+
sudo apt-get install git
  
Once installed you can find Lazarus in the 'Applications/Programming' menu.
+
==Getting Lazarus from the GitLab server==
  
Note that if you want to develop gtk2 applications, you also have to install 'gtk2-devel'.
+
===Development version of Lazarus===
 +
To get Lazarus for the first time, using command line:
 +
  <nowiki>git clone https://gitlab.com/freepascal.org/lazarus/lazarus.git lazarus</nowiki>
 +
A new directory "lazarus" is then created under the current directory.
  
== Development versions from SVN ==
+
===Fixes branch of latest Lazarus release===
=== Getting SVN ===
 
You may download a SVN Client for Windows in http://tortoisesvn.tigris.org/
 
A SVN command line client is available from the official SVN [http://subversion.tigris.org/ website] for many platforms.
 
  
On Linux, it is recommended to install subversion using the package management system offered by your distribution.
+
Change into the directory created by the above '''git clone''' command and run
 +
  <nowiki>git switch  fixes_2_2</nowiki>
  
=== Using SVN ===
+
Amending the name of the branch according to what fixes version you want.
 +
Get a list with
 +
  <nowiki>git branch --all</nowiki>
 +
The output will contain lines similar to
 +
  <nowiki>remote/origin/fixes_2_2</nowiki>
 +
The name of the branch is just the last part.
  
==== Using the command line ====
 
  
To get Lazarus for the first time:
+
===Update the sources later===
 
 
Open a terminal/command prompt, change to the directory you wish the Lazarus folder to be created in and type:
 
  <nowiki>svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus</nowiki>
 
 
 
To update Lazarus sources:
 
  
 
Open a terminal/command prompt, change to the lazarus directory and type:
 
Open a terminal/command prompt, change to the lazarus directory and type:
   svn update
+
   git switch main
 +
  git pull
  
==== Alternative URLs ====
+
instead of main, you may want to specify a fixes branch.
Sometimes the URL of repository given above does not work, because between the svn server there is a http-proxy server. That server usually claims to be a 'transparent' proxy, but still doesn't pass your svn commands correctly to the svn.freepascal.org server.
 
  
The svn.freepascal.org server also listens on port 8080. Maybe the proxy doesn't interfere with http trafic on that port, so you can try:
+
For compiling see [[#Compiling_and_running_Lazarus|this]].
<nowiki>svn co http://svn.freepascal.org:8080/svn/lazarus/trunk lazarus</nowiki>
 
  
The Lazarus svn repostory is mirrored on sourceforge with a delay of 15 minutes using [[fpsvnsync]]. The sourceforge repository uses the https protocol. Proxy servers usually don't interfere with that protocol. You can check out form sourceforge using the following command
+
==Scripts==
<nowiki>svn co https://svn.sourceforge.net/svnroot/lazarus/trunk lazarus</nowiki>
 
  
The FPC and Lazarus svn repostories are also mirrored to svn2.freepascal.org. You can check out from svn2.freepascal.org with
+
There are scripts for Windows and Linux to automate downloading and building Lazarus: [[LazarusScripts|Scripts for Lazarus]]
<nowiki>svn co http://svn2.freepascal.org/svn/lazarus/trunk lazarus</nowiki>
 
  
If you own the proxy server, or are friends with the person who does, there are details of setting up a proxy to pass svn commands here: http://subversion.tigris.org/faq.html#proxy This contains an example for squid.  Remember to set up the client to use the proxy !  (For TortoiseSVN, see settings/network)
+
==Compiling and running Lazarus==
  
==== Using TortoiseSVN for Windows ====
+
See [[Installing Lazarus]] - a detailed installation guide.
TortoiseSVN integrates itself with Windows Explorer. After installation, all commands are available from inside Windows Explorer through right-clicking on a directory or file.
 
  
Check out a working copy using TortoiseSVN, go to Run and paste the command below:
+
===Using the command-line===
<nowiki>tsvn:http://svn.freepascal.org/svn/lazarus/trunk</nowiki>
 
  
To get Lazarus for the first time:
+
Lazarus is shipped with an autogenerated '''Makefile''' (of the name "Makefile") for the gnu "'''make'''" utility.
 +
{{Warning|If you also have Embarcadero (or Borland) tools installed, their "make" might conflict with gnu "make". In that case you can either delete or rename the conflicting Embarcadero binary, or remove its directory from Windows PATH, or set the path in the console before calling ''make'':
 +
<pre>
 +
set path=c:\pascal\3.2.0\bin\i386-win32;%path%
 +
</pre>
 +
}}
  
* Open Windows Explorer
+
{{Warning|"make" may also fail, if you have a shell (such as sh.exe) in your path. It depends on how this shell interprets quotes and backslashes.
* Create a directory where you want to put the files from the SVN server
+
}}
* Right click on the newly created directory
 
* Select ''SVN Checkout...'' on the popup menu
 
  
[[Image:TortoiseSVN_Main_Menu.png]]
+
'''make''' allows you to compile Lazarus from command-line easily. You need to have fpc and fpc-packages installed and configured first.
  
* In the next dialog you enter the URL for Lazarus server source:
+
To compile go to Lazarus directory in your terminal and type
<nowiki>http://svn.freepascal.org/svn/lazarus/trunk</nowiki>
+
  '''make'''
* Watch how TortoiseSVN imports the file tree from the server. This can take some time to complete.
 
  
 +
This should rebuild LCL and Lazarus IDE with basic packages installed.
  
To update Lazarus sources:
+
Another useful command is
 +
  '''make bigide'''
 +
which adds the same packages that the release version has.
  
* Open Windows Explorer
+
Then you can run Lazarus from within the same source directory with command "lazarus" (in Unix systems "./lazarus").
* Right click on the source directory
 
* Select ''SVN Update'' on the popup menu
 
  
[[Image:TortoiseSVN_Main_Menu_Update.png]]
+
In case you want to run several versions, you can direct lazarus to use use specific configuration directories via the --pcp option, e.g. :
 +
lazarus --pcp=/home/YOU/myLaz19
  
==== Scripts ====
+
===Make targets===
 +
====make help====
  
[[user:Lightning|Lightning]]:
+
To see a list of available targets for '''''make''''' type [[make help]]. Note: "'''make help'''" exists since 1.0. Here is the output of "'''make help'''":
Here is a windows batch script that takes care of checking out and updating '''Lazarus''' from '''SVN''' to a subdirectory and even basic error fixing, because i have no way of knowing where Lazarus is installed it cannot compile or copy the files to your working Lazarus instalation.
 
Please save the script as '''getlaz.bat''' or some other name, however there is no warranty of any kind, use at your own risk, put it in a test directory first and make sure there is no subdirectory already called '''lazarus'''.
 
  
@echo off
 
REM Script for checkout and update Lazarus from SVN
 
echo.
 
 
REM Check if lazarus directory exists to update or checkout first
 
if exist lazarus (
 
echo Updating Lazarus, please wait ...
 
cd lazarus
 
svn update
 
if %errorlevel% NEQ 0 goto CleanupLaz
 
cd ..
 
goto Exit
 
)
 
 
echo Checking out Lazarus for the first time, this might take a while ...
 
svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus
 
goto Exit
 
 
:CleanupLaz
 
echo.
 
echo Something went wrong, trying to fix any problems if possible  ...
 
svn cleanup
 
if %errorlevel% NEQ 0 (
 
cd ..
 
echo.
 
echo Cleanup Failed ! Please check or delete/move/rename the lazarus subdirectory ...
 
goto Exit
 
)
 
 
cd ..
 
echo.
 
echo Cleanup complete please run the script again.
 
:Exit
 
  
 +
<syntaxhighlight  lang="bash">
 +
make help
  
[[user:Matthijs|Matthijs]]:
+
Main targets
In Linux I use a script (it is not very sophisticated, but does the trick) to download the latest SVN-version for Lazarus. Before I copy it here I'll explain my system.
+
                  Without any target, target 'all' will be invoked.
In my home-directory I have a special cvsroot-directory. In this directory I have a script for downloading Lazarus and other interesting projects. Lazarus is installed in /usr/share/lazarus. Before building a new version from SVN I make a backup, just in case the current svn is unstable. This is done by moving the /usr/share/lazarus directory to /usr/share/lazarus.bu
+
  all            build all needed, i.e. minimal IDE, lazbuild, startlazarus.
To adapt the script to your system you only need to alter the constants defined at the start of the script.
+
  clean          deletes files that 'bigide' creates. It does not clean up all possible
But without further ado, here is the script. But (big but) it is given without any guarantee. :) If things break you are on your own.
+
                  targets. Clean other target: make clean LCL_PLATFORM=qt
 +
  distclean      Clean all targets and common leftovers.
 +
  lazbuild      build lazbuild and lcl with nogui widgetset
 +
  bigide        as all, except that the IDE is built with a lot of extra packages
 +
  useride        calls lazbuild to build an IDE with your active profile, requires lazbuild
 +
  install        installs Lazarus under /usr/local/share/lazarus
 +
                  You can change the directory by appending INSTALL_PREFIX=/some/path
  
  #!/bin/bash
+
  Sub targets
+
  registration  build package FCL
# before you can use this script you have to checkout all files
+
  lazutils      build package LazUtils, requires registration
# so first do a
+
  codetools      build package CodeTools, requires lazutils
# svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus
+
  lcl            build package LCLBase and LCL, requires lazutils
+
  tools          build lazres, svn2revisioninc, updatepofiles, lrstolfm,
  #Define some directories
+
                  requires LCL with nogui widgetset
BASEDIR=/usr/share/
+
  basecomponents build debuggerintf, lazdebuggergdbmi, lazcontrols, synedit, ideintf
LAZCVSDIR=~/cvsroot/lazarus/
+
                  for the LCL_PLATFORM, requires lcl
LAZDIR=/usr/share/lazarus/
+
  bigidecomponents build many extra packages for the LCL_PLATFORM, requires basecomponents
LAZBACKUP=/usr/share/lazarus.bu
+
  lhelp          build lhelp, requires bigidecomponents
+
  starter        build startlazarus, requires basecomponents
#Remove old backup if it exists
+
  examples      build basic examples, requires basecomponents                                                                                                       
  date +"%T %tStart"
+
                  Note: There are more examples having their own directory                                                                                           
if [ -d $LAZBACKUP ]
+
                                                                                                                                                                     
  then
+
  Flags:                                                                                                                                                               
   date +"%T %tRemoving old backup"
+
  PP=/path/to/fpc        use another compiler                                                                                                                       
   rm $LAZBACKUP -fr
+
  USESVN2REVISIONINC=0  do not update ide/revision.inc                                                                                                             
else
+
  INSTALL_PREFIX=/usr   used by 'install' as path prefix                                                                                                           
  date +"%T %tNo backup to remove"
+
  FPC_DIR=/usr/share/fpcsrc/3.0.4  used by fpcmake when regenerating Makefiles                                                                                     
  fi
+
  OPT='-vwnbq -gh'      append these options when calling the compiler                                                                                             
   
+
                                                                                                                                                                     
  date +"%T %tCreating copy of lazarus dir"
+
  Usage examples:                                                                                                                                                     
cp -R $LAZDIR $LAZBACKUP
+
                                                                                                                                                                     
   
+
  Update svn and build a minimal IDE, startlazarus and lazbuild:                                                                                                     
#Getting stuff from svn
+
   make clean                                                                                                                                                         
date +"%T %tUpdate lazarus"
+
   svn up                                                                                                                                                             
svn update lazarus > ~/cvs_update.log
+
  make clean all                                                                                                                                                     
+
                                                                                                                                                                     
#Copying cvs-files to our laz dir.
+
  Note: You can start lazarus with 'startlazarus'                                                                                                                     
date +"%T %tcopying files"
+
  Note: Use the IDE or lazbuild to compile your projects/packages.                                                                                                     
  cp -Rf $LAZCVSDIR $BASEDIR --reply=yes
+
                                                                                                                                                                     
+
  Update svn and build an IDE with your last set of packages:                                                                                                       
#Make and building of lazarus
+
  make clean                                                                                                                                                         
date +"%T %tmake lazarus"
+
  svn up                                                                                                                                                             
cd $LAZDIR
+
  make clean lazbuild useride                                                                                                                                       
make > /dev/null
+
                                                                                                                                                                     
date +"%T %tmake the packages"
+
  Clean up:                                                                                                                                                           
make idepkg > /dev/null
+
  There is no command to clean up a svn repository completely, but                                                                                                   
date +"%T %tFinished"
+
  you can use the following command under Linux/OS X:                                                                                                                 
 +
  svn status | grep '\?' | sed -e 's/\? *//' | xargs rm -r                                                                                                           
 +
                                                                                                                                                                     
 +
  Another possibility is to create a clean copy via the svn export command.                                                                                          
 +
                                                                                                                                                                     
 +
  Install:                                                                                                                                                             
 +
  Note: You can use Lazarus without installing. Just start the lazarus executable.                                                                                   
 +
  1. Build Lazarus as normal user with one of the above commands.                                                                                                   
 +
  2. Install as root into /usr                                                                                                                                       
 +
          sudo make install
 +
      This installs startlazarus, lazarus-ide, lazbuild under /usr/bin
 +
      and copies the whole lazarus source directory to /usr/share/lazarus
  
=== Installing the compiler ===
+
</syntaxhighlight>
  
[[user:Jouke|Jouke]]: If you are starting from scratch with the above, you won't have the FPC compiler installed. In other words the compiler is not included in the Lazarus SVN. It is possible to use a SVN version of FPC also, but generally it is better to use the latest stable release (at this moment v2.2.4). In my opinion it is preferable to try to rebuild the directory structure of a standard Lazarus install. Here is how I installed it (on WinXP):
+
===Make parameters===
 +
There are additional parameters which can be used to '''make''' Lazarus. See a fully working example above.
  
* Download the binary for your system from this page: http://www.freepascal.org/download.html.
+
* '''OPT'''=%compiler_switches
* Also download the source code from the same page.
+
the %compiler_switches is passed to each fpc call. The option is useful for specifying defines
* Install the binaries by running a 'full install' and accepting all defaults.
 
* Unpack the source files to the same directory as the binaries (c:\fpc\2.2.4\).
 
* In your base Lazarus directory, create two new directories: 'pp' and 'fpcsrc'.
 
* From the fpc directory c:\fpc\2.2.4\, select the directories 'bin, 'msg' and 'units' and copy them completely into the 'pp' directory you just created.
 
* From the fpc source directory c:\fpc\2.2.4\fpc\, select the directories 'fcl', 'rtl' and 'packages'. Copy these three directories to the directory 'fpcsrc'.
 
* While leaving out all directories which were already there and also leaving out the underlying directories, the Lazarus tree should now look like this:
 
  C:\Lazarus\pp\bin
 
                \msg
 
                \units
 
            \fpcsrc\fcl
 
                    \packages
 
                    \rtl
 
* If you want, you can now delete the fpc sources and uninstall the fpc binaries.
 
* Make sure the new path to the ppc386 executable is in your environment.
 
* From the C:\lazarus\tools\install\win32 directory copy the file 'samplefpc.cfg' to the C:\lazarus\pp\bin\i386-win32 directory and rename it to fpc.cfg (first delete/rename the old fpc version).
 
* Edit this file and replace all occurencies of '$1' by 'C:\lazarus\pp'.
 
 
 
That's it. You should now be able to make Lazarus and start using it!
 
 
 
== Development versions from Git ==
 
There is a [[git mirrors|Git mirror]] of the official SubVersion repository being maintained on [http://github.com/ GitHub]. This mirror gets sync'ed every 15 minutes with the SubVersion repository. For more information on getting [http://git-scm.com/ Git] and cloning the Lazarus repository, follow this link:  [[git mirrors|Git Mirrors]]
 
 
 
== Daily Snapshot method ==
 
If you don't want to use svn directly, you can try a daily snapshot. For a list of mirrors see the [[Lazarus Snapshots Downloads]] page.
 
 
 
==Browse the Source Repository with a Web Browser==
 
 
 
The contents of the SVN archive can also be browsed with your web-browser through [http://www.freepascal.org/cgi-bin/viewcvs.cgi/?root=lazarus this viewcvs] interface.
 
 
 
==Lazarus Distributions==
 
 
 
There are some unofficial sites where you can find Lazarus and Free Pascal too:
 
 
 
*You can get a Ubuntu LiveCD from Austrian University of Applied Sciences hosting
 
http://www.sigma-server.com/liveCD/Ubuntu-7.10-NTC-Lazarus.iso
 
and md5sum file is here http://www.sigma-server.com/liveCD/Ubuntu-7.10-NTC-Lazarus.iso.md5.
 
 
 
==Compiling and installing Lazarus==
 
 
 
See [[Installing Lazarus]] - An installation guide.
 
 
 
===Building from command-line===
 
 
 
Lazarus is shipped with Makefile for gnu make util. (Be warn, if you're also have Codegear(or Borland) tools installed, it might conflict with gnu "make" util).
 
 
 
The tool allows you to compile the lazarus from command-line easily.
 
You need to have fpc and fpc-packages installed and configured first.
 
 
 
 
 
To compile the goto Lazarus directory in your terminal and type
 
  make
 
 
 
This should rebuild LCL and Lazarus IDE (with basic packages installed).
 
 
 
 
 
===Make targets===
 
Following compiling targets can be specified for the make tool:
 
 
 
* '''clean'''
 
The command will clean all compiled LCL and IDE units. Warning, this might make your project uncompilable (even though IDE still run, since binary is not deleted)
 
  
 
For example:
 
For example:
   make clean
+
   make bigide OPT="-dNoGdkPixBufLib -gw2"
 +
makes LCL and ide with NoGdkPixBufLib defined and dwarf2 debug info.
  
* '''bigide'''
+
* '''LCL_PLATFORM'''=%platform
the command rebuilds LCL and IDE with additional packages.
+
%platform is the target [[Widgetset|widgetset]]. It can be win32,wince,gtk,gtk2,qt,carbon,cocoa,customdrawn.
  
 
For example:
 
For example:
   make bigide
+
   make LCL_PLATFORM=gtk2
 +
Rebuilds LCL and IDE for gtk2 widgetset
  
* '''lcl'''
+
* '''FPC'''=%compiler_path
the command rebuild LCL only. IDE is left untouched. The command is very useful if you're making changes to LCL and need to test the changes on your project without breaking Lazarus. Rebuild LCL only is faster than rebuilding both LCL and IDE
+
or
 +
* '''PP'''=%compiler_path
 +
%compiler_path is the path+filename to a custom compiler binary you want to build the target with.
  
For example:
+
such as:
  make lcl
 
  
* '''components'''
+
make FPC="~/Pfad/fpc"
* '''packager/registration'''
 
* '''ideintf'''
 
* '''packager'''
 
* '''bigidecomponents'''
 
* '''ide'''
 
* '''idepkg'''
 
* '''idebig'''
 
* '''bigide'''
 
* '''starter'''
 
the command rebuilds startlazarus binary.
 
  
* '''lazbuilder'''
+
==Browse the Source Repository with a Web Browser==
* '''tools'''
 
* '''all'''
 
* '''cleanide'''
 
* '''purge'''
 
* '''examples'''
 
the command rebuilds examples lazarus
 
* '''install'''
 
* '''lazbuild'''
 
  
 +
The contents of the GIT repro can also be browsed with your web-browser through [https://gitlab.com/freepascal.org/lazarus/lazarus/-/tree/main interface].
  
If no target is specified LCL and IDE Lazarus (with basic set of components) is rebuilt.
+
==Lazarus Distributions==
  
===Make parameters===
+
There are some unofficial sites where you can find Lazarus and Free Pascal too:
There're also additional parameters, can be used for 'making' Lazarus.
 
  
* '''OPT'''=%compiler_switches
+
*[http://newpascal.org NewPascal] is a curated distribution for Windows, which doesn't require an installer and implements some new features. (Is very out-of-date)
the %compiler_switches is passed to each fpc call. The option is useful for specifying defines
+
*The [http://www.getlazarus.org getlazarus] distribution bundles cutting-edge versions of Lazarus with easy-to-use setup scripts for several platforms and additional components.
 +
*[https://freesparta.com/ FreeSparta] is a commercial distribution of Lazarus for Windows.
 +
*You can get a Ubuntu LiveCD from Austrian University of Applied Sciences hosting http://www.sigma-server.com/liveCD/Ubuntu-7.10-NTC-Lazarus.iso and md5sum file is here http://www.sigma-server.com/liveCD/Ubuntu-7.10-NTC-Lazarus.iso.md5.
 +
*The [http://www.pilotlogic.com CodeTyphon] distribution bundles Lazarus with additional packages and components.
 +
*[https://github.com/x2nie/LiteZarus LiteZarus] is a Lazarus distro intended for designing creating non-LCL projects.
 +
*Lazarus is available on CDs and USB sticks from the [http://www.blaisepascal.eu Blaise Pascal Magazine] store.
  
For example:
+
== See also ==
  make bigide OPT="-dNoGdkPixBufLib -gw2"
 
makes LCL and ide with NoGdkPixBufLib defined and dwarf2 debug info.
 
  
* '''LCL_PLATFORM'''=%platform
+
* [http://forum.lazarus.freepascal.org/index.php/topic,36347.msg242123.html#msg242123 Forum: Explanation of trunk installation in Windows]
%platform is the target Widgetset. It can be win32,gtk,gtk2,qt,carbon or cocoa.
 
 
 
For example:
 
  make LCL_PLATFROM=gtk2
 
Rebuilds LCL and IDE for gtk2 widgetset
 
  
==Original contributors and changes==
 
  
This page has been converted from the epikwiki [http://lazarus-ccr.sourceforge.net/index.php?wiki=GettingLazarus version].
+
[[Category:Lazarus]]
 +
[[Category:Install]]

Latest revision as of 06:08, 4 August 2021

Deutsch (de) English (en) español (es) français (fr) 日本語 (ja) polski (pl) português (pt) русский (ru) slovenčina (sk)

Download and install Lazarus release version

From SourceForge

Binary releases for various platforms are available via the Lazarus Sourceforge download area.

For people who are blocked by SF, the Lazarus releases from Sourceforge are mirrored at:

Specific for platform

Get Lazarus for Windows - use the Sourceforge link above.

Get Lazarus for ReactOS

Get Lazarus for Ubuntu

Get Lazarus for Fedora

Get Lazarus for Suse

Get Lazarus for Scientific Linux

Get Lazarus for Raspberry Pi (Raspbian)

Get Lazarus for Mac

Lazarus on Solaris

Getting a Git client

TortoiseGit client

TortoiseGit Client is for Windows only. You may download it from https://tortoisegit.org/

Git for Windows

Command line clients:

https://gitforwindows.org/ https://git-scm.com/download/win

Other clients

A GIT command line client is available from https://git-scm.com/downloads for many platforms.

On Linux, it is recommended to install git using the package management system offered by your distribution. For example:

sudo apt-get install git

Getting Lazarus from the GitLab server

Development version of Lazarus

To get Lazarus for the first time, using command line:

 git clone https://gitlab.com/freepascal.org/lazarus/lazarus.git lazarus

A new directory "lazarus" is then created under the current directory.

Fixes branch of latest Lazarus release

Change into the directory created by the above git clone command and run

 git switch  fixes_2_2

Amending the name of the branch according to what fixes version you want. Get a list with

 git branch --all

The output will contain lines similar to

 remote/origin/fixes_2_2

The name of the branch is just the last part.


Update the sources later

Open a terminal/command prompt, change to the lazarus directory and type:

 git switch main
 git pull 

instead of main, you may want to specify a fixes branch.

For compiling see this.

Scripts

There are scripts for Windows and Linux to automate downloading and building Lazarus: Scripts for Lazarus

Compiling and running Lazarus

See Installing Lazarus - a detailed installation guide.

Using the command-line

Lazarus is shipped with an autogenerated Makefile (of the name "Makefile") for the gnu "make" utility.

Warning-icon.png

Warning: If you also have Embarcadero (or Borland) tools installed, their "make" might conflict with gnu "make". In that case you can either delete or rename the conflicting Embarcadero binary, or remove its directory from Windows PATH, or set the path in the console before calling make:

 set path=c:\pascal\3.2.0\bin\i386-win32;%path%

Warning-icon.png

Warning: "make" may also fail, if you have a shell (such as sh.exe) in your path. It depends on how this shell interprets quotes and backslashes.

make allows you to compile Lazarus from command-line easily. You need to have fpc and fpc-packages installed and configured first.

To compile go to Lazarus directory in your terminal and type

 make

This should rebuild LCL and Lazarus IDE with basic packages installed.

Another useful command is

 make bigide

which adds the same packages that the release version has.

Then you can run Lazarus from within the same source directory with command "lazarus" (in Unix systems "./lazarus").

In case you want to run several versions, you can direct lazarus to use use specific configuration directories via the --pcp option, e.g. :

lazarus --pcp=/home/YOU/myLaz19

Make targets

make help

To see a list of available targets for make type make help. Note: "make help" exists since 1.0. Here is the output of "make help":


 
make help 

 Main targets
                  Without any target, target 'all' will be invoked.
   all            build all needed, i.e. minimal IDE, lazbuild, startlazarus.
   clean          deletes files that 'bigide' creates. It does not clean up all possible
                  targets. Clean other target: make clean LCL_PLATFORM=qt
   distclean      Clean all targets and common leftovers.
   lazbuild       build lazbuild and lcl with nogui widgetset
   bigide         as all, except that the IDE is built with a lot of extra packages
   useride        calls lazbuild to build an IDE with your active profile, requires lazbuild
   install        installs Lazarus under /usr/local/share/lazarus
                  You can change the directory by appending INSTALL_PREFIX=/some/path

 Sub targets
   registration   build package FCL
   lazutils       build package LazUtils, requires registration
   codetools      build package CodeTools, requires lazutils
   lcl            build package LCLBase and LCL, requires lazutils
   tools          build lazres, svn2revisioninc, updatepofiles, lrstolfm,
                  requires LCL with nogui widgetset
   basecomponents build debuggerintf, lazdebuggergdbmi, lazcontrols, synedit, ideintf
                  for the LCL_PLATFORM, requires lcl
   bigidecomponents build many extra packages for the LCL_PLATFORM, requires basecomponents
   lhelp          build lhelp, requires bigidecomponents
   starter        build startlazarus, requires basecomponents
   examples       build basic examples, requires basecomponents                                                                                                        
                  Note: There are more examples having their own directory                                                                                             
                                                                                                                                                                       
 Flags:                                                                                                                                                                
   PP=/path/to/fpc        use another compiler                                                                                                                         
   USESVN2REVISIONINC=0   do not update ide/revision.inc                                                                                                               
   INSTALL_PREFIX=/usr    used by 'install' as path prefix                                                                                                             
   FPC_DIR=/usr/share/fpcsrc/3.0.4   used by fpcmake when regenerating Makefiles                                                                                       
   OPT='-vwnbq -gh'       append these options when calling the compiler                                                                                               
                                                                                                                                                                       
 Usage examples:                                                                                                                                                       
                                                                                                                                                                       
 Update svn and build a minimal IDE, startlazarus and lazbuild:                                                                                                      
   make clean                                                                                                                                                          
   svn up                                                                                                                                                               
   make clean all                                                                                                                                                      
                                                                                                                                                                       
 Note: You can start lazarus with 'startlazarus'                                                                                                                       
 Note: Use the IDE or lazbuild to compile your projects/packages.                                                                                                      
                                                                                                                                                                       
 Update svn and build an IDE with your last set of packages:                                                                                                         
   make clean                                                                                                                                                          
   svn up                                                                                                                                                              
   make clean lazbuild useride                                                                                                                                         
                                                                                                                                                                       
 Clean up:                                                                                                                                                             
  There is no command to clean up a svn repository completely, but                                                                                                     
  you can use the following command under Linux/OS X:                                                                                                                  
  svn status | grep '\?' | sed -e 's/\? *//' | xargs rm -r                                                                                                             
                                                                                                                                                                       
  Another possibility is to create a clean copy via the svn export command.                                                                                            
                                                                                                                                                                       
 Install:                                                                                                                                                              
   Note: You can use Lazarus without installing. Just start the lazarus executable.                                                                                    
   1. Build Lazarus as normal user with one of the above commands.                                                                                                     
   2. Install as root into /usr                                                                                                                                        
          sudo make install
      This installs startlazarus, lazarus-ide, lazbuild under /usr/bin
      and copies the whole lazarus source directory to /usr/share/lazarus

Make parameters

There are additional parameters which can be used to make Lazarus. See a fully working example above.

  • OPT=%compiler_switches

the %compiler_switches is passed to each fpc call. The option is useful for specifying defines

For example:

 make bigide OPT="-dNoGdkPixBufLib -gw2" 

makes LCL and ide with NoGdkPixBufLib defined and dwarf2 debug info.

  • LCL_PLATFORM=%platform

%platform is the target widgetset. It can be win32,wince,gtk,gtk2,qt,carbon,cocoa,customdrawn.

For example:

 make LCL_PLATFORM=gtk2

Rebuilds LCL and IDE for gtk2 widgetset

  • FPC=%compiler_path

or

  • PP=%compiler_path

%compiler_path is the path+filename to a custom compiler binary you want to build the target with.

such as:

make FPC="~/Pfad/fpc"

Browse the Source Repository with a Web Browser

The contents of the GIT repro can also be browsed with your web-browser through interface.

Lazarus Distributions

There are some unofficial sites where you can find Lazarus and Free Pascal too:

See also