Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-08

Alternative to Makefiles for fpGUI

13 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I heard somewhere in a list that Makefile's are on the way out (for FPC) and a alternative is in the pipeline. Can anybody shed some light on this and if the alternative is usable yet?

I want FPC developers without Lazarus to be able to compile fpGUI. Before, I tried to use Makefiles, but my knowledge of them was limited, so it never really worked.

Any thoughts on a Makefile tutorial or on that alternative app/method?

Regards,
- Graeme -

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 11 lines
Hi, I heard somewhere in a list that Makefile's are on the way out (for FPC) and a alternative is in the pipeline. Can anybody shed some light on this and if the alternative is usable yet? I want FPC developers without Lazarus to be able to compile fpGUI. Before, I tried to use Makefiles, but my knowledge of them was limited, so it never really worked. Any thoughts on a Makefile tutorial or on that alternative app/method?

The upcoming 2.2 will contain the basics for a package system. Look at all directories in the fpc source dirs. You'll find there a fpmake.pp or fpmake.inc.

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.

You could download a package manually, compile fpmake.pp and run
./fpmake --build
or
./fpmake --install
which would install the file.

The fpmake.pp file is very simple, just look at the examples, they are scattered all over the place.

The idea is that the release after 2.2 will use this system.

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt

Thanks for the quick response Michael. I'll have a look at those files shortly.

Graeme.

Michael Van Canneyt wrote 9 lines
The upcoming 2.2 will contain the basics for a package system. Look at all directories in the fpc source dirs. You'll find there a fpmake.pp or fpmake.inc. The idea is that you do a fppkg <packagename>

Reply by email

Darius Blaszijk
to Michael Van Canneyt: The upcoming 2.2 will contain the basics for a package system. Look at all directories in…

Hi Michael,

Michael Van Canneyt wrote 8 lines
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?

Regards, Darius

Reply by email

Michael Van Canneyt
to Darius Blaszijk
Darius Blaszijk wrote 16 lines
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.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt
Michael Van Canneyt wrote
T:=Targets.AddUnit('myunit'); T.ResourceStrings:=True; T:=Targets.AddUnit('myprogram'); T.AddDependency('myunit');

Does this take directories as well?
Here is a fpGUI layout example:

Windows:
src/corelib/gdi/gfx_gdi.pas

Linux:
src/corelib/x11/gfx_x11.pas

Carbon:
src/corelib/carbon/gfx_carbon.pas

Common to all platforms:
src/corelib/fpgui.pas
src/corelib/gfxbase.pas
src/gui/gui_*.pas

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

That's a fair assumption. :)

./fpmake --install will install it.

Install to where?

./fpmake --archive will create a zip.

This is handy!

Regards,
- Graeme -

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 8 lines
On 10/08/07, Michael Van Canneyt wrote: > T:=Targets.AddUnit('myunit'); > T.ResourceStrings:=True; > T:=Targets.AddUnit('myprogram'); > T.AddDependency('myunit'); Does this take directories as well?

Not like this.

You'll have to do this with the unit path:

  Case OS of
    Windows : begin
              T.UnitPath:='corelib/gdi';
              T.AddDependency('gfx_gdi');
              end;
    linux   : begin
              T.UnitPath:='corelib/x11';
              T.AddDependency('gfx_x11');
              end;
    // etc.
  end;

Obviously, the fpmake program is a normal pascal program, so you can do complicated stuff like this:

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

program fpmake;
Type
  TWidgetSet = (wsGDI,wsX,wCarbon);
Var
  WidgetSet : TWidgetSet;
procedure DetermineWidgetSet;
Var
  I : Integer;
begin
  Case Installer.OS of
    Windows : WidgetSet:=wsGDI;
    Linux : Widgetset:=wsX;
    macos : WidgetSet:=wsCarbon
  end;
  // Check paramstr() to see if the widgetset was overridedn on the commandline;
  For I:=1 to ParamCount do
    If ParamStr(i)='--widgetset=X' then
      WidgetSet:=wsX;
end;
begin
  DetermineWidgetSet;
  With Installer do
   /// ....
   Case WidgetSet of
    wsGDI : T.UnitPath:='corelib/gdi';
    wsX   : T.UnitPath:='corelib/x11';
    // etc.
   end;
  ...
  Run;
  end;

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

Show quoted text 28 lines
Here is a fpGUI layout example: Windows: src/corelib/gdi/gfx_gdi.pas Linux: src/corelib/x11/gfx_x11.pas Carbon: src/corelib/carbon/gfx_carbon.pas Common to all platforms: src/corelib/fpgui.pas src/corelib/gfxbase.pas src/gui/gui_*.pas > The idea is that everyone who programs pascal, knows pascal, > and so the 'make' tool should also be in pascal... That's a fair assumption. :) > ./fpmake --install > > will install it. Install to where?

Default for the FPC installation, or to installdir You can do a

  fpmake --baseinstalldir='c:\program files\my package';

or set the default directory in the fpmake source code.

It's super configurable.

A

./fpmake --help

will give you all options, in good unix tradition :-)

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt
Michael Van Canneyt wrote 6 lines
It's super configurable. ./fpmake --help will give you all options, in good unix tradition :-)

And here I thought I would trip you up with my fpGUI example. :) Excellent work and thanks for the clear example code.

Regards,
- Graeme -

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 9 lines
On 10/08/07, Michael Van Canneyt wrote: > > It's super configurable. > > ./fpmake --help > > will give you all options, in good unix tradition :-) And here I thought I would trip you up with my fpGUI example. :)

Well, it must be able to compile RTL and FCL, and those are quite tricky too...

Excellent work and thanks for the clear example code.

You're more than welcome.

Michael.

Reply by email

Peter Vreman
to Darius Blaszijk: Aha, this clears up some mist in my mind. But I still don't really understand how the…
Show quoted text 13 lines
> 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?

Running 'fppkg build' without packagename will if needed build fpmake and run fpmake in the current directory.

Reply by email

Johann Glaser
to Michael Van Canneyt: Well, it must be able to compile RTL and FCL, and those are quite tricky too... You're…

Hi!

Michael Van Canneyt wrote 15 lines
On Fri, 10 Aug 2007, Graeme Geldenhuys wrote: > On 10/08/07, Michael Van Canneyt wrote: > > > > It's super configurable. > > > > ./fpmake --help > > > > will give you all options, in good unix tradition :-) > > And here I thought I would trip you up with my fpGUI example. :) Well, it must be able to compile RTL and FCL, and those are quite tricky too...

Is there any documentation (like the things you've written in this thread) in the Wiki? If not, I'd like to copy-paste (and clean up) your discussion. Please point me to a place where the information best fits.

Bye
Hansi

Reply by email

Darius Blaszijk
to Johann Glaser
Johann Glaser wrote
Is there any documentation (like the things you've written in this thread) in the Wiki? If not, I'd like to copy-paste (and clean up) your discussion. Please point me to a place where the information best fits.

I was also thinking the same ;) . I've created a stub here: http://wiki.freepascal.org/FPMake

This page later can be the basis for documentation that can be distributed with FPC. I'm volunteering for the LaTeX conversion ;)

Darius

Reply by email

Michael Van Canneyt
to Darius Blaszijk
Darius Blaszijk wrote 10 lines
Johann Glaser wrote: > Is there any documentation (like the things you've written in this > thread) in the Wiki? If not, I'd like to copy-paste (and clean up) your > discussion. Please point me to a place where the information best fits. > I was also thinking the same ;) . I've created a stub here: http://wiki.freepascal.org/FPMake This page later can be the basis for documentation that can be distributed with FPC. I'm volunteering for the LaTeX conversion ;)

Well, currently there is no documentation, except the sources and the files you will find all over the RTL/FCL. So the WIKI page may be a good idea.

Michael.

Reply by email