Recent

Author Topic: Lazbuild and alt packages  (Read 4958 times)

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Lazbuild and alt packages
« on: January 22, 2019, 11:20:28 pm »
I have added a package, KControls, to Lazarus IDE and it works fine, I can use Lazbuild to build my app, using that package, from the command line. Great !

But I'd like to be able to use an alternative version of (in this case) KControls without going though loading the IDE, removing the existing package, rebuilding the IDE adding the other version and rebuilding.

I was sure I'd read here that its possible to nominate packages (or units ?) on the Lazbuild command line. If so, I cannot find it but first I'd need to tell Lazbuild not to use the version know to Lazarus. I thought --skip-dependencies might be it but, no, my app still builds (using original version of KControls) even if I add that.

So, I spotted --create-makefile - I'll make a makefile and can edit that with a simple script. But no, nothing I can do to get lazbuild to create a makefile, it just seems to ignore that switch.

Is there something I am missing with lazbuild ?  Has --create-makefile been disregarded ?  Is there some other way to manipulate the packages lazbuild uses ?

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

sash

  • Sr. Member
  • ****
  • Posts: 366
Re: Lazbuild and alt packages
« Reply #1 on: January 22, 2019, 11:38:23 pm »
Add dedicated build mode and change path to (the units of) alternative package (probably you'll need to remove package dependency too) there.
Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazbuild and alt packages
« Reply #2 on: January 23, 2019, 07:46:56 am »
Thanks Sash (although I was hoping to leave my lazaru install alone, sigh) !

David
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

sash

  • Sr. Member
  • ****
  • Posts: 366
Re: Lazbuild and alt packages
« Reply #3 on: January 23, 2019, 09:47:44 am »
I was hoping to leave my lazaru install alone

No need to do anything with Lazarus install. All manipulations should be done with project, specifically inside additional Build Mode.

Then build it from command-line this way:
Code: Bash  [Select][+][-]
  1. lazbuild --bm=My_Build_Mode_Name path/to/project
Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazbuild and alt packages
« Reply #4 on: January 23, 2019, 10:54:11 pm »
Hmm, not sure I get you.

I make a new build mode. It inheritances settings from (eg) 'default'. If I select the new mode, it has the existing package installed. If I remove that package while in the new mode, its removed from all modes. And a newly installed package again pops up in all build mode.

Are you suggesting setting "Other unit files (-Fu)" to the package's source and not having it installed at all ?  Might work as I've already done the visual design things but its still handy to be able to point the object inspector at one of its components and see its properties etc.

Or is there another way to install a package that is build mode sensitive ?

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

sash

  • Sr. Member
  • ****
  • Posts: 366
Re: Lazbuild and alt packages
« Reply #5 on: January 24, 2019, 03:28:35 pm »
Sorry, it seems like a package dependency is not affected (like paths) by build modes, like I initially meant indeed.

Well, in that case, I see 2-3 possibilities: either
Quote
Are you suggesting setting "Other unit files (-Fu)" to the package's source and not having it installed at all ?
Yes this, and you'll loose designer features then.

- implement your "alternative" as runtime choice (better one IMO).

- to have another Lazarus directory and choose it with

Code: Bash  [Select][+][-]
  1. lazbuild --primary-config-path=/home/you/.lazarus_with_another_package project

Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazbuild and alt packages
« Reply #6 on: January 24, 2019, 11:59:44 pm »
Thanks Sash, in fact I already have a couple of Lazarus installs. I've just made another one, I needed to test something in trunk anyway so I've made that my kcontrols test bed as well. So, my immediate problem is solved.

-- discussion --
But I reckon it would be "good thing" if lazbuild was a bit more flexible, or a new tool created. In particular it would be great if we could, flexibly, build a project without Lazarus (the IDE). Maybe make a makefile that needed only FPC and LCL. Next time I have nothing to do (??) I'll dig through lazbuild source and see why its makefile option no longer works.... 

David
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazbuild and alt packages
« Reply #7 on: January 25, 2019, 03:17:27 am »
Answering my own question.

The --create-makefile option to lazbuild is not, and probably never was, about creating a makefile for the target project. It can (probably) be used to write out a makefile for a package that is incidental to building the project. That is what the man page says, its a case of stop reading what you want to read david, and read what it says !

Be nice to know exactly what some of the other options do, I suspect they are very context sensitive, maybe only apply when rebuilding IDE ? Things like

--add-package
--add-package-link=<.lpk file>
--skip-dependencies

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

sash

  • Sr. Member
  • ****
  • Posts: 366
Re: Lazbuild and alt packages
« Reply #8 on: January 25, 2019, 09:53:04 am »
it would be great if we could, flexibly, build a project without Lazarus (the IDE). Maybe make a makefile that needed only FPC and LCL. Next time I have nothing to do (??) I'll dig through lazbuild source and see why its makefile option no longer works.... 

This is a nature of package: it's not simply source library, it is a part of IDE, like monolithic OS kernel, so you can't use package without context of IDE installation.

Quote
--create-makefile
                      Instead of compile package create a simple Makefile.
Looks like it is intended to be used for packages.


BTW: It's possible to use plain FPC CLI with "Project->show options" as a base.
Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE

 

TinyPortal © 2005-2018