Sunday, November 9, 2014
Building your OWN FPC and Lazarus
I produced this a while ago. Its laz/fpc installation in general.
If you can follow, then after that probably anything goes.
No one has proof read it yet though, but that might happen now.
We will recompile Lazarus sources with FPC 2.7.1 and also
use FPC 2.7.1 to build all applications that Lazarus produces.
To smoothly get updated versions of Lazarus and FPC you should
have a SVN client installed. I use Tortoise.
[1] Get Tortoise: http://tortoisesvn.net/downloads.html
Install with COMMANDLINE TOOLS option checked so
Lazarus AboutBox will show the correct SVN number.
[2] You need the release version of fpc to build the development
versions of fpc. For 64 bit versions of fpc, the is no official
release. But Lazarus provides a such a 64 bit fpc version.
Install latest official Lazarus version to c:\lazarus\release
http://www.lazarus.freepascal.org/index.php?page=downloads
Before you start Lazarus, edit the shortcut:
c:\lazarus\release\startlazarus.exe --pcp=c:\lazarus\release\configdir
That means the settings will be isolated from other Lazarus installations.
[3] Install the source for FPC 2.71 by doing a Tortoise SVN Checkout:
http://svn.freepascal.org/svn/fpc/trunk
I suggest 'c:\fpc\trunk' as source directory. Rightclick it in the
explorer and do Checkout with Tortoise. Choose the head version.
All FPC sources will be downloaded to this directory.
[4] Now build fpc 2.7.1 using the fpc 2.6.2 binaries from Lazarus.
Start a commandprompt at c:\fpc\trunk and issue these commands:
PATH=c:\lazarus\release\fpc\2.6.2\bin\x86_64-win64\
SET FPC=c:\lazarus\release\fpc\2.6.2\bin\x86_64-win64\fpc.exe
make all
make install INSTALL_PREFIX=C:\fpc\2.7.1
(INSTALL_PREFIX represents the TARGET path for the
newly compiled version)
Whatever you have in your system path doesnt matter since you
set your own temporary path from the prompt. Later we'll change
the system path permanently.
Exit/Close this commandprompt after make has finished!
Dont reuse it because the path will point to wrong fpc version.
When make finishes you will have a new directory: C:\fpc\2.7.1
with the fpc 2.7.1 binaries in it. Because Lazarus uses the
source files from fpc, you need to put a copy of \packages and
\rtl directories and their content in the c:\fpc\2.7.1 directory.
(If you dont do that you cant update the trunk version without
affecting the current 2.7.1 fpc installation. Because when you
update the trunk you will get some new sourcefiles and they will of
course not match the binaries of your old installation without
a recompile. So just copy packages and rtl. This way you can update
the trunk fpc and install other versions of fpc in new dirs following
the steps above).
Since this is a fresh install of fpc, you have no fpc.cfg.
Copy c:\lazarus\release\fpc\2.6.2\bin\x86_64-win64\fpc.cfg to
c:\fpc\2.7.1\bin\x86_64-win64 and edit the paths. Lines starting
with # means they are commented out. Just leave such lines as they
are.
If a line looks like this:
-Fuc:\lazarus\release\fpc\$FPCVERSION/units/$fpctarget
You should change it to:
-Fuc:\fpc\2.7.1\$FPCVERSION/units/$fpctarget
We are actually done with fpc 2.6.2 for now!
But dont delete the release version of Lazarus or the
2.6.2 fpc that comes with it because you always need it
to recompile new fpc versions with it. New SVN versions
must always be compiled with the release version of fpc.
Plus Lazarus release can use it.
Now Add c:\fpc\2.7.1\bin\x86_64-win64 to your system PATH:
* In Explorer, Rightclick Computer: choose Properties.
* Choose Advanced system settings
* Click the Environment Variables button
* In System Variables Listbox, scroll down to the Path variable
and doubleclick it. Add c:\fpc\2.7.1\bin\x86_64-win64; at the
BEGINNING of the line, before everything else and dont forget the
semicolon.
Now REBOOT! Yes. Otherwise there can be a mismatch between release version
of fpc and the freshly compiled fpc.
[5] Install the source for the Lazarus development version by doing a
Tortoise SVN Checkout: http://svn.freepascal.org/svn/lazarus/trunk
[6] Build Lazarus. From a NEW commandprompt, go to c:\lazarus\LazSVN and run:
make clean bigide
[7] Go to the desktop and make yourself a shortcut to start Lazarus from.
Choose startlazarus.exe as programfile:
c:\lazarus\lazSVN startlazarus.exe --pcp=c:\lazarus\lazSVN\configdir
Configdir is automatically created when you start Lazarus.
If you dont supply a -pcp (primary config path) Lazarus will create
a directory under C:\Users\Elvis\AppData\Local\lazarus
When you start Lazarus for the first time you must fill in file locations
for fpc.exe, fpc sources, make.exe and gdb.exe so Lazarus knows what
compiler etc to use.
[8] Optional: Install latest binw64 binaries to c:\fpc\binw64 by doing a
Tortoise SVN Checkout:
http://svn.freepascal.org/svn/fpcbuild/trunk/install/binw64/
To summarize this. You now have a fpc trunk directory
with the development sources. With Tortoise you can update
fpc as often as you like. When you do that you must
follow the steps under [4], except for the fpc.cfg.
Also Lazarus can be independently update with Tortoise, just get
new sources and do a 'make clean bigide'. You will have to
reinstall 3rd party components that you have added to the
component palette though.
here full
http://forum.lazarus.freepascal.org/index.php/topic,24045.msg144389.html#msg144389
Labels:
FreePascal
,
Lazarus