Recent

Author Topic: Lazarus portable?  (Read 2810 times)

BrunoK

  • Hero Member
  • *****
  • Posts: 766
  • Retired programmer
Re: Lazarus portable?
« Reply #15 on: November 05, 2025, 05:26:21 pm »
$(LazarusDir)\fpc\$(FPCVERSION)\bin\x86_64-win64\fpc.exe
But those $FPCVERSION macros aren't recognised.

Is there anything I can replace them with?
Should be something like $(LazarusDir)\fpc\$(FPCVer)\bin\x86_64-win64\fpc.exe. $(FPCVERSION) does not seem to be a valid one.

Except those specified in https://wiki.freepascal.org/IDE_Macros_in_paths_and_filenames, there may be others that require going to the source.

Today I found that some fields do not behave in a comprehensible manner regarding the substitutions. 

sl23

  • Newbie
  • Posts: 6
Re: Lazarus portable?
« Reply #16 on: November 05, 2025, 09:39:59 pm »
Thank you! :D

BrunoK

  • Hero Member
  • *****
  • Posts: 766
  • Retired programmer
Re: Lazarus portable?
« Reply #17 on: November 06, 2025, 05:00:03 pm »
Also forgot to mention that real environment macros are displayed in lazarus via Menu/View/IDE Internals/About IDE -> select IDE Macros to view macros known to lazarus.

Note :-; -> ConfigDir is NOT a  valid macro ... but ConfDir is OK

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12905
  • FPC developer.
Re: Lazarus portable?
« Reply #18 on: November 06, 2025, 06:06:20 pm »
Should be something like $(LazarusDir)\fpc\$(FPCVer)\bin\x86_64-win64\fpc.exe. $(FPCVERSION) does not seem to be a valid one.

Which is logical.  $FPCVERSION is determined by querying fpc.exe, so can't be used in the path of fpc.exe :-)

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1272
Re: Lazarus portable?
« Reply #19 on: November 07, 2025, 04:13:55 am »
I use a "portable" version of Lazarus under Windows, but I cheat :-)  I map a Folder to B:\ (sometime as USB mapping, but mostly using appropriate regkey to mount a folder as B:\.  I keep that folder synced across multiple PCs using Resilio Sync).

B:\ hasn't been used by Windows since the age of the floppies, so I'm never competing against other systems and my config paths don't need changing.
Lazarus Trunk/FPC latest fixes on Windows 11
  I'm getting old and stale.  Slowly getting used to git, I'll get there...

rasberryrabbit

  • Full Member
  • ***
  • Posts: 151
Re: Lazarus portable?
« Reply #20 on: November 07, 2025, 02:04:35 pm »
https://github.com/rasberryrabbit/FPC_FPCUP_Set

I made tool for setting patch in lazarus configuration. I used it for fpcupdeluxe.
Code is long, Life is short, AI is not your enemy.

PascalDragon

  • Hero Member
  • *****
  • Posts: 6398
  • Compiler Developer
Re: Lazarus portable?
« Reply #21 on: November 08, 2025, 06:29:28 pm »
I have not tested it, but in theory you could simply use drive absolute paths in the configuration on Windows. That are paths that start simply with a backslash without a drive letter and color and Windows will resolve that to the drive of the current working directory (and if you start an application using Windows Explorer or such the working directory will be set to the directory of the executable).

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12905
  • FPC developer.
Re: Lazarus portable?
« Reply #22 on: May 19, 2026, 01:24:21 pm »
(rereading because a similar thread on the topic).

fpc.cfg paths are afaik relative to the location of fpc.cfg.
Really? In all FPC installations that I have on my desk, fpc.cfg contains absolute paths.

True, I was way off, I don't know what I was thinking. Anyway, I do remember it correctly now. Two distinct issues:

Making lazarus relative on windows.

I think, the fpc.cfg location independence was for a FPC embedded in the  (Windows) Lazarus directory, which set the lazarusdir environment variable. The fpc.cfg can use environment variables, this reduces the need for absolute paths to only one, lazarusdir. And then lazarusdir was made to be overridable with startlazarus, so that the batchfile only has to figure out the path, and pass it to lazarus to propagate it. This default hierarchy doesn't have a version number in the path to the compiler though, so that is not a problem.

relative paths and fpc.cfg:

Probably what I had in mind when writing above quote was the relation between fpc.cfg location and compiler binary on Unix, so not unit directories relative to fpc.cfg as I said. This feature exists for when other prefixes are used (/usr/local on BSD and slackware, and /usr/exp on some older Redhats). It was also useful for NFS shares mounted on different places on different systems.  But the default compiler unit search directory (only the RTL) was based on this exepath as well at some point. See options.pas:4501


« Last Edit: May 19, 2026, 01:27:43 pm by marcov »

 

TinyPortal © 2005-2018