Sign in Join
Wiki copytemporary

pas2js.cfg: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11# Locations
22
33You can see where [[pas2js]] searches for its cfg file and what it finds using the command line parameter **-vt**.
44
55On Unix (Linux, MacOS, BSD) pas2js searches
66
77- \$HOME/.pas2js.cfg - note the dot at the beginning of *.pas2js.cfg*
88- in the directory of the compiler binary. For example if pas2js is installed in */usr/lib/fpc/3.0.4/bin/pas2js*, then it searches */usr/lib/fpc/3.0.4/bin/pas2js.cfg*
99- in */etc/pas2js.cfg*
1010
1111On Windows the compiler searches:
1212
1313- %HOME%\pas2js.cfg
1414- in the directory of the compiler binary. For example if pas2js is installed in *C:\pascal\pas2js\bin\pas2js*, then it searches *C:\pascal\pas2js\bin\pas2js.cfg*
1515
1616You can disable the search for the default config file using the parameter **-n**.
1717
1818You can pass additional config files using the @ parameter. For example:
1919
20-`pas2js -n @/etc/pas2js.cfg`
20+```text
21+pas2js -n @/etc/pas2js.cfg
22+```
2123
2224This will skip the default config file and parse */etc/pas2js.cfg*.
2325
2426# Structure
2527
2628- Leading spaces and tabs are skipped.
2729- Empty lines or lines only containing spaces are skipped
2830- Lines beginning with **\#** followed by a space or tab are comment lines
2931- Lines beginning with \#name are config directives:
3032 - \#IFDEF define
3133 - \#IFNDEF define
3234 - \#IF expression - same as \$if, except only defines
3335 - \#ELSEIF
3436 - \#ELSE
3537 - \#ENDIF
3638 - \#ERROR text
3739- Other lines are treated as single parameters. For example *-FuFol der* is the same as passing *"-FuFol der"* as [command line parameter](https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/utils/pas2js/docs/translation.html?view=co#commandlineparameters).
3840- Search paths (e.g. *-Fu* or *-Fi*) in config files are searched from top to bottom, while on the command line they are searched from right to left.
3941- For *defines* see [Compiler directives](https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/utils/pas2js/docs/translation.html?view=co#compilerdirectives)
4042
4143# Macros
4244
4345- \$Pas2jsFullVersion - major.minor.release\<extra\>
4446- \$Pas2jsVersion - major.minor.release
4547- \$CfgDir - The directory of this config file
4648- \$Env - environment variable, e.g. \$Env(HOME)
4749
4850You can see the supported macros running *pas2js -h*
4951
5052# Examples
5153
5254Here is a typical pas2js.cfg file:
5355
5456 #
5557 # Minimal config file for pas2js compiler
5658 #
5759 # -d is the same as #DEFINE
5860 # -u is the same as #UNDEF
5961 #
6062 # Write always a nice logo ;)
6163 -l
6264
6365 # Display Warnings, Notes and Hints
6466 -vwnh
6567 # If you don't want so much verbosity use
6668 #-vw
6769
6870 # Allow C-operators
6971 -Sc
7072
7173 #IFDEF FPC_SUBTARGET_NAMESPACED
7274 -Fu$CfgDir/../../packages/*/*/namespaced
7375 -Fi$CfgDir/../../packages/*/*/src
7476 #else
7577 -Fu$CfgDir/../../packages/*/*/src
7678 #endif
7779
7880 # path to rtl.js
7981 -Fu../../compiler/utils/pas2js/dist/
8082
8183 #IFDEF nodejs
8284 -Jirtl.js
8385 #ENDIF
8486
8587 # Put all generated JavaScript into one file
8688 -Jc
8789
8890 # end.
8991
9092# Creating pas2js.cfg
9193
9294When you built via **make**, it creates a **pas2js.cfg** in *bin/\$(TargetCPU)-\$(TargetOS)/*.
9395
9496There is a tool to create a basic pas2js.cfg: *tools/createconfig/createconfig*
9597
9698---
9799*From the Free Pascal wiki, page "pas2js.cfg", as it stood on 2024-02-27 after a change by Mattias2, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
98100Category: Pas2js

Back to history