Sign in Join

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

Mailing lists / fpc-pascal / 2014-07

Using a custom fpc.cfg

13 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

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

luciano de souza

Hello all,

In my application, I want to use a custom fpc.cfg. As I work only with commandline tools, this is an important file for me.

I have used fpcmkcfg to generate a brand new fpc.cfg.

In my application, I have a directory for configuration files. I thought in placing fpc.cfg there in stead of the same directory of the executable.

What I want to know is: is there a commandline parameter to specify a new name or, at least, a new directory to fpc.cfg file?

For example, in stead of placing fpc.cfg in ./, I want to place it in ./Settings.

I use fpc 2.6.4.

Luciano de Souza

Reply by email

Reinier Olislagers
to luciano de souza
luciano de souza wrote
What I want to know is: is there a commandline parameter to specify a new name or, at least, a new directory to fpc.cfg file?

Yes, there is (I suspect it's fpc @/path/to/your/fpc.cfg) but the default config files (e.g. /etc/fpc/fpc.cfg or something) will still be read.
You'll need to use fpc with the -n option to avoid that.

Reply by email

Karoly Balogh (Charlie/SGR
to luciano de souza: In my application, I want to use a custom fpc.cfg. As I work only with commandline tools,…

Hi,

luciano de souza wrote
What I want to know is: is there a commandline parameter to specify a new name or, at least, a new directory to fpc.cfg file?

There's an environment variable called PPC_CONFIG_PATH you can set to tell the compiler the new config location. It's detailed in the documentation, here:

http://www.freepascal.org/docs-html/user/usersu10.html

Hope this helps,

Charlie

Reply by email

Mark Morgan Lloyd
to Reinier Olislagers: Yes, there is (I suspect it's fpc @/path/to/your/fpc.cfg) but the default config files…
Reinier Olislagers wrote 8 lines
On 07/07/2014 11:10, luciano de souza wrote: > What I want to know is: is there a commandline parameter to specify a > new name or, at least, a new directory to fpc.cfg file? Yes, there is (I suspect it's fpc @/path/to/your/fpc.cfg) but the default config files (e.g. /etc/fpc/fpc.cfg or something) will still be read. You'll need to use fpc with the -n option to avoid that.

Incidentally, how does one get a list of fpc's options? I don't mean fpc -h since that actually shows ppcXXX's options, but how does one get minimal info on fpc itself such as a reminder of the -V option?

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Henry Vermaak
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 13 lines
Reinier Olislagers wrote: >On 07/07/2014 11:10, luciano de souza wrote: >>What I want to know is: is there a commandline parameter to specify a >>new name or, at least, a new directory to fpc.cfg file? > >Yes, there is (I suspect it's fpc @/path/to/your/fpc.cfg) but the >default config files (e.g. /etc/fpc/fpc.cfg or something) will still be >read. >You'll need to use fpc with the -n option to avoid that. Incidentally, how does one get a list of fpc's options? I don't mean fpc -h since that actually shows ppcXXX's options, but how does one get minimal info on fpc itself such as a reminder of the -V option?

I don't think there's a way, except for looking at the source.

Henry

Reply by email

Tomas Hajny
to Mark Morgan Lloyd: Incidentally, how does one get a list of fpc's options? I don't mean fpc -h since that…
Mark Morgan Lloyd wrote 13 lines
Reinier Olislagers wrote: > On 07/07/2014 11:10, luciano de souza wrote: >> What I want to know is: is there a commandline parameter to specify a >> new name or, at least, a new directory to fpc.cfg file? > > Yes, there is (I suspect it's fpc @/path/to/your/fpc.cfg) but the > default config files (e.g. /etc/fpc/fpc.cfg or something) will still be > read. > You'll need to use fpc with the -n option to avoid that. Incidentally, how does one get a list of fpc's options? I don't mean fpc -h since that actually shows ppcXXX's options, but how does one get minimal info on fpc itself such as a reminder of the -V option?

In trunk, fpc -h shows all options supported by either fpc or ppcXXX (technically, ppcXXX still shows the list, but it includes fpc specific options if invoked from fpc). The part handled specifically by fpc should not be of such a high interest normally, but it may be obtained by diffing the output of both.

BTW, the parameter '@' mentioned here is apparently not shown in the options list produced by either -? or -h... ;-)

Tomas

Reply by email

Tomas Hajny
to Henry Vermaak: I don't think there's a way, except for looking at the source. Henry
Henry Vermaak wrote 16 lines
On Tue, Jul 08, 2014 at 10:33:06AM +0100, Mark Morgan Lloyd wrote: > Reinier Olislagers wrote: > >On 07/07/2014 11:10, luciano de souza wrote: > >>What I want to know is: is there a commandline parameter to specify a > >>new name or, at least, a new directory to fpc.cfg file? > > > >Yes, there is (I suspect it's fpc @/path/to/your/fpc.cfg) but the > >default config files (e.g. /etc/fpc/fpc.cfg or something) will still be > >read. > >You'll need to use fpc with the -n option to avoid that. > > Incidentally, how does one get a list of fpc's options? I don't mean > fpc -h since that actually shows ppcXXX's options, but how does one > get minimal info on fpc itself such as a reminder of the -V option? I don't think there's a way, except for looking at the source.

Not in released versions indeed, only in trunk.

Tomas

Reply by email

Mark Morgan Lloyd
to Tomas Hajny: In trunk, fpc -h shows all options supported by either fpc or ppcXXX (technically, ppcXXX…
Tomas Hajny wrote 9 lines
> Incidentally, how does one get a list of fpc's options? I don't mean > fpc -h since that actually shows ppcXXX's options, but how does one get > minimal info on fpc itself such as a reminder of the -V option? In trunk, fpc -h shows all options supported by either fpc or ppcXXX (technically, ppcXXX still shows the list, but it includes fpc specific options if invoked from fpc). The part handled specifically by fpc should not be of such a high interest normally, but it may be obtained by diffing the output of both.

I agree that it's obscure, but there was discussion of -V a few weeks ago in the context of starting Lazarus and I needed a reminder yesterday. source, I note also -PP and -PB with the apparent "health warning" that they aren't qualified by the -V parameter.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Tomas Hajny
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 19 lines
Tomas Hajny wrote: >> Incidentally, how does one get a list of fpc's options? I don't mean >> fpc -h since that actually shows ppcXXX's options, but how does one >> get >> minimal info on fpc itself such as a reminder of the -V option? > > In trunk, fpc -h shows all options supported by either fpc or ppcXXX > (technically, ppcXXX still shows the list, but it includes fpc specific > options if invoked from fpc). The part handled specifically by fpc > should > not be of such a high interest normally, but it may be obtained by > diffing > the output of both. I agree that it's obscure, but there was discussion of -V a few weeks ago in the context of starting Lazarus and I needed a reminder yesterday. source, I note also -PP and -PB with the apparent "health warning" that they aren't qualified by the -V parameter.

I meant specifically that most users should not need to differentiate between options handled by fpc and options handled by ppcXXX.

Anyway - if you want to find out options specific to the fpc helper (and/or you don't have a compiled trunk compiler readily available), you can also use:

grep -e "^F\*" < fpcsrc/compiler/msg/errore.msg | cut -c3- | sed "s/^1/-/" | sed "s/^2/ -/" | sed "s/_/ /"

(again, you need the trunk version of errore.msg as available e.g. from http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/compiler/msg/errore.msg?revision=28152&view=co)

That gives the following list:

-P<x> Target CPU / compiler related options:
-PB Show default compiler binary
-PP Show default target cpu
-P<x> Set target CPU
(arm,i386,m68k,mips,mipsel,powerpc,powerpc64,sparc,x86_64 -V<x> Append '-<x>' to the used compiler binary name (e.g. for version) -Xp<x> First search for the compiler binary in the directory <x>

Tomas

Reply by email

Unknown author
to Tomas Hajny
Tomas Hajny wrote 30 lines
On Tue, July 8, 2014 12:07, Mark Morgan Lloyd wrote: > Tomas Hajny wrote: > >>> Incidentally, how does one get a list of fpc's >>> options? I don't mean fpc -h since that actually >>> shows ppcXXX's options, but how does one get minimal >>> info on fpc itself such as a reminder of the -V >>> option? >> >> In trunk, fpc -h shows all options supported by either >> fpc or ppcXXX (technically, ppcXXX still shows the >> list, but it includes fpc specific options if invoked >> from fpc). The part handled specifically by fpc should >> not be of such a high interest normally, but it may be >> obtained by diffing the output of both. > > I agree that it's obscure, but there was discussion of -V a few weeks > ago in the context of starting Lazarus and I needed a reminder > yesterday. source, I note also -PP and -PB with the > apparent "health warning" that they aren't qualified by the -V parameter. I meant specifically that most users should not need to differentiate between options handled by fpc and options handled by ppcXXX. Anyway - if you want to find out options specific to the fpc helper (and/or you don't have a compiled trunk compiler readily available), you can also use: grep -e "^F\*" < fpcsrc/compiler/msg/errore.msg | cut -c3- | sed "s/^1/-/" | sed "s/^2/ -/" | sed "s/_/ /"

Yes, I should know better than to reply here on this, but I am fascinated by how this one line UNIX command can parse the error message source file and extract the option information.

In general would it be more efficient to combine all the sed commands into one with multiple -e options, saving the extra pipes between commands, or would there be drawbacks?

grep -e "^F\*" < fpcsrc/compiler/msg/errore.msg | cut -c3- | sed -e "s/^1/-/" -e "s/^2/ -/" -e "s/_/ /"

Apologies for being off-topic. I am interested in what it is safely compatible to do across various environments in clever compile scripts.

Show quoted text 14 lines
(again, you need the trunk version of errore.msg as available e.g. from http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/compiler/msg/errore.msg?revision=28152&view=co) That gives the following list: -P<x> Target CPU / compiler related options: -PB Show default compiler binary -PP Show default target cpu -P<x> Set target CPU (arm,i386,m68k,mips,mipsel,powerpc,powerpc64,sparc,x86_64 -V<x> Append '-<x>' to the used compiler binary name (e.g. for version) -Xp<x> First search for the compiler binary in the directory <x> Tomas

Reply by email

Tomas Hajny
to Unknown author
Show quoted text 9 lines
On Tue, Jul 08, 2014 at 01:21:07PM +0200, Tomas Hajny wrote: >On Tue, July 8, 2014 12:07, Mark Morgan Lloyd wrote: >> Tomas Hajny wrote: >> >>>> Incidentally, how does one get a list of fpc's >>>> options? I don't mean fpc -h since that actually >>>> shows ppcXXX's options, but how does one get minimal >>>> info on fpc itself such as a reminder of the -V >>>> option?

.
.

Show quoted text 22 lines
>Anyway - if you want to find out options specific to the fpc helper >(and/or you don't have a compiled trunk compiler readily available), you >can also use: > >grep -e "^F\*" < fpcsrc/compiler/msg/errore.msg | cut -c3- | >sed "s/^1/-/" | sed "s/^2/ -/" | sed "s/_/ /" Yes, I should know better than to reply here on this, but I am fascinated by how this one line UNIX command can parse the error message source file and extract the option information. In general would it be more efficient to combine all the sed commands into one with multiple -e options, saving the extra pipes between commands, or would there be drawbacks? grep -e "^F\*" < fpcsrc/compiler/msg/errore.msg | cut -c3- | sed -e "s/^1/-/" -e "s/^2/ -/" -e "s/_/ /" Apologies for being off-topic. I am interested in what it is safely compatible to do across various environments in clever compile scripts.

<OT>Combining it would be indeed more efficient; I'm no expert on sed and simply didn't bother to try being efficient . I don't think that there should be any drawbacks, but I don't want to pretend to have any special knowledge of possible differences in various sed implementations.</OT>

BTW, I just added the previously missing information about option '@' to the help pages in trunk (together with some improvements necessary to show this option properly).

Tomas

Reply by email

Mark Morgan Lloyd
to Tomas Hajny
Tomas Hajny wrote 15 lines
> grep -e "^F\*" < fpcsrc/compiler/msg/errore.msg | cut -c3- | > sed -e "s/^1/-/" -e "s/^2/ -/" -e "s/_/ /" > > Apologies for being off-topic. I am interested in what it > is safely compatible to do across various environments in > clever compile scripts. <OT>Combining it would be indeed more efficient; I'm no expert on sed and simply didn't bother to try being efficient . I don't think that there should be any drawbacks, but I don't want to pretend to have any special knowledge of possible differences in various sed implementations.</OT> BTW, I just added the previously missing information about option '@' to the help pages in trunk (together with some improvements necessary to show this option properly).

Sed, awk, tr and a number of other unix utilities are, perhaps fortunately, used comparatively seldom these days. Since the command lines are notoriously cryptic, I think there's a strong argument for keeping individual stages of a filtering operation as simple as possible; this also allows stages to be lopped easily for debugging.

http://xkcd.com/1168/

And that particularly applies in a context where a significant proportion of readers don't use unix, and have no inclination to try.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email