Recent

Author Topic: Build Lazarus with packages (make bigide & lazbuild)  (Read 3082 times)

rvk

  • Hero Member
  • *****
  • Posts: 6585
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #15 on: March 01, 2024, 04:45:05 pm »
Now that I'm at it...

I thought --add-package-link only registered the package but did not actually install it.
(so it would be at the right pane in packages?)

--add-package would actually install it, but only works for design-packages.

Or does --add-packages-link also install a design-package on the next build?

So when do you use --add-packages-link and when --add-packages ?

(I see LazarusPackageManager only using --add-packages-link. So how does it install it in the IDE?)

TRon

  • Hero Member
  • *****
  • Posts: 3643
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #16 on: March 01, 2024, 05:52:02 pm »
(I see LazarusPackageManager only using --add-packages-link. So how does it install it in the IDE?)
the packagemanager examples operate on individual project files.

It manipulates the project settings based on the commands. After that a manual build (of the project) needs to be done. That is, as far as I understand it.
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

rvk

  • Hero Member
  • *****
  • Posts: 6585
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #17 on: March 01, 2024, 05:56:46 pm »
(I see LazarusPackageManager only using --add-packages-link. So how does it install it in the IDE?)
the packagemanager examples operate on individual project files.

It manipulates the project settings based on the commands. After that a manual build (of the project) needs to be done. That is, as far as I understand it.
Yes. But I removed richmemo_design.lpk from the packages in the IDE, rebuild and it was gone.
Then I tried --add-package-link richmemo_design.lpk with following a lazbuild --build-ide=
The richmemo_design.lpk was NOT added to the IDE.
Doing a --add-package richmemo_design.lpk (so without the -link) followed by lazbuild --build-ide= it WAS added to the IDE.

(I see LazarusPackageManager only does a --add-package-link so I wonder if the packages are really added then...  %) )

TRon

  • Hero Member
  • *****
  • Posts: 3643
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #18 on: March 01, 2024, 06:14:50 pm »
@rvk:
Is that not exactly the distinction between --add-packages and --add-packages-link ?

--add-packages adds a package to the IDE while --add-packages-link add a requirement of the package to the project setting (just as you would do in project settings in the IDE).

But I understand the confusion because I ask myself the same question(s)  :)
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

rvk

  • Hero Member
  • *****
  • Posts: 6585
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #19 on: March 01, 2024, 06:17:42 pm »
--add-packages adds a package to the IDE while --add-packages-link add a requirement of the package to the project setting (just as you would do in project settings in the IDE).
Yes, that's why I was puzzled to NOT find any lazbuild --add-packages in LazarusPackageManager.
Only lazbuild --add-packages-link (which doesn't add the package to the IDE)  ;)

Anyway, I'll keep using --add-packages for design-time packages and --add-packages-link for runtime packages (which can be added for requirement in the Project options like Synapse).


TRon

  • Hero Member
  • *****
  • Posts: 3643
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #20 on: March 01, 2024, 07:17:35 pm »
@rvk:
I still have a question though....

You wrote that you wanted to do this because of missing sqldb components. That is annoying so I get why you looked into this. What I do not understand however is that lazdb is part of the make bigide... so what's up with that ?

Or did I misunderstood something there ?
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

rvk

  • Hero Member
  • *****
  • Posts: 6585
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #21 on: March 01, 2024, 07:26:06 pm »
You wrote that you wanted to do this because of missing sqldb components. That is annoying so I get why you looked into this. What I do not understand however is that lazdb is part of the make bigide... so what's up with that ?
The problem is that you can't use make bigide and afterwards directly use lazbuild.

Make bigide doesn't create a config by itself.
And lazbuild needs a config to add packages.
If you use lazbuild directly after make bigide (without starting the ide first) it won't find that config and creates a new clean ide without any packages.

So its either
Make bigide -> start ide, close ide -> run lazbuild
Which you can't do in a non-interactive script.

Or don't use make bigide and do
Make lazbuild -> lazbuild all wanted packages -> lazbuild --build-ide=
Which you can do with a script. Except then you need to specify all packages and you can't rely on "bigide" defaults.


TRon

  • Hero Member
  • *****
  • Posts: 3643
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #22 on: March 01, 2024, 07:31:32 pm »
Thank you very very much for clarifying that (again) rvk.

I forgot about the catch-22 already  :-[

(I really should be focusing on one thing at a time  :-X )
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

TRon

  • Hero Member
  • *****
  • Posts: 3643
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #23 on: March 01, 2024, 09:32:36 pm »
SOLVED, see edit below.

Perhaps not the best idea to post here but I got into a bit of a problem trying the suggested solution.

Code: Bash  [Select][+][-]
  1.   msg "options for lazbuild are: ${options[*]}"
  2.  
  3.  
  4.   for package in "${packages[@]}"
  5.   do
  6.     ${BUILD_DIR}/lazbuild ${options[*]} --add-package ${BUILD_DIR}/components/${package}
  7.   done    
  8.  

which for me produces:
Code: [Select]
==============================================
options for lazbuild are: --verbose --pcp="/media/ramdisk/work/lazarus/.lazconfig" --lazarusdir="/media/ramdisk/work/lazarus" --compiler="/home/scripts/fpc"
==============================================

Parameter: add-package
SetPrimaryConfigPath NewValue=""/media/ramdisk/work/lazarus/.lazconfig"" expanded to "/media/ramdisk/work/lazarus/"/media/ramdisk/work/lazarus/.lazconfig""
Parameter: pcp=/media/ramdisk/work/lazarus/"/media/ramdisk/work/lazarus/.lazconfig"
Parameter: compiler="/home/scripts/fpc"
Parameter: lazarusdir="/media/ramdisk/work/lazarus"
Hint: (lazarus) primary config path: /media/ramdisk/work/lazarus/"/media/ramdisk/work/lazarus/.lazconfig"
Error: (lazarus) invalid Lazarus directory "/media/ramdisk/work/lazarus/"/media/ramdisk/work/lazarus"/": directory not found
Error: (lazarus) Installing package(s) failed: /media/ramdisk/work/lazarus/components/datetimectrls\datetimectrls.lpk

I am confused about the expansion of the primary configuration path which seem to be done by lazbuild.

Someone any idea's ?

FPC: 3.2.2
Lazarus 3.2
platform: x86_64 linux

edit: SOLVED

apparently lazbuild does not seem to like quoted parameters.... removing them solved the issue.
« Last Edit: March 01, 2024, 10:00:51 pm by TRon »
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

rvk

  • Hero Member
  • *****
  • Posts: 6585
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #24 on: March 01, 2024, 09:59:43 pm »
SetPrimaryConfigPath NewValue=""/media/ramdisk/work/lazarus/.lazconfig"" expanded to "/media/ramdisk/work/lazarus/"/media/ramdisk/work/lazarus/.lazconfig""
At least that is a wrong expansion due to quotes.
I'm not sure how you pass the config but try it without quotes (because the quotes seems to double).
Otherwise the dot might need escaping.
But normally a dot shouldn't need escaping on Linux.

Parameter: pcp=/media/ramdisk/work/lazarus/"/media/ramdisk/work/lazarus/.lazconfig"
Same here.

/media/ramdisk/work/lazarus/components/datetimectrls\datetimectrls.lpk
Where did the backslash come from?
On Linux it should all be forward slash.

I don't see a problem with star expansion here.
« Last Edit: March 01, 2024, 10:02:29 pm by rvk »

TRon

  • Hero Member
  • *****
  • Posts: 3643
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #25 on: March 01, 2024, 10:04:41 pm »
At least that is a wrong expansion due to quotes.
Yeah indeed. I figured that out as well. Unfortunately the edit of my previous post crossed your response.

Quote
I'm not sure how you pass the config but try it without quotes (because the quotes seems to double).
Yes, that solved it.


Quote
/media/ramdisk/work/lazarus/components/datetimectrls\datetimectrls.lpk
Where did the backslash come from?
:-[ ... shameless copy-paste from your post where you listed all the package filenames, including path (presumably generated on windows)

Thank you very much for your response rvk even though I figured it out at almost the same time as your posting  :). This is such a typical "I can look at it for days and not see what's wrong" .... 
« Last Edit: March 01, 2024, 10:08:37 pm by TRon »
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

rvk

  • Hero Member
  • *****
  • Posts: 6585
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #26 on: March 01, 2024, 10:11:02 pm »
Quote
/media/ramdisk/work/lazarus/components/datetimectrls\datetimectrls.lpk
Where did the backslash come from?
:-[ ... shameless copy-paste from your post where you listed all the package filenames, including path (presumably generated on windows)
:D :D 8-)

Actually the forward slash might also work on Windows last time I checked ;)
Not the other way around (Linux and backslash).

Would make copying between my Windows and Linux script a lot easier  8-)
« Last Edit: March 01, 2024, 10:12:41 pm by rvk »

TRon

  • Hero Member
  • *****
  • Posts: 3643
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #27 on: March 01, 2024, 11:28:55 pm »
Actually the forward slash might also work on Windows last time I checked ;)
Not the other way around (Linux and backslash).
unless... WSL ?  :P  :hides-in-shadows:

Quote
Would make copying between my Windows and Linux script a lot easier  8-)
Yeah that is always a bummer. Have not been using/writing windows batch files since ages  :-X

Ok, this method seems to be working as intended, including using the install from the makefile.... thank you very much for your insight, examples and help rvk

... the only thing that I noticed that is missing is startlazarus (which I assumed lazbuild --build-ide would automatically take care of, but apparently it doesn't, at least not for me). I seem unable to locate a quick method to add that without resorting to an individual lazbuild compilation of/for the startlazarus project.
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

rvk

  • Hero Member
  • *****
  • Posts: 6585
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #28 on: March 02, 2024, 12:07:43 am »
... the only thing that I noticed that is missing is startlazarus (which I assumed lazbuild --build-ide would automatically take care of, but apparently it doesn't, at least not for me). I seem unable to locate a quick method to add that without resorting to an individual lazbuild compilation of/for the startlazarus project.
On Linux I seem to be missing the compilation of startlazarus but I am using it for creating a shortcut. So it must be made by make bigide (which I still have in my Linux script).

On Windows I have the creation startlazarus in my script, even when I still did make bigide.
So either on Windows the make bigide doesn't create it or I recompiled it when it was not really necessary.

Anyway... when using lazbuild (instead of make bigide) you do indeed need to create the startlazarus itself with lazbuild ;)

(this is what I do on Windows)
Code: [Select]
lazarus\lazbuild.exe --lazarusdir="%cd%\lazarus" lazarus\ide\startlazarus.lpi
Because startlazarus isn't that big of a program it compiles relatively fast (compared to lazarus.exe itself).
« Last Edit: March 02, 2024, 12:09:27 am by rvk »

n7800

  • Full Member
  • ***
  • Posts: 175
Re: Build Lazarus with packages (make bigide & lazbuild)
« Reply #29 on: March 02, 2024, 01:22:58 am »
"--add-package" is to add a package to the IDE for installation, which is what you do in the IDE's "Install/Uninstall Packages" window. It allows you to simply specify the package name if it is located in the "lazarus\components" folder.

However, if it is not there, then lazbuild needs to specify the path via "--add-package-link". This will not install the package, but will only tell you where to look for it. Apparently OPM uses this to add paths to downloaded packages.

However, you can immediately specify in "--add-package" not the name, but the path to the .lpk-file.



Yes, lazarus/lazbuild has a problem with quotes in parameters in some places. I've almost written a patch to fix this.



To build "startlazarus" you can use "make starter". And instead of using "lazbuild --build-ide=" for a complete rebuild, you can use "make useride". You can find a lot of interesting information in the help of the Makefile itself: "make help" (in the lazarus directory).

 

TinyPortal © 2005-2018