On Sat, 6 Nov 2021, 02:09 James Richters via fpc-pascal, <
fpc-pascal@lists.freepascal.org> wrote:

> Do I need to use the source to re-install FPC every time I want to update
> it?  If so how is this accomplished?
>
> Or is there a better way to just update everything when I update the
> repository without re-installing it?
>

To build the compiler, rtl and packages from newly updated source, call
make clean all

from the base folder of the source containing the compiler, rtl etc
folders. This will produce a new compiler located in the compiler folder.
It will be called something like ppcx64 (depends on your host
architecture).  Compiled units for rtl are located in rtl/units/$fpctarget
and packages will sit under packages/*/units/$fpctarget.

a) You can use this as is without installing, but then your config file
needs to be updated with the relevant locations to units and utilities.
Either call ppcx64 (or your target compiler) directly, or build the fpc
frontend located in compiler/utils, then copy the resulting fpc executable
into the compiler folder from where it can call the target specific
executables.  Since this folder layout is most likely different from the
installed layout, use a different fpc.cfg file with paths updated according
to the source structure.

b) You can install the new compiler (make install), which would typically
overwrite the existing installed version.  Or you can install to a custom
location by specifying INSTALL_PREFIX=path/to/install/folder.  You need the
previous stable compiler to start the build process, so do not overwrite
the installed version.  This also requires a custom fpc.cfg, since the base
folder will be different to the installed path.

For either of the options, call the compiler with the option -n to not load
the default config file (which would point to the installed version,
leading to unit version conflicts) and @/path/to/new/fpc.cfg so that the
compiler can load the new config.

Notes
1. I'm using Linux conventions above, translate path separators and .exe
extensions as required for Windows.
2. If the stable compiler is not in the path, add
FPC=path/to/compiler/ppcx64 to the make commands.
3. There are many more permutations I'm sure, these are just the options
I've managed to get working.

As Ryan mentioned, you have to frequently (if you want to stay up to date)
update the source (git pull), then rebuild.  So configuring your setup
initially is key, after that it is relatively simple to stay up to date.

On a personal note, I got tangled up with config files and conflicts
between old and new compiler versions in the past. When you run into
strange compiler errors about not finding units, or invalid PPU versions or
some such, take note of the paths used for the compiler, config file and
the relevant units.  My strategy was to never install fpc into the search
path, always specify the path to the compiler executable and know when the
compiler should ignore the default and load a specific config file for the
particular compiler.

Alternatively use fpcupdeluxe, it has an option to checkout and build
main.  I haven't tested this much, since I'm comfortable with my workflow.
There is an active thread on the Lazarus forum for fpcupdeluxe support.

>
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to