Re: [fpc-pascal] fpcmake packaging

2020-09-26 Thread Ben Grasset via fpc-pascal
What you want is FPMake, not FPCMake. FPCMake is just a generator of GNU
makefiles. As Michael said elsewhere though, FPMake is an API designed
specifically for compiling FPC programs, basically. You write a program
using the API, put it in a file that should always be called "fpmake.pp",
and then either invoke fppkg on it or just literally build it with FPC
yourself and run it (as in like, either "fppkg build" in the directory
where your "fpmake.pp" is, or "fpc ./fpmake.pp && ./fpmake build" in the
directory where your "fpmake.pp" is). Again though, since it is literally
just a program, you can also put any custom logic you want in there.

See here for more info: https://wiki.freepascal.org/FPMake

On Tue, Sep 1, 2020 at 9:05 AM Ryan Joseph via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> I've never used fpcmake before and instead relied on my own custom build
> system solutions which are a pain to maintain and non-standard which it
> makes extra work configuring the pascal language server I'm using now.
>
> My first question of fpcmake is, can I package application bundles and
> copy resources using it? For example some things I need to do:
>
> - create a directory structure and copy the executable into it
> - copy resource files that may have changed
> - run some shell commands which apple provides for compiling various
> resources files
> - copy a info.plist text file and replace some patterns in the file to
> reflect the build version
>
> Are those the kind of things fpcmake can do or do I need another build
> system for this?
>
> Regards,
> Ryan Joseph
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpcmake packaging

2020-09-02 Thread Ryan Joseph via fpc-pascal


> On Sep 1, 2020, at 9:04 PM, Tony Whyman via fpc-pascal 
>  wrote:
> 
> My primary motivation for going with fpcmake is that it is a very good fit 
> with the debian package management system (and rpmbuild). My normal build 
> target is Ubuntu and hence I want to generate .deb files in order to 
> distribute my application. The Debian Package Manager does not actually 
> mandate use of makefiles - but it is built around the makefile concept and I 
> have only ever seen examples of use based on makefiles.

Thanks for the detailed explanation. It's pretty intimidating but I guess I 
need to try since it appears to do what I want. You said I can call external 
scripts which is pretty interesting also because I may have some edge cases 
with macOS stuff.

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpcmake packaging

2020-09-01 Thread Tony Whyman via fpc-pascal


On 01/09/2020 14:29, Ryan Joseph via fpc-pascal wrote:



On Sep 1, 2020, at 7:46 PM, Tony Whyman via fpc-pascal 
 wrote:

fpcmake is a pre-processor that generates makefiles for fpc projects. You can 
use it to do just about anything a standard makefile can do, including 
including resource files and running scripts. I use it all the time for 
building production versions of lazarus programs and prior to packaging the 
programs and resources in .deb and .rpm files.

On 01/09/2020 13:37, Ryan Joseph via fpc-pascal wrote:


Apparently there is fpmake and fpcmake, which I didn't know.

I guess what you're saying is that I start with fpcmake and get makefiles which 
I can then use to do packing and all the stuff I need? I've thought of using 
makefiles before but I ran into the problem of have all this logic that I need 
to duplicate for each project. What I'm really after is something more like 
lazbuild that takes a config file and does all the commands for you. I guess I 
could even use lazbuild but again, the packaging doesn't seem possible since 
lazbuild is so Lazarus focused (obviously).

Regards,
Ryan Joseph


My primary motivation for going with fpcmake is that it is a very good 
fit with the debian package management system (and rpmbuild). My normal 
build target is Ubuntu and hence I want to generate .deb files in order 
to distribute my application. The Debian Package Manager does not 
actually mandate use of makefiles - but it is built around the makefile 
concept and I have only ever seen examples of use based on makefiles.


I would position fpcmake as similar to autoconf/ automake in the C/C++ 
work. With automake, you need a Makefile.am in every directory of your 
project that contains something to compile or include in your package. 
With fpcmake you need a Makefile.fpc instead. This file contains the 
directives needed to generate the makefile and looks like an ini file.


An example follows taken from a simple application I have for 
Requirements Management.


The Makefile.fpc uses external environment variables, such as 
"INTERFACE". An external script (or a Debian rules file) that calls 
"make" itself to compile the project would define


export INTERFACE=gtk2

assuming you want gtk2 for your GUI.

Otherwise, the [compiler] section defines the fpc options, and 
directories to search. Most of these are part of my project. I have also 
used environment variables to define the build target and where to find 
the lazarus units. The [install] section is where I tell it  to install 
resource files. This includes an icon for the program and Firebird 
resource files. My project also requires that a .res file is built 
before the program is linked and there is a [prerules] section for this. 
"mkversioninfo" is my own utility, which generates the input to the 
windres utility for .res file generation.


Finally, there is an extra [rules] section to ensure that my resources 
are built when a "make all" is called.


[requires]
packages=fcl-res
libc=y

[compiler]
options= -MDelphi -Scghi -O3 -CX -Xs -vewnhi -l -dUseCThreads -dLCL 
-dLCL$(INTERFACE)

unittargetdir=units/$(CPU_TARGET)-$(OS_TARGET)
includedir=$(LZINCLUDE)
unitdir=$(LAZUNITDIR)/*  $(LAZUNITDIR)/*/$(INTERFACE) \
../frames \
../forms \
../dlg \
../reports \
../ole \
../ \
.


[target]
programs=RequirementsManagerPersonal

[install]
datadir=$(INSTALL_PREFIX)/share/RequirementsManager
files=RequirementsManagerPersonal.xpm firebird.conf firebird.msg

[prerules]
resources:
    rm -f RequirementsManagerPersonal.res
    mkversioninfo requirementsmanager-personal RequirementsManager.ico 
| $(WINDRES) -o RequirementsManagerPersonal.res


[rules]
all: resources fpc_all

A debian rules file for use with fpcmake is usually the same for every 
fpc project i.e.


Note this calls fpcmake automatically. A C/C++ build would call 
"configure" at the same point. I have defined the INTERFACE as an 
argument to the call to make.


#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
#
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of 
dh-make.

#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets  by Bill Allombert 2001

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

export FPCDIR=/usr/lib/fpc/$(shell fpc -iV)

configure: configure-stamp
configure-stamp:
    dh_testdir
    # Add here commands to configure the package.
    fpcmake -r Makefile.fpc

    touch configure-stamp

#Architecture
build: build-arch 

Re: [fpc-pascal] fpcmake packaging

2020-09-01 Thread Tomas Hajny via fpc-pascal

On 2020-09-01 15:29, Ryan Joseph via fpc-pascal wrote:
On Sep 1, 2020, at 7:46 PM, Tony Whyman via fpc-pascal 
 wrote:


fpcmake is a pre-processor that generates makefiles for fpc projects. 
You can use it to do just about anything a standard makefile can do, 
including including resource files and running scripts. I use it all 
the time for building production versions of lazarus programs and 
prior to packaging the programs and resources in .deb and .rpm files.


On 01/09/2020 13:37, Ryan Joseph via fpc-pascal wrote:



Apparently there is fpmake and fpcmake, which I didn't know.

I guess what you're saying is that I start with fpcmake and get
makefiles which I can then use to do packing and all the stuff I need?
I've thought of using makefiles before but I ran into the problem of
have all this logic that I need to duplicate for each project. What
I'm really after is something more like lazbuild that takes a config
file and does all the commands for you. I guess I could even use
lazbuild but again, the packaging doesn't seem possible since lazbuild
is so Lazarus focused (obviously).


In case of fpcmake, the file Makefile.fpc is basically equivalent to a 
configuration file:


-
[package]
name=fcl-res
version=3.3.1

[target]
units=acceleratorsresource bitmapresource coffconsts coffreader 
cofftypes \
  coffwriter dfmreader elfconsts elfreader elftypes elfwriter 
externalreader \
  externaltypes externalwriter fpcrestypes groupcursorresource 
groupiconresource \
  groupresource icocurtypes machoconsts machoreader machotypes 
machowriter \
  resdatastream resfactory resmerger resource resourcetree resreader 
reswriter \
  stringtableresource strtable tlbreader versionconsts 
versionresource versiontypes \

  winpeimagereader xcoffwriter
rsts=versiontypes stringtableresource resource resfactory


[compiler]
options=-S2h
sourcedir=src

[install]
fpcpackage=y

[default]
fpcdir=../..

[rules]
.NOTPARALLEL:


You _may_ define additional logic (on top of the prebuilt things known 
to the fpcmake tool / defined in fpcmake.ini) in the [rules] section, 
but that is not strictly necessary as long as you don't have special 
dependencies, don't need to invoke the compiler or other tools with 
special parameters for different targets, etc.


In case of fpmake, the "configuration" is a rather simple pascal program 
(fpmake.pp):


-
{$ifndef ALLPACKAGES}
{$mode objfpc}{$H+}
program fpmake;

uses fpmkunit;

Var
  T : TTarget;
  P : TPackage;
begin
  With Installer do
begin
{$endif ALLPACKAGES}

P:=AddPackage('fcl-res');
P.ShortName:='fcle';
{$ifdef ALLPACKAGES}
P.Directory:=ADirectory;
{$endif ALLPACKAGES}
P.Version:='3.3.1';
P.Dependencies.Add('rtl-objpas');
P.Dependencies.Add('fcl-base');
P.Dependencies.Add('tplylib');
P.Author := 'Giulio Bernardi';
P.License := 'LGPL with modification, ';
P.HomepageURL := 'www.freepascal.org';
P.Email := '';
P.Description := 'Resource handling of Free Component Libraries 
(FCL), FPC''s OOP library.';

P.NeedLibC:= false;

P.OSes:=AllOSes-[embedded,msdos,win16,macosclassic,palmos,zxspectrum,msxdos,amstradcpc];

if Defaults.CPU=jvm then
  P.OSes := P.OSes - [java,android];

P.SourcePath.Add('src');
P.IncludePath.Add('src');

T:=P.Targets.AddUnit('acceleratorsresource.pp');
  with T.Dependencies do
begin
  AddUnit('resource');
  AddUnit('resfactory');
end;
T:=P.Targets.AddUnit('bitmapresource.pp');
  with T.Dependencies do
begin
  AddUnit('resource');
  AddUnit('resfactory');
  AddUnit('resdatastream');
end;
T:=P.Targets.AddUnit('coffconsts.pp');
T:=P.Targets.AddUnit('cofftypes.pp');
T:=P.Targets.AddUnit('coffreader.pp');
  with T.Dependencies do
begin
  AddUnit('resource');
  AddUnit('resourcetree');
  AddUnit('cofftypes');
  AddUnit('coffconsts');
  AddUnit('resdatastream');
end;
T:=P.Targets.AddUnit('coffwriter.pp');
  with T.Dependencies do
begin
  AddUnit('resource');
  AddUnit('resourcetree');
  AddUnit('cofftypes');
  AddUnit('coffconsts');
end;
T:=P.Targets.AddUnit('xcoffwriter.pp');
  with T.Dependencies do
begin
  AddUnit('cofftypes');
  AddUnit('coffwriter');
  AddUnit('coffconsts');
  AddUnit('fpcrestypes');
end;
T:=P.Targets.AddUnit('dfmreader.pp');
  with T.Dependencies do
begin
  AddUnit('resource');
  AddUnit('resdatastream');
  AddUnit('resfactory');
end;
T:=P.Targets.AddUnit('tlbreader.pp');
  with T.Dependencies do
begin
  AddUnit('resource');
  AddUnit('resdatastream');
  AddUnit('resfactory');
end;
T:=P.Targets.AddUnit('elfconsts.pp');

Re: [fpc-pascal] fpcmake packaging

2020-09-01 Thread Ryan Joseph via fpc-pascal


> On Sep 1, 2020, at 7:46 PM, Tony Whyman via fpc-pascal 
>  wrote:
> 
> fpcmake is a pre-processor that generates makefiles for fpc projects. You can 
> use it to do just about anything a standard makefile can do, including 
> including resource files and running scripts. I use it all the time for 
> building production versions of lazarus programs and prior to packaging the 
> programs and resources in .deb and .rpm files.
> 
> On 01/09/2020 13:37, Ryan Joseph via fpc-pascal wrote:
> 

Apparently there is fpmake and fpcmake, which I didn't know.

I guess what you're saying is that I start with fpcmake and get makefiles which 
I can then use to do packing and all the stuff I need? I've thought of using 
makefiles before but I ran into the problem of have all this logic that I need 
to duplicate for each project. What I'm really after is something more like 
lazbuild that takes a config file and does all the commands for you. I guess I 
could even use lazbuild but again, the packaging doesn't seem possible since 
lazbuild is so Lazarus focused (obviously).

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpcmake packaging

2020-09-01 Thread Tony Whyman via fpc-pascal
fpcmake is a pre-processor that generates makefiles for fpc projects. 
You can use it to do just about anything a standard makefile can do, 
including including resource files and running scripts. I use it all the 
time for building production versions of lazarus programs and prior to 
packaging the programs and resources in .deb and .rpm files.


On 01/09/2020 13:37, Ryan Joseph via fpc-pascal wrote:

I've never used fpcmake before and instead relied on my own custom build system 
solutions which are a pain to maintain and non-standard which it makes extra 
work configuring the pascal language server I'm using now.

My first question of fpcmake is, can I package application bundles and copy 
resources using it? For example some things I need to do:

- create a directory structure and copy the executable into it
- copy resource files that may have changed
- run some shell commands which apple provides for compiling various resources 
files
- copy a info.plist text file and replace some patterns in the file to reflect 
the build version

Are those the kind of things fpcmake can do or do I need another build system 
for this?

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpcmake packaging

2020-09-01 Thread Michael Van Canneyt via fpc-pascal



On Tue, 1 Sep 2020, Ryan Joseph via fpc-pascal wrote:


I've never used fpcmake before and instead relied on my own custom build system 
solutions which are a pain to maintain and non-standard which it makes extra 
work configuring the pascal language server I'm using now.

My first question of fpcmake is, can I package application bundles and copy 
resources using it? For example some things I need to do:

- create a directory structure and copy the executable into it
- copy resource files that may have changed
- run some shell commands which apple provides for compiling various resources 
files
- copy a info.plist text file and replace some patterns in the file to reflect 
the build version

Are those the kind of things fpcmake can do or do I need another build system 
for this?


Are you talking about fpcmake or fpmake ?
The former just generates a Makefile based on a .ini template.

The latter is an environment for compiling, but it is pascal code so you can
do anything you want in it.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] fpcmake packaging

2020-09-01 Thread Ryan Joseph via fpc-pascal
I've never used fpcmake before and instead relied on my own custom build system 
solutions which are a pain to maintain and non-standard which it makes extra 
work configuring the pascal language server I'm using now.

My first question of fpcmake is, can I package application bundles and copy 
resources using it? For example some things I need to do:

- create a directory structure and copy the executable into it
- copy resource files that may have changed
- run some shell commands which apple provides for compiling various resources 
files
- copy a info.plist text file and replace some patterns in the file to reflect 
the build version

Are those the kind of things fpcmake can do or do I need another build system 
for this?

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal