[fpc-pascal] Alternative to Makefiles for fpGUI

Michael Van Canneyt michael at freepascal.org
Fri Aug 10 14:00:08 CEST 2007



On Fri, 10 Aug 2007, Darius Blaszijk wrote:

> Hi Michael,
> 
> Michael Van Canneyt wrote:
> > The idea is that you do a 
> >
> > fppkg <packagename>
> >
> > this will look in a database for the package, extract it, and the compile
> > fpmake.pp and run it. The fpmake contains
> > all configuration to make and zip the package.
> >   
> Aha, this clears up some mist in my mind. But I still don't really understand
> how the packages thing actually works on "standalone" projects. You once
> mentioned something  that one could register it's project as a package. What
> would the workflow be if fpmake would be used in a non fpc-devel related
> project?

Simple. You create a fpmake.pp like this:

---------------------------------------------------

program fpmake;

uses fpmkunit;

Var
  T : TTarget;

begin
  With Installer do
    begin
    StartPackage('MyNiceProgram'); // Actually optional.
    Targets.DefaultOS:=[win32,openbsd,netbsd,freebsd,darwin,linux];
    T:=Targets.AddUnit('myunit');
    T.ResourceStrings:=True; 
    T:=Targets.AddUnit('myprogram');
    T.AddDependency('myunit');
    EndPackage; // Actually optional.
    Run;
    end;
end.
---------------------------------------------------

The idea is that everyone who programs pascal, knows pascal, 
and so the 'make' tool should also be in pascal...

Then you compile it:

fpc fpmake.pp

This should work flawlessly. Obviously, everytime you change fpmake, you'll
need to recompile it.

Now you can do:

./fpmake --build

This will build your project. Or,

./fpmake --install

will install it. 

./fpmake --archive

will create a zip.

The plan is to also add

./fpmake --innosetup

Which will generate a file tha can be included in an inno setup file.

"fppkg" only enters the picture if you want to register your package with the
FPC repository. It will recompile fpmake automatically when needed, and compile
any dependent packages as well.

Michael.



More information about the fpc-pascal mailing list