Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-14 Thread Bo Berglund via fpc-pascal
On Mon, 13 Apr 2020 21:41:31 +0200, Joost van der Sluis
 wrote:

>Op 12-04-2020 om 12:01 schreef Bo Berglund via fpc-pascal:
>> This is something I have been wondering about for a while..
>> When I install FPC from sources I have to create a config file by
>> using this command:
>> 
>> /home/user/lib/fpc/$FPCVER/samplecfg "/home/user/lib/fpc/$FPCVER"
>> "/home/user"
>> (replace "user" with the actual username such as pi or whatever)
>> 
>> The problem with this is that the generated file is named fpc.cfg so I
>> have to do a rename afterwards and this is not always remembered (like
>> yesterday).
>
>Can you try running samplecfg without the second parameter and without 
>root-rights? Then it should create a .fpc.cfg in your home-directory. So 
>there is no need to rename the file.
>
>If you supply a second parameter with the location where you want to 
>write the configuration-file to, samplecfg does not know it is in your 
>home-directory, so it will use a normal, visible, file. At least that is 
>how I would say it should work.
>

I did so using the syntax in my script but removing the target dir
argument.
This is what I saw (I had backed up .fpc.cfg first)

~$ /home/bosse/lib/fpc/3.0.4/samplecfg "/home/bosse/lib/fpc/3.0.4"
Running on linux
No write premission in /etc.
Writing sample configuration file to /home/bosse/.fpc.cfg <== HERE!
Writing sample configuration file to
/home/bosse/lib/fpc/3.0.4/ide/text/fp.cfg
Saved old "fp.cfg" to "fp.bak"
Writing sample configuration file to
/home/bosse/lib/fpc/3.0.4/ide/text/fp.ini
Saved old "fp.ini" to "fp.bak"
Writing sample configuration file to /home/bosse/.config/fppkg.cfg
Writing sample configuration file to /home/bosse/.fppkg/config/default

Seems like with the omission of arg 2 the result is thath it writes to
a lot of places including $home (using the leading period in the
name).

I don't know if my original script entry would have only written to
home since it had a target as arg 2?


-- 
Bo Berglund
Developer in Sweden

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-13 Thread fredvs via fpc-pascal
> (Even in an apology, you call us a tri... well, maybe there is a reason
> for that) 

For me a tribe of gurus is not insult, nor tribe, nor gurus, sorry if you
feel it like that.
I surprised by so much reaction for a patch that I proposed.

I will not annoy you anymore, promise.

And if you dont want to accept my apologize, sorry for you and me.

Take care of you.

Fre;D




--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-13 Thread Joost van der Sluis

Op 12-04-2020 om 12:01 schreef Bo Berglund via fpc-pascal:

This is something I have been wondering about for a while..
When I install FPC from sources I have to create a config file by
using this command:

/home/user/lib/fpc/$FPCVER/samplecfg "/home/user/lib/fpc/$FPCVER"
"/home/user"
(replace "user" with the actual username such as pi or whatever)

The problem with this is that the generated file is named fpc.cfg so I
have to do a rename afterwards and this is not always remembered (like
yesterday).


Can you try running samplecfg without the second parameter and without 
root-rights? Then it should create a .fpc.cfg in your home-directory. So 
there is no need to rename the file.


If you supply a second parameter with the location where you want to 
write the configuration-file to, samplecfg does not know it is in your 
home-directory, so it will use a normal, visible, file. At least that is 
how I would say it should work.


Regards,

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-13 Thread Joost van der Sluis

Op 12-04-2020 om 13:30 schreef fredvs via fpc-pascal:

OK, I am ready for the combat, I am sure of my arguments.


I do have a perfect solution for you. I've made a fpc-otb, as you call 
it years (over a decade?) ago.


And i don't even need Michael's patch for it. (The one with the 
configuration-macro)


But I'm not giving it to you.

I don't care that you need it, or that you help others with it. You are 
just too hostile.


I don't understand why Michael has so many patience with you. And still 
tries to help you. And when he does help you, this is the reaction he gets.


People might blame me that I am not willing to help newbies and such. 
But reading all this alone takes too much of my time. Time I could spend 
on something useful. Or users that deserve my help.


Some quoted I had to accept:

> Sorry but not all users are gurus.

(We give you some hints, you blame us for making things too difficult?)

> And sorry also if it dont follow the rules of the good old boy way.

(No explanation necessary)

>  was done not for create a new war but because some features 
are really needed.


(Yep, you think that creating a war is the way to get what you want...)

> And if some similar patches are applied to official fpc, I the 
repository can be deleted.


(Yes, threatening us will help ya)

> Sorry but time goes out, I dont have time to be patient any more.

(You ask us for help, we try to help you, but you don't have the decency 
to give us some patience?)


> And each time that I request it, it finished by insult.

(Yeah, sure. Show me such an insult. Well, maybe this mail, saying you 
are too hostile?)


> @Jonas, I apologize, really, you kindly answered but I feel alone 
against a tribe of gurus who want to eat me.


(Even in an apology, you call us a tri... well, maybe there is a reason 
for that)


Regards,

Joost.

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread wkitty42

On 4/12/20 10:09 AM, wkitt...@windstream.net wrote:
PPS: Bo, if you reply, please include the above PS when you reply to the list so 
that the list manager(s) can see this and maybe they can/will whitelist the 
synacor servers... i've had several postings get blocked in recent days because 
of this problem...



looks like the block has been removed! YAY! :)


--
 NOTE: No off-list assistance is given without prior approval.
   *Please keep mailing list traffic on the list where it belongs!*
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread wkitty42

On 4/12/20 8:26 AM, Bo Berglund via fpc-pascal wrote:

I am used to *not* hide files anytime both on Windows (where I always
configure the explorer to show hidden files) and on Linux where I
always use an ls -la alias ll in order not to hide files.
Never understood the reason for hiding stuff...



the reason for hiding certain files is presentation to the majority of the 
masses... 99.999% of users don't need or want to know about these files... they 
only care that their stuff works and that they can easily find what they are 
looking for without having to dig through a lot of what they would generally 
consider cruft and fluff... programmers and others interested in the 
nitty-gritty details are very much a minority



PS: i'm replying to both, the list and Bo, because the synacor mail server seems 
to be blocked by some spam lists... synacor hosts email for numerous ISPs... 
windstream moved to synacor a few years ago rather than continuing to host their 
own email servers... it is a painful annoyance when legitimate services like 
synacor get blocked like this :(


PPS: Bo, if you reply, please include the above PS when you reply to the list so 
that the list manager(s) can see this and maybe they can/will whitelist the 
synacor servers... i've had several postings get blocked in recent days because 
of this problem...



--
 NOTE: No off-list assistance is given without prior approval.
   *Please keep mailing list traffic on the list where it belongs!*
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread wkitty42

On 4/12/20 7:55 AM, Michael Van Canneyt wrote:

All your OOTB problems can be solved without a single line of code change in the
compiler. Just create a script that people should use to compile instead of 
directly using the 'fpc' command, and specify the configĀ  file in the script, 
and any other options you want for your OOTB experience.



FWIW: fpcup on linux does this script to execute fpc... i was quite glad for it 
when i first used fpc up because it allowed me to find where it put fpc (and 
lazarus) ;)



--
 NOTE: No off-list assistance is given without prior approval.
   *Please keep mailing list traffic on the list where it belongs!*
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread fredvs via fpc-pascal
> Take your pick...

The one I want is missing!

Anyway, thanks Michael, it was hard battles, I win some, but not yet the
war.

Take care of you.

Fre;D




--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread Michael Van Canneyt



On Sun, 12 Apr 2020, fredvs via fpc-pascal wrote:

I would think this is about the biggest failure of all for a compiler ? 


Imo, the worst thing is when the compilation is ok but code are bad
interpreted.


simply because unix does not do this.


OK, like I did for all my arguments, can you prove that?
I never hear that is was forbidden to place a config file in same dir than
executable and forbidden to use that config file in a search.


I never claimed it was forbidden ?

I applaud your efforts to provide an OOTB experience, and I think I have
indicated there are plenty of options available for you to achieve what 
you want without the need to change the compiler any further:

- Correct directory structure in a zip
- Installer instruction style wget https://yoururl/ -O - | bash
- wrapper script for fpc itself.
Take your pick...

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread fredvs via fpc-pascal
>I would think this is about the biggest failure of all for a compiler ? 

Imo, the worst thing is when the compilation is ok but code are bad
interpreted.

> simply because unix does not do this.

OK, like I did for all my arguments, can you prove that?
I never hear that is was forbidden to place a config file in same dir than
executable and forbidden to use that config file in a search.

But, ok, I am very tired of all that discussion, thanks for all what was
already done.

Fre




--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread Bo Berglund via fpc-pascal
On Sun, 12 Apr 2020 12:16:20 +0200 (CEST), Michael Van Canneyt
 wrote:

>You can hardly blame us for you not remembering things... :-)
>
>> Why does fpc look for .fpc.cfg in the user home dir when it is
>> otherwise looking for fpc.cfg?
>
>Because the naming convention on unixes is like that for config files in
>your home directory. This is not fpc specific.

Well, I have used a setup script I wrote years ago to set up
fpc/lazarus on Raspbian so I don't have to remember these things.
Has worked just fine on many RPi units. The rename is hidden inside
the script of course...

And yesterday is the first time I did it on an Ubuntu system and I
adapted the content of the script to manual commands and of course
overlooked a script line that moved the fpc.cfg file to .fpc.cfg

Thanks for the explanation on why it is as it is.

I am used to *not* hide files anytime both on Windows (where I always
configure the explorer to show hidden files) and on Linux where I
always use an ls -la alias ll in order not to hide files.
Never understood the reason for hiding stuff...

Thanks for replying!


-- 
Bo Berglund
Developer in Sweden

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread Michael Van Canneyt



On Sun, 12 Apr 2020, fredvs via fpc-pascal wrote:


committed in rev. 44697


Yep, excellent!


Note that this still may cause surprises, because paramstr(0) is not 100%

reliable.

Hum, ok, but I assume to take the risk.
Finally, the worst that can happen is fail to compil.


I would think this is about the biggest failure of all for a compiler ?



Nice, FPC is nearly OOTB now.
Only miss a very, very little patches: the "so.n" of course and the
searchpath order.


No. Sorry. I don't intend to budge on this last one.
For backwards compatibility and simply because unix does not do this.

I also have not seen any convincing argument why it is needed. 
It's definitely not needed for your "OOTB experience".


In your zip use a directory structure
/bin/
/etc/
and the compiler will find the config file by itself if you place it in etc.

I agree that the .so.n can only be solved in the compiler, but this not.

And to be correct:

All your OOTB problems can be solved without a single line of code change in the
compiler. 
Just create a script that people should use to compile instead of directly using 
the 'fpc' command, and specify the config  file in the script, and any other 
options you want for your OOTB experience.


Inside the script you have the ability to detect whatever you want:
https://stackoverflow.com/questions/59895/how-to-get-the-source-directory-of-a-bash-script-from-within-the-script-itself

You can even call the script 'fpc'.

Most large projects use a script to "sanitize" the environment before starting
the actual binary. Even the firefox browser does this, android studio,
vmware player etc.. (I checked)

And given all the customization you want to do, that seems like the best option
to me, because I get the idea you will do a lot more customization still.

Michael.

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread fredvs via fpc-pascal
> committed in rev. 44697

Yep, excellent!

> Note that this still may cause surprises, because paramstr(0) is not 100%
reliable.

Hum, ok, but I assume to take the risk.
Finally, the worst that can happen is fail to compil.

Nice, FPC is nearly OOTB now.
Only miss a very, very little patches: the "so.n" of course and the
searchpath order.

I feel that "so.n" patch has a possibility to be apply, I dont feel so much
hostility about it.

So I keep my force for the last combat, the "searchpath order":
compiler/option.pas line 3349 

function check_configfile(fn:string; var foundfn:string):boolean;
 
  if not FileExists(fn) then // current dir
if
CfgFileExists(IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)))+fn)
then // add this:
   foundfn:=IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)))+fn //
dir of compiler
else 

Just convince that placing a config file in the same directory than then
compiler is not a crime in Unix.

And prove that directory of compiler has to be in second position for
searching.
And that it will not break any compatibility, even for Windows.

OK, I am ready for the combat, I am sure of my arguments.

Fre;D







--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread Michael Van Canneyt



On Sun, 12 Apr 2020, Sven Barth via fpc-pascal wrote:


Why does fpc look for .fpc.cfg in the user home dir when it is
otherwise looking for fpc.cfg?


Because the naming convention on unixes is like that for config files in
your home directory. This is not fpc specific.

This convention predates the systems used by desktop environments which
nowadays puts
everything in ~/.config or ~/.share or some other convention. But it is
still in use today.



Just for completeness sake: this is not a convention for configuration
files, but for *hidden* files in general. While in the global configuration
directory (/etc) all files are (normally) visible for everyone the idea is
that inside the user's home directory in most cases the user is only
interested in the normal files of themselves when doing a "ls". Hidden
files and directories are only shown with "ls -a". That is why FPC's
configuration file is hidden: its good tone to hide configuration files in
the user's home directory.


Exactly. That is also why the config directory is called .config or .share.
it is then 'hidden' by default.

Thank you for completing my explanation.

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread Sven Barth via fpc-pascal
Michael Van Canneyt  schrieb am So., 12. Apr. 2020,
12:16:

>
>
> On Sun, 12 Apr 2020, Bo Berglund via fpc-pascal wrote:
>
> > On Fri, 10 Apr 2020 13:44:17 -0700 (MST), fredvs via fpc-pascal
> >  wrote:
> >
> >> 2)Your home directory, it looks for .fpc.cfg.
> >
> > This is something I have been wondering about for a while..
> > When I install FPC from sources I have to create a config file by
> > using this command:
> >
> > /home/user/lib/fpc/$FPCVER/samplecfg "/home/user/lib/fpc/$FPCVER"
> > "/home/user"
> > (replace "user" with the actual username such as pi or whatever)
> >
> > The problem with this is that the generated file is named fpc.cfg so I
> > have to do a rename afterwards and this is not always remembered (like
> > yesterday).
>
> You can hardly blame us for you not remembering things... :-)
>
> > Why does fpc look for .fpc.cfg in the user home dir when it is
> > otherwise looking for fpc.cfg?
>
> Because the naming convention on unixes is like that for config files in
> your home directory. This is not fpc specific.
>
> This convention predates the systems used by desktop environments which
> nowadays puts
> everything in ~/.config or ~/.share or some other convention. But it is
> still in use today.
>

Just for completeness sake: this is not a convention for configuration
files, but for *hidden* files in general. While in the global configuration
directory (/etc) all files are (normally) visible for everyone the idea is
that inside the user's home directory in most cases the user is only
interested in the normal files of themselves when doing a "ls". Hidden
files and directories are only shown with "ls -a". That is why FPC's
configuration file is hidden: its good tone to hide configuration files in
the user's home directory.

Regards,
Sven

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread Michael Van Canneyt



On Sun, 12 Apr 2020, Bo Berglund via fpc-pascal wrote:


On Fri, 10 Apr 2020 13:44:17 -0700 (MST), fredvs via fpc-pascal
 wrote:


2)Your home directory, it looks for .fpc.cfg.


This is something I have been wondering about for a while..
When I install FPC from sources I have to create a config file by
using this command:

/home/user/lib/fpc/$FPCVER/samplecfg "/home/user/lib/fpc/$FPCVER"
"/home/user"
(replace "user" with the actual username such as pi or whatever)

The problem with this is that the generated file is named fpc.cfg so I
have to do a rename afterwards and this is not always remembered (like
yesterday).


You can hardly blame us for you not remembering things... :-)


Why does fpc look for .fpc.cfg in the user home dir when it is
otherwise looking for fpc.cfg?


Because the naming convention on unixes is like that for config files in
your home directory. This is not fpc specific.

This convention predates the systems used by desktop environments which 
nowadays puts
everything in ~/.config or ~/.share or some other convention. But it is
still in use today.

So, rather than adapting to the flavour of the day config system, we stick to
what - after all these years - is still common practice on unix, and which
we have been consistently using since day 1.

If you don't like this name, fine: you can set an environment variable to
point the compiler to where it is.

https://www.freepascal.org/docs-html/current/user/usersu10.html#x24-310003.1.5

You only need to do this once.

So it's not like we don't offer you a myriad of ways to specify a config
file...

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread Bo Berglund via fpc-pascal
On Fri, 10 Apr 2020 13:44:17 -0700 (MST), fredvs via fpc-pascal
 wrote:

>2)Your home directory, it looks for .fpc.cfg.

This is something I have been wondering about for a while..
When I install FPC from sources I have to create a config file by
using this command:

/home/user/lib/fpc/$FPCVER/samplecfg "/home/user/lib/fpc/$FPCVER"
"/home/user"
(replace "user" with the actual username such as pi or whatever)

The problem with this is that the generated file is named fpc.cfg so I
have to do a rename afterwards and this is not always remembered (like
yesterday).

Why does fpc look for .fpc.cfg in the user home dir when it is
otherwise looking for fpc.cfg?

And if this is so, should not samplecfg be smart enough to drop off
the correctly named cfg file if the target dir is the user's home dir?


-- 
Bo Berglund
Developer in Sweden

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread Michael Van Canneyt



On Sat, 11 Apr 2020, fredvs via fpc-pascal wrote:


I did try this without luck:

-Fu$PPC_EXEC_PATH/units/$fpctarget
-Fu$PPC_EXEC_PATH/units/$fpctarget/*
-Fu$PPC_EXEC_PATH/units/$fpctarget/rtl


PPC_EXEC_PATH  is an environment variable, not a compiler variable.

see globals.pas:

localexepath:=GetEnvironmentVariable('PPC_EXEC_PATH');

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-12 Thread Michael Van Canneyt



On Sat, 11 Apr 2020, fredvs via fpc-pascal wrote:


I promise, it is the last for tonight.

It would be wonderful if in /compiler/globals.pas, at line 906, you add this
line (or something like that):

{ Replace some macros }

Replace(s,'$FPCPATH',AnsiString(IncludeTrailingBackslash(ExtractFilePath(ParamStr(0);

So in fpc.cfg you may do:

-Fu$FPCPATH/units/$fpctarget
-Fu$FPCPATH/units/$fpctarget/*
-Fu$FPCPATH/units/$fpctarget/rtl

And it works like charm.


That is _exactly_ what I was talking about when I suggested adding some macros.

I added this:

Replace(s,'$FPCBINDIR',ExtractFilePath(FixFileName(system.paramstr(0;

Changed the name because 'Path' is used for search paths.

Note that this still may cause surprises, because paramstr(0) is not 100%
reliable.

committed in rev. 44697

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Alexander Grotewohl
This is an evil travesty and I'm not happy about it:

-Fu$_$/../../lib/fpc/$fpcversion/units/$fpctarget
-Fu$_$/../../lib/fpc/$fpcversion/units/$fpctarget/*
-Fu$_$/../../lib/fpc/$fpcversion/units/$fpctarget/rtl

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of fredvs 
via fpc-pascal 
Sent: Saturday, April 11, 2020 8:52 PM
To: fpc-pascal@lists.freepascal.org 
Cc: fredvs 
Subject: Re: [fpc-pascal] Search path order for fpc.cfg

I promise, it is the last for tonight.

It would be wonderful if in /compiler/globals.pas, at line 906, you add this
line (or something like that):

 { Replace some macros }

Replace(s,'$FPCPATH',AnsiString(IncludeTrailingBackslash(ExtractFilePath(ParamStr(0);

So in fpc.cfg you may do:

-Fu$FPCPATH/units/$fpctarget
-Fu$FPCPATH/units/$fpctarget/*
-Fu$FPCPATH/units/$fpctarget/rtl

And it works like charm.

@Jonas, I apologize, really, you kindly answered but I feel alone against a
tribe of gurus who want to eat me.

OK, I go to sleep (if I can).

Fred










--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
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] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
I promise, it is the last for tonight.

It would be wonderful if in /compiler/globals.pas, at line 906, you add this
line (or something like that):

 { Replace some macros }

Replace(s,'$FPCPATH',AnsiString(IncludeTrailingBackslash(ExtractFilePath(ParamStr(0);

So in fpc.cfg you may do:

-Fu$FPCPATH/units/$fpctarget
-Fu$FPCPATH/units/$fpctarget/*
-Fu$FPCPATH/units/$fpctarget/rtl

And it works like charm.

@Jonas, I apologize, really, you kindly answered but I feel alone against a
tribe of gurus who want to eat me.

OK, I go to sleep (if I can).

Fred










--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
I did try this without luck:

-Fu$PPC_EXEC_PATH/units/$fpctarget
-Fu$PPC_EXEC_PATH/units/$fpctarget/*
-Fu$PPC_EXEC_PATH/units/$fpctarget/rtl

Fred



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
> You can do

> -Fu$PPC_CONFIG_PATH/../units/whatever 

> We can add some extra macros there if you want, 

Could you add the macro PPC_COMPILER_PATH ?

Fred



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
Hello Alexander.

Thanks for the tips, but all that is too much complicated for a totally
newbie.

I did not really understand the argument that is a absolutely wrong way to
store the fpc.cfg in the same directory as the compiler, like it is allowed
for Windows.

But I accept the choice.

With the patch, I agree, it is maybe to simple, unzip it, compile it, no
script needed, no break of compatibility (even I would prefer change the
search order), the fpc.cfg is in the directory of fpc and all the -Fu's are
like -Fu./units/ to point to child directories.

Do you know the OOTB concept?
https://en.wikipedia.org/wiki/Out_of_the_box_(feature)

Fre;D







--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Alexander Grotewohl
Are you always going to be running the compiler from a front-end (IDE, whatever 
else)? Just use code on the other end to find the binary directory and call 
something like "fpc @/home/whereis/fpc/fpc.cfg ..."

You could also use a bash script to wrap the compiler and do something like:
https://stackoverflow.com/questions/59895/how-to-get-the-source-directory-of-a-bash-script-from-within-the-script-itself#59916

To find out where the script is (and therefore where your binaries/config are) 
to use with @ again.

I duno. If you really do this I'd suggest doing it once and writing a correct 
config to .fpc.cfg in their home directory... in that case they can at least 
upgrade fpc independently from the whole project. But that touches the system..

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of fredvs 
via fpc-pascal 
Sent: Saturday, April 11, 2020 11:31:32 AM
To: fpc-pascal@lists.freepascal.org 
Cc: fredvs 
Subject: Re: [fpc-pascal] Search path order for fpc.cfg

> if the .so.n issue was really so urgent for you,

Ho, it was urgent for we since the first time I did use it 15 years ago!

And each time that I request it, it finished by insult.

And when I created uos, problems of linking to libs where solved by
loadlibrary() because with ld it was not possible.

Sorry but now it is the time to change and fast.

Fred




--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
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] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
> if the .so.n issue was really so urgent for you,

Ho, it was urgent for we since the first time I did use it 15 years ago!

And each time that I request it, it finished by insult.

And when I created uos, problems of linking to libs where solved by
loadlibrary() because with ld it was not possible.

Sorry but now it is the time to change and fast.

Fred




--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Michael Van Canneyt



On Sat, 11 Apr 2020, fredvs via fpc-pascal wrote:

You just need to be a little patient 


Huh, if I may, the so.n bug date from 3 years ago and is not yet assigned.


I was referring to the config file issue.

if the .so.n issue was really so urgent for you, you could have brought it up
much earlier here, so I'm inclined not to buy the 'it is urgent' story.

We're just trying to help, but we can't work miracles...

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
> You just need to be a little patient 

Huh, if I may, the so.n bug date from 3 years ago and is not yet assigned.

Sorry Michael but I need a fpc-wob (works out the box) now.
And when all my needs will be fixed in fpc original, I will come back to the
original.

Sorry but time goes out, I dont have time to be patient any more.

Fred 



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Michael Van Canneyt



On Sat, 11 Apr 2020, fredvs via fpc-pascal wrote:


It's perfectly fine to change the name. See e.g. the first answer to
https://stackoverflow.com/questions/4475319/how-to-rebrand-copyright-a-forked-project-gnu-gpl#


Really, did you think that I ever had the idea to change anything in the
copyright and not claim that it is a fork from fpc?

You know what, please choose the name, I will use it.


Better yet, use fpc as it is. It can do all you need already out of the box.

You just need to be a little patient and let us explain properly how to help
you. It would save you a lot of trouble, I think :)

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Jonas Maebe
On 11/04/2020 16:48, fredvs via fpc-pascal wrote:
>> It's perfectly fine to change the name. See e.g. the first answer to
>> https://stackoverflow.com/questions/4475319/how-to-rebrand-copyright-a-forked-project-gnu-gpl#
> Really, did you think that I ever had the idea to change anything in the
> copyright and not claim that it is a fork from fpc?

No, and I never claimed that. You asked whether you could change the
name, and I said "yes, see e.g. here for someone else who also says that
you can do so, and that it's even a good idea to do so".

Please stop acting as if you are attacked when someone simply answers
your questions.


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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
> It's perfectly fine to change the name. See e.g. the first answer to
> https://stackoverflow.com/questions/4475319/how-to-rebrand-copyright-a-forked-project-gnu-gpl#

Really, did you think that I ever had the idea to change anything in the
copyright and not claim that it is a fork from fpc?

You know what, please choose the name, I will use it.

Fred





--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Michael Van Canneyt



On Sat, 11 Apr 2020, fredvs via fpc-pascal wrote:


It will create one in your home directory if it detects you do not have
root access. 


Could you explain that?
Of course if you can show me a trick for configuring a script that will
install fpc in the home directory (.fpc.cfg), with for example the
hard-coded directory /home/user/instantfpc, I will use it.

But the condition will be that the user has nothing write, only run a
script.


The default install.sh used by FPC calls samplecfg to create the config file
for the compiler.

samplecfg is located in compiler/utils.

Line 40 and following contain:

# Detect if we have write permission in sysdir.
if [ -w "$sysdir" ] ; then
  echo Write permission in $sysdir.
  fpccfgfile="$sysdir"/fpc.cfg
  fppkgfile="$sysdir"/fppkg.cfg
  defaultfile="$sysdir"/fppkg/default
  compilerconfigdir="-d CompilerConfigDir=$sysdir/fppkg"
  fppkgconfdir=$sysdir/fppkg/conf.d
else
  echo No write premission in $sysdir.
  fpccfgfile="$HOME"/.fpc.cfg
  fppkgfile="$HOME"/.config/fppkg.cfg
  defaultfile="$HOME"/.fppkg/config/default
  fppkgconfdir="$HOME"/.fppkg/config/conf.d
fi

So as you can see, when the user does not have write permissions in /etc or
/local/etc, it will write a config file in the user home directory, exactly
where the compiler will pick it up.

So you see, we've covered the situation you are trying to solve.

It has been so for ages, all you need to do is use what is there correctly.

There is no need to change anything.

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Jonas Maebe
On 11/04/2020 16:21, fredvs via fpc-pascal wrote:
>>  then you should probably change the name
> Humm, in previous post it was said that I am not allowed to change the name?

It's perfectly fine to change the name. See e.g. the first answer to
https://stackoverflow.com/questions/4475319/how-to-rebrand-copyright-a-forked-project-gnu-gpl#


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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread wkitty42

On 4/11/20 10:16 AM, Jonas Maebe wrote:

On 11/04/2020 15:58, wkitt...@windstream.net wrote:

Does fpc accept relative path for -Fu in the fpc.cfg config file,
something
like:

-Fu../units/$fpctarget
-Fu../units/$fpctarget/*
-Fu../units/$fpctarget/rtl


doesn't the 2nd one already cover the 3rd one?


The default fpc.cfg contains this as well. It's to ensure that in case
of unit name conflicts, the RTL will always get priority. Ideally there
are no such conflicts, but there have been several in the past (and
there are still some between the univint and fv packages today).



thank you for the explanation! i never understood why it was listed like that 
and didn't ever really find an explanation but i didn't look very hard, either...



--
 NOTE: No off-list assistance is given without prior approval.
   *Please keep mailing list traffic on the list where it belongs!*
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
>  then you should probably change the name

Humm, in previous post it was said that I am not allowed to change the name?






--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Jonas Maebe
On 11/04/2020 15:58, wkitt...@windstream.net wrote:
>> Does fpc accept relative path for -Fu in the fpc.cfg config file,
>> something
>> like:
>>
>> -Fu../units/$fpctarget
>> -Fu../units/$fpctarget/*
>> -Fu../units/$fpctarget/rtl
> 
> doesn't the 2nd one already cover the 3rd one?

The default fpc.cfg contains this as well. It's to ensure that in case
of unit name conflicts, the RTL will always get priority. Ideally there
are no such conflicts, but there have been several in the past (and
there are still some between the univint and fv packages today).


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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Jonas Maebe
On 11/04/2020 16:08, fredvs via fpc-pascal wrote:
> Only do a fork, respect the rules of the license and do the change you want
> without be dependent of what the parent of the fork think or do.

If you really want to create a fork that behaves differently from FPC on
some fundamental points, then you should probably change the name at
least a little bit so there won't be confusion when people ask for help
(I'm using FPC - Yes, but which fork of FPC?)


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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
> We have different opinions about what is needed and what is not. Or what
> even is the right approach. 

And it is why I like the concept of open source, different opinions may
exist and no one is obliged to impose his own.

Only do a fork, respect the rules of the license and do the change you want
without be dependent of what the parent of the fork think or do.

And even more, if it is done with goodwill, parent and fork can stimulate
their self.

Fred





--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
> doesn't the 2nd one already cover the 3rd one? 

Yes, sorry, it was just a example of the layout.

Fred



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread wkitty42

On 4/10/20 4:44 PM, fredvs via fpc-pascal wrote:

Does fpc accept relative path for -Fu in the fpc.cfg config file, something
like:

-Fu../units/$fpctarget
-Fu../units/$fpctarget/*
-Fu../units/$fpctarget/rtl



doesn't the 2nd one already cover the 3rd one?


--
 NOTE: No off-list assistance is given without prior approval.
   *Please keep mailing list traffic on the list where it belongs!*
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Sven Barth via fpc-pascal

Am 11.04.2020 um 15:18 schrieb fredvs via fpc-pascal:


I hope that you understand that:

https://github.com/fredvs/freepascal

was done not for create a new war but because some features are really
needed.


We have different opinions about what is needed and what is not. Or what 
even is the right approach.


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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
Hello Michael.

I will deeply study your proposition.

I am also highly interested by this:

> You can do
> -Fu$PPC_CONFIG_PATH/../units/whatever  

Maybe it can solve some problem and the last patch about dealing with './'
will not be needed.

I hope that you understand that:

https://github.com/fredvs/freepascal

was done not for create a new war but because some features are really
needed.

And if some similar patches are applied to official fpc, I the repository
can be deleted.

Fre;D






--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Sven Barth via fpc-pascal

Am 11.04.2020 um 14:46 schrieb fredvs via fpc-pascal:

It will create one in your home directory if it detects you do not have

root access.

Could you explain that?
Of course if you can show me a trick for configuring a script that will
install fpc in the home directory (.fpc.cfg), with for example the
hard-coded directory /home/user/instantfpc, I will use it.

But the condition will be that the user has nothing write, only run a
script.


By default the compiler also looks in ~/.fpc.cfg on *nix systems (and 
then tries /etc/fpc.cfg). So if you have your installation script 
automatically create the correct configuration file using fpcmkcfg 
(distributed with FPC, see $fpcdir/utils/fpcmkcfg) setting up the 
correct paths then your user will be good to go (after all this is what 
FPC's installation script does as well).


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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
> On unix, a simple 'unzip' is simply not the standard way to do things. 

There are tons of application that do that.

GoogleEarth, lot of utilities, ... MSEide,  




--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
> It will create one in your home directory if it detects you do not have
root access. 

Could you explain that?
Of course if you can show me a trick for configuring a script that will
install fpc in the home directory (.fpc.cfg), with for example the
hard-coded directory /home/user/instantfpc, I will use it.

But the condition will be that the user has nothing write, only run a
script.

Fre;D




--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Michael Van Canneyt



On Sat, 11 Apr 2020, fredvs via fpc-pascal wrote:


There's a prompt in the freepascal installer that asks for the prefix. Your

users should be capable of that?

As explained in previous post, the goal is to not touch the system.
If you use the fpc installer, even if you install it in the user's home
directory, the installer will create a fpc.cfg in /etc and that needs root
access.


This is simply not correct.

It will create one in your home directory if it detects you do not have root 
access.


Of course users can do that but the goal of that patch is to have a compiler
totally out-of-the-box, that even dont need to configure or set anything.

Sorry but not all users are gurus.


No-one expects them to be. But if someone is unable to run install.sh,
and type in the name of a directory, then he has no business in programming.

You're not making a chat application, after all. You can expect some
rudimentary understanding of your users.



And sorry also if it dont follow the rules of the good old boy way.


This is not the 'good old boy' way. Why use such derogatory words ?

It's adapting to the system you work on, instead of clinging to wrong concepts 
for that system.

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Michael Van Canneyt



On Sat, 11 Apr 2020, Alexander Grotewohl wrote:


Why not just provide instructions for installation in the user's home directory, for 
example. It's what you'd have to do if you didn't have root access anyways. Then you can 
pretend that it's "cleaner" than just installing it systemwide.

There's a prompt in the freepascal installer that asks for the prefix. Your 
users should be capable of that?


Exactly.

On unix, a simple 'unzip' is simply not the standard way to do things.

As I said, all programs that work like that ask you to execute some script
(in your .bashrc or .cshrc) to set some environment variable. You can simply do 
the
same, or as Alexander points out, use the provided installer script from fpc.

You reason from a windows perspective. This is seldom a good idea on Unices.


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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
> There's a prompt in the freepascal installer that asks for the prefix. Your
users should be capable of that?

As explained in previous post, the goal is to not touch the system.
If you use the fpc installer, even if you install it in the user's home
directory, the installer will create a fpc.cfg in /etc and that needs root
access.

Of course users can do that but the goal of that patch is to have a compiler
totally out-of-the-box, that even dont need to configure or set anything.

Sorry but not all users are gurus.
And sorry also if it dont follow the rules of the good old boy way.

Fred





--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Alexander Grotewohl
Why not just provide instructions for installation in the user's home 
directory, for example. It's what you'd have to do if you didn't have root 
access anyways. Then you can pretend that it's "cleaner" than just installing 
it systemwide.

There's a prompt in the freepascal installer that asks for the prefix. Your 
users should be capable of that?

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of fredvs 
via fpc-pascal 
Sent: Saturday, April 11, 2020 8:07:17 AM
To: fpc-pascal@lists.freepascal.org 
Cc: fredvs 
Subject: Re: [fpc-pascal] Search path order for fpc.cfg

Hello.

The target of that "patched" fpc is mainly the Raspbian RPi.

I want a fpc out-of-the-box, only a zip file that people may unzip where
they want, without need to touch anything to the system.

All what I have found in fpc doc always require to touch to system.

Also, I want that people can compile out-of-the-box, without the need to
install dev package because that army of Rpi is not connected.

I thanks you for the warnings about using fpc.cfg in the same directory than
the compiler.
But for my need there is no problem with that, even if you create a symlink
and run fpc from that symlink.

I do propose my patch here to inform what I am changing in
https://github.com/fredvs/freepascal

Fre;D






--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
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] Search path order for fpc.cfg

2020-04-11 Thread fredvs via fpc-pascal
Hello.

The target of that "patched" fpc is mainly the Raspbian RPi.

I want a fpc out-of-the-box, only a zip file that people may unzip where
they want, without need to touch anything to the system.

All what I have found in fpc doc always require to touch to system.

Also, I want that people can compile out-of-the-box, without the need to
install dev package because that army of Rpi is not connected.

I thanks you for the warnings about using fpc.cfg in the same directory than
the compiler.
But for my need there is no problem with that, even if you create a symlink
and run fpc from that symlink.

I do propose my patch here to inform what I am changing in 
https://github.com/fredvs/freepascal

Fre;D






--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Michael Van Canneyt



On Sat, 11 Apr 2020, Jonas Maebe wrote:


On 11/04/2020 08:24, Michael Van Canneyt wrote:

it is not done on unices to search in the binary directory for config
files. That's a windows thing.


And the main reason for this is that "the" compiler binary does not
necessarily exist. The most obvious case is a hard link: in this case, a
single file exists in multiple locations on the file system. A program
file can also be moved while it was executing.

Even if you ignore the above cases and only care about the directory in
which the binary was found when it was started, then there is still the
issue that not all Unix systems provide you with that information. E.g.
on Darwin/macOS, if you just type "ppcx64", then the "full path" to the
binary that the program gets is "ppcx64" and you have no idea where it's
located. You can use some heuristics like looking in the path, but this
is fragile and might possibly even be used for attacks (it is probably
possible to specify a different PATH environment variable to the child
process than the one used to originally find it).

This is also the reason why most Unix programs have there installation
directory compiled into the binary, and why you often have to specify it
already when building the program (rather than only when installing it).
FPC does not do that due to its DOS and OS/2 heritage, but it's not
something we should extend.


In short: 
the installer should write a 'correct' config file, without tricks

like relative paths.

Many unix programs that can be installed 'anywhere' require you to set
environment variables in order to find where you installed it.

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Jonas Maebe
On 11/04/2020 08:24, Michael Van Canneyt wrote:
> it is not done on unices to search in the binary directory for config
> files. That's a windows thing.

And the main reason for this is that "the" compiler binary does not
necessarily exist. The most obvious case is a hard link: in this case, a
single file exists in multiple locations on the file system. A program
file can also be moved while it was executing.

Even if you ignore the above cases and only care about the directory in
which the binary was found when it was started, then there is still the
issue that not all Unix systems provide you with that information. E.g.
on Darwin/macOS, if you just type "ppcx64", then the "full path" to the
binary that the program gets is "ppcx64" and you have no idea where it's
located. You can use some heuristics like looking in the path, but this
is fragile and might possibly even be used for attacks (it is probably
possible to specify a different PATH environment variable to the child
process than the one used to originally find it).

This is also the reason why most Unix programs have there installation
directory compiled into the binary, and why you often have to specify it
already when building the program (rather than only when installing it).
FPC does not do that due to its DOS and OS/2 heritage, but it's not
something we should extend.


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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-10 Thread Michael Van Canneyt



On Fri, 10 Apr 2020, fredvs via fpc-pascal wrote:


Does fpc accept relative path for -Fu in the fpc.cfg config file, something
like:



-Fu./units/$fpctarget
-Fu./units/$fpctarget/*
-Fu./units/$fpctarget/rtl 


No, it seems that it is not possible.

So I propose to do this, dont hurt existing code, only gives happiness:


That will not happen.

-Fu./something

Can *already* be specified and means relative to the CURRENT working directory, 
not the
compiler binary directory.

Your patch would change this behaviour, and that is not backwards compatible.

You can do

-Fu$PPC_CONFIG_PATH/../units/whatever

(or any other environment variable)

The compiler accepts this. We can add some extra macros there if you want,
but we will not change the behaviour of ./

See also

https://www.freepascal.org/docs-html/current/user/userse18.html#x52-590005.3

But based on this and your other questions, IMO your reasoning is fundamentally 
wrong, you should never rely on the compiler location.


Instead maybe you should explain what the actual problem is you are tying to
solve, then we can help you better instead of explaining what cannot or will
not be done.

After all, we've been doing this for 25+ years.

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-10 Thread Michael Van Canneyt



On Fri, 10 Apr 2020, fredvs via fpc-pascal wrote:


Hello.

According:
https://wiki.freepascal.org/Configuration_file

Under a Unix or Unix-like operating systems (e.g. FreeBSD, Linux)

1)The current directory.
2)Your home directory, it looks for .fpc.cfg.
3)The directory specified in the environment variable PPC_CONFIG_PATH,
and if it is not set, it will look in the etc directory above the compiler
directory. (For instance, if the compiler is in /usr/local/bin, it will look
in /usr/local/etc)
   The directory /etc.

Would it be possible to have a 4th: the directory of the binary compiler and
maybe change his order?


No. That is not backward compatible. 
In the worst case we can add the compiler dir, but as the last.


But even so:
it is not done on unices to search in the binary directory for config
files. That's a windows thing.

Don't introduce this on unices:
You should accept & follow the rules of the platform you're working on.

If you really want that, create a wrapper which sets PPC_CONFIG_PATH to the
compiler bin dir. But I strongly advance against this.


Does fpc accept relative path for -Fu in the fpc.cfg config file, something
like:

-Fu../units/$fpctarget
-Fu../units/$fpctarget/*
-Fu../units/$fpctarget/rtl


Yes.

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


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-10 Thread fredvs via fpc-pascal
> Does fpc accept relative path for -Fu in the fpc.cfg config file, something
> like:

> -Fu./units/$fpctarget
> -Fu./units/$fpctarget/*
> -Fu./units/$fpctarget/rtl 

No, it seems that it is not possible.

So I propose to do this, dont hurt existing code, only gives happiness:

in cfileutls.pas do this:

procedure TSearchPathList.AddPath(s:TCmdStr;addfirst:boolean);  
begin
  if system.copy(s,1,2) = './' then
 begin s :=
AnsiString(IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))) + 
 system.copy(s,3,length(s)-2));
  end;
  AddLibraryPath('',s,AddFirst);
 end;

Tested and re-tested, committed, it works like charms, with fpc.cfg in same
dir than fpc (first patch):

# searchpath for units and other system dependent things
-Fu./units/$fpctarget
-Fu./units/$fpctarget/*
-Fu./units/$fpctarget/rtl

OK, I let you in peace.

Take care of you.

Fre;D



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-10 Thread fredvs via fpc-pascal
Hello.

The last line of function check_configfile(fn:string; var
foundfn:string):boolean;
should be something like this:
   
...
  else
 if CfgFileExists(IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)))+fn)
then
   foundfn:=IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)))+fn
  else  
  check_configfile:=false;





--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-10 Thread fredvs via fpc-pascal
Hello.

In fpc code /compiler/options.pas, for
function check_configfile(fn:string; var foundfn:string):boolean;

 {
Order to read configuration file :
try reading fpc.cfg in :
 1 - current dir
 2 - configpath
 3 - compiler path
  }

But if you check in code, the option 3 is never done.

Fre;D





--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal