pas2js.cfg: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: pas2js.cfg
| Old | New | Line | |
|---|---|---|---|
| 1 | + | # Locations | |
| 2 | + | ||
| 3 | + | You can see where [[pas2js]] searches for its cfg file and what it finds using the command line parameter **-vt**. | |
| 4 | + | ||
| 5 | + | On Unix (Linux, MacOS, BSD) pas2js searches | |
| 6 | + | ||
| 7 | + | - \$HOME/.pas2js.cfg - note the dot at the beginning of *.pas2js.cfg* | |
| 8 | + | - 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* | |
| 9 | + | - in */etc/pas2js.cfg* | |
| 10 | + | ||
| 11 | + | On Windows the compiler searches: | |
| 12 | + | ||
| 13 | + | - %HOME%\pas2js.cfg | |
| 14 | + | - 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* | |
| 15 | + | ||
| 16 | + | You can disable the search for the default config file using the parameter **-n**. | |
| 17 | + | ||
| 18 | + | You can pass additional config files using the @ parameter. For example: | |
| 19 | + | ||
| 20 | + | `pas2js -n @/etc/pas2js.cfg` | |
| 21 | + | ||
| 22 | + | This will skip the default config file and parse */etc/pas2js.cfg*. | |
| 23 | + | ||
| 24 | + | # Structure | |
| 25 | + | ||
| 26 | + | - Leading spaces and tabs are skipped. | |
| 27 | + | - Empty lines or lines only containing spaces are skipped | |
| 28 | + | - Lines beginning with **\#** followed by a space or tab are comment lines | |
| 29 | + | - Lines beginning with \#name are config directives: | |
| 30 | + | - \#IFDEF define | |
| 31 | + | - \#IFNDEF define | |
| 32 | + | - \#IF expression - same as \$if, except only defines | |
| 33 | + | - \#ELSEIF | |
| 34 | + | - \#ELSE | |
| 35 | + | - \#ENDIF | |
| 36 | + | - \#ERROR text | |
| 37 | + | - 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). | |
| 38 | + | - 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. | |
| 39 | + | - For *defines* see [Compiler directives](https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/utils/pas2js/docs/translation.html?view=co#compilerdirectives) | |
| 40 | + | ||
| 41 | + | # Macros | |
| 42 | + | ||
| 43 | + | - \$Pas2jsFullVersion - major.minor.release\<extra\> | |
| 44 | + | - \$Pas2jsVersion - major.minor.release | |
| 45 | + | - \$CfgDir - The directory of this config file | |
| 46 | + | - \$Env - environment variable, e.g. \$Env(HOME) | |
| 47 | + | ||
| 48 | + | You can see the supported macros running *pas2js -h* | |
| 49 | + | ||
| 50 | + | # Examples | |
| 51 | + | ||
| 52 | + | Here is a typical pas2js.cfg file: | |
| 53 | + | ||
| 54 | + | # | |
| 55 | + | # Minimal config file for pas2js compiler | |
| 56 | + | # | |
| 57 | + | # -d is the same as #DEFINE | |
| 58 | + | # -u is the same as #UNDEF | |
| 59 | + | # | |
| 60 | + | # Write always a nice logo ;) | |
| 61 | + | -l | |
| 62 | + | ||
| 63 | + | # Display Warnings, Notes and Hints | |
| 64 | + | -vwnh | |
| 65 | + | # If you don't want so much verbosity use | |
| 66 | + | #-vw | |
| 67 | + | ||
| 68 | + | # Allow C-operators | |
| 69 | + | -Sc | |
| 70 | + | ||
| 71 | + | #IFDEF FPC_SUBTARGET_NAMESPACED | |
| 72 | + | -Fu$CfgDir/../../packages/*/*/namespaced | |
| 73 | + | -Fi$CfgDir/../../packages/*/*/src | |
| 74 | + | #else | |
| 75 | + | -Fu$CfgDir/../../packages/*/*/src | |
| 76 | + | #endif | |
| 77 | + | ||
| 78 | + | # path to rtl.js | |
| 79 | + | -Fu../../compiler/utils/pas2js/dist/ | |
| 80 | + | ||
| 81 | + | #IFDEF nodejs | |
| 82 | + | -Jirtl.js | |
| 83 | + | #ENDIF | |
| 84 | + | ||
| 85 | + | # Put all generated JavaScript into one file | |
| 86 | + | -Jc | |
| 87 | + | ||
| 88 | + | # end. | |
| 89 | + | ||
| 90 | + | # Creating pas2js.cfg | |
| 91 | + | ||
| 92 | + | When you built via **make**, it creates a **pas2js.cfg** in *bin/\$(TargetCPU)-\$(TargetOS)/*. | |
| 93 | + | ||
| 94 | + | There is a tool to create a basic pas2js.cfg: *tools/createconfig/createconfig* | |
| 95 | + | ||
| 96 | + | --- | |
| 97 | + | *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).* | |
| 98 | + | Category: Pas2js |
