[Lazarus] Create a package - how?

Mattias Gärtner nc-gaertnma at netcologne.de
Fri Jun 5 14:47:45 CEST 2009


Zitat von Hans-Peter Diettrich <DrDiettrich1 at aol.com>:

> Mattias Gaertner schrieb:
>
>>> The package contains an docking manager (LDockTree replacement),
>>> useful in every application.
>>
>> Then it should be moved to components.
>
> I have to leave that move to the maintainers, I only have SVN write  
> access to the examples/ tree. I also would suggest a copy, not a  
> move, so that I can continue updating the code while maintaining my  
> own naming conventions and style. The "official" version can/should  
> be adopted to fully conform to the Lazarus style guide.

Each package in the lazarus tree should have a unique name to not  
confuse users.
You can have svn write access for a directory under components.


>>> IMO this difference between Delphi and Lazarus packages should be  
>>> mentioned in the documentation about creating Lazarus packages.  
>>> I've tried to collect all the issues, that currently are not clear  
>>> to a Lazarus package newbie, so that the documentation can be  
>>> updated accordingly.
>>
>> I hope you collected them on our wiki site:
>> http://wiki.lazarus.freepascal.org/Lazarus_Packages
>
> You mean: I should update the wiki myself?

Yes.
Write the facts in a way that you think a beginner would understand.  
Don't forget that wiki readers may know Delphi or may not.


> The consequences, resulting from the Delphi/Lazarus differences, are  
> not always obvious. Reading the page(s) again, after being more  
> familiar with packages, the gaps found in the first read will be  
> hidden by the knowledge from other sources and experience.
>
>
> The wording "Create standard package" suggests to me, that there can  
> exist non-standard packages - for what special needs? Perhaps two  
> entries should be provided, for component packages with IDE  
> integration, and runtime-only packages. The intial settings will  
> differ for both package types.

Where is this "Create standard package"?
Maybe it can be 'Create package'.


> The Quick Start paragraph just doesn't handle the case of adding  
> existing files to the package. This case may look as self-explaining  
> to the experienced user, but not to the newbie. E.g. the IDE  
> Integration has to be changed for runtime packages. It also doesn't  
> explain where the Unit files go by default, and more such background  
> information. IMO links should be added to the other major wiki  
> entries, related to packages, and links back to the Package "main"  
> page.

Lots of good ideas.


> The path delimiter bug will bite the user when following the  
> "Creating a new package" instructions, when "Use the Save  
> button...". Create a new package and look at the Units path. If the  
> delimiter isn't there, add one manually.

Bug report?
I created a new package and I don't know what you mean.


>> I wrote this many times in the wiki and the IDE has some checks.
>> Maybe some more warnings should be added.
>
> Just the need for mentioning something "many times" suggests to me,  
> that the documentation structure is bad. Important details IMO  
> should be explained in one place, which the reader *must* have seen.  
> That's a special wiki problem, since printed documentation can be  
> assumed to be read sequentially, and the reader may have to look  
> back to preceding chapters for missing information. As long as the  
> announced book about Lazarus doesn't exist, the wiki IMO should be  
> restructured from time to time, so that it can be read in an  
> intended sequential order, just like a book is read.

The book will also mention it several times, because even books are  
not read entirely and/or memorized on first read.

To make it clear:
It is not forbidden to put several packages/projects into one  
directory. For example different versions or for test suites.


> [...]
>>> I already noticed that the Lazarus project
>>> has several unit/ directories for compiled files, where a Delphi user
>>> would expect that these directories contain source files (for e.g.
>>> packages).
>>
>> Can you give an example?
>
> Look into Delphi component packages, and into the lazarus/ tree...
>
> I accept that unit/ directories have their own meaning, by  
> tradition. A newcomer from Delphi should have to pass the Units  
> test, before s/he is allowed to proceed ;-)

That's why I and several others used lib or out.
I don't know why fpc choose 'units'. With the coming fppkg there is  
not much choice left. That's why lazarus has switched several to  
'units' already and the rest will probably follow soon.


> But I disagree about package "projects". The .lpk file IMO *is* the  
> package project file (Delphi: .dpk), distinct from the package main  
> file (.pas).

Well, you could name it whatever you like.
But under lazarus a package is not a project. So please don't use that  
in the wiki. I normally name it the lpk-file of package xyz or simply  
the package xyz.


> [...]
> A separation would clarify much. The PkgDir is needed for opening  
> the source files, and is automatically added to the search path. The  
> PkgOutDir may become interesting only when a project or package is  
> built (linked).

Yes.


> BTW, the PkgOutDir is initialized to lib/, not to unit/.

See above. It will probably be changed to units/.


> What immediately raises the question about the meaning and naming of  
> the Library path...

pretty much the same as under Delphi. Of course libraries on the  
various platforms is far beyond the lazarus help. See the fpc docs and  
the docs for libraries for each platform.


>> It's hard as developer to step back and see the things as beginner.
>> We need non developers that structure the documentation for beginners.
>
> True. Unfortunately a beginner (or non-developer) only can ask  
> questions or suggest improvements, but cannot fill in the facts.  
> After he understands the facts, he isn't a beginner any more :-(

It makes a difference if you created something or if you learned something.


> [...]
> As I've learned now, the package main file also contains the  
> procedure Register, when a designtime package is created. In this  
> case the package file *must* be added? Or is this not required?

The IDE always adds the main unit to itself. The option is only  
important for projects and packages.


>>> The package creation wizard should add the missing path delimiter,  
>>> to prevent such misleading compiler errors.
>>
>> There is a probably misunderstanding.
>> There is a path delimiter (\ under windows) and there is a search path
>> delimiter (semicolon).
>
> AFAIR the semicolon is the path *separator*.

I doubt that the English difference between delimiter and separator  
can be translated. I suggest to always explain in the wiki which one  
is meant.


>> The IDE automatically appends path delimiters.
>
> Not at the right time :-(

It does not really matter. It is merely for beautification.
All file handling in the IDE normalizes files, directories and search  
paths anyway.

> [...]

Mattias

--
Powered by NetMail





More information about the Lazarus mailing list