diff options
author | William Deegan <bill@baddogconsulting.com> | 2022-05-15 01:01:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-15 01:01:48 (GMT) |
commit | 6f6dcfec2a0a051efd75ace4babce46162617325 (patch) | |
tree | 398b8330ddd4f4190c84e541b6198c0b29d9fd3f /doc | |
parent | 73ea66f408c2797464e02fa9bf8e80564ba03dba (diff) | |
parent | fdae889759be56c6299bcedc577aecf2225f0190 (diff) | |
download | SCons-6f6dcfec2a0a051efd75ace4babce46162617325.zip SCons-6f6dcfec2a0a051efd75ace4babce46162617325.tar.gz SCons-6f6dcfec2a0a051efd75ace4babce46162617325.tar.bz2 |
Merge branch 'master' into msvc/cachefix
Diffstat (limited to 'doc')
-rw-r--r-- | doc/man/scons.xml | 29 | ||||
-rw-r--r-- | doc/user/environments.xml | 2 | ||||
-rw-r--r-- | doc/user/mergeflags.xml | 36 | ||||
-rw-r--r-- | doc/user/parseconfig.xml | 44 | ||||
-rw-r--r-- | doc/user/parseflags.xml | 19 |
5 files changed, 74 insertions, 56 deletions
diff --git a/doc/man/scons.xml b/doc/man/scons.xml index 733db78..a5eff28 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -7247,23 +7247,38 @@ A tool specification module must include two functions: <varlistentry> <term><function>generate</function>(<parameter>env, **kwargs</parameter>)</term> <listitem> -<para>Modifies the &consenv; <parameter>env</parameter> -to set up necessary &consvars; so that the facilities represented by -the tool can be executed. -It may use any keyword arguments -that the user supplies in <parameter>kwargs</parameter> +<para>Modify the &consenv; <parameter>env</parameter> +to set up necessary &consvars;, Builders, Emitters, etc., +so the facilities represented by the tool can be executed. +Care should be taken not to overwrite &consvars; intended +to be settable by the user. For example: +</para> +<programlisting language="python"> +def generate(env): + ... + if 'MYTOOL' not in env: + env['MYTOOL'] = env.Detect("mytool") + if 'MYTOOLFLAGS' not in env: + env['MYTOOLFLAGS'] = SCons.Util.CLVar('--myarg') + ... +</programlisting> + +<para>The <function>generate</function> function +may use any keyword arguments +that the user supplies via <parameter>kwargs</parameter> to vary its initialization.</para> </listitem> </varlistentry> <varlistentry> <term><function>exists</function>(<parameter>env</parameter>)</term> <listitem> -<para>Returns <constant>True</constant> if the tool can +<para>Return a true value if the tool can be called in the context of <parameter>env</parameter>. +else false. Usually this means looking up one or more known programs using the <varname>PATH</varname> from the supplied <parameter>env</parameter>, but the tool can -make the "exists" decision in any way it chooses. +make the <emphasis>exists</emphasis> decision in any way it chooses. </para> </listitem> </varlistentry> diff --git a/doc/user/environments.xml b/doc/user/environments.xml index 03dc89e..7118f21 100644 --- a/doc/user/environments.xml +++ b/doc/user/environments.xml @@ -1618,7 +1618,7 @@ env.PrependUnique(CCFLAGS=['-g']) <para> - Rather than creating a cloned environmant for specific tasks, + Rather than creating a cloned &consenv; for specific tasks, you can <firstterm>override</firstterm> or add construction variables when calling a builder method by passing them as keyword arguments. The values of these overridden or added variables will only be in diff --git a/doc/user/mergeflags.xml b/doc/user/mergeflags.xml index 5a864b1..18c9bb8 100644 --- a/doc/user/mergeflags.xml +++ b/doc/user/mergeflags.xml @@ -2,7 +2,7 @@ <!DOCTYPE sconsdoc [ <!ENTITY % scons SYSTEM "../scons.mod"> %scons; - + <!ENTITY % builders-mod SYSTEM "../generated/builders.mod"> %builders-mod; <!ENTITY % functions-mod SYSTEM "../generated/functions.mod"> @@ -21,7 +21,9 @@ <!-- - __COPYRIGHT__ + MIT License + + Copyright The SCons Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -46,16 +48,16 @@ <para> - &SCons; &consenvs; have an &f-link-env-MergeFlags; method - that merges values from a passed-in argument into the &consenv; + &SCons; &consenvs; have a &f-link-MergeFlags; method + that merges values from a passed-in argument into the &consenv;. If the argument is a dictionary, &MergeFlags; treats each value in the dictionary - as a list of options such as one might pass to a command + as a list of options you would pass to a command (such as a compiler or linker). &MergeFlags; will not duplicate an option - if it already exists in the construction environment variable. + if it already exists in the &consvar;. If the argument is a string, &MergeFlags; calls the - &f-link-env-ParseFlags; method to burst it out into a + &f-link-ParseFlags; method to burst it out into a dictionary first, then acts on the result. </para> @@ -82,7 +84,7 @@ env = Environment() env.Append(CCFLAGS='-option -O3 -O1') flags = {'CCFLAGS': '-whatever -O3'} env.MergeFlags(flags) -print(env['CCFLAGS']) +print("CCFLAGS:", env['CCFLAGS']) </file> </scons_example> @@ -99,7 +101,7 @@ print(env['CCFLAGS']) --> is an internal &SCons; object which automatically converts - the options we specified as a string into a list. + the options you specify as a string into a list. </para> @@ -109,7 +111,7 @@ env = Environment() env.Append(CPPPATH=['/include', '/usr/local/include', '/usr/include']) flags = {'CPPPATH': ['/usr/opt/include', '/usr/local/include']} env.MergeFlags(flags) -print(env['CPPPATH']) +print("CPPPATH:", env['CPPPATH']) </file> </scons_example> @@ -124,9 +126,9 @@ print(env['CPPPATH']) [TODO: for when we make CLVar public] is a Python list, not a <varname>CLVar</varname>, --> - is a normal Python list, - so we must specify its values as a list - in the dictionary we pass to the &MergeFlags; function. + is a normal &Python; list, + so you should give its values as a list + in the dictionary you pass to the &MergeFlags; function. </para> @@ -143,8 +145,8 @@ env = Environment() env.Append(CCFLAGS='-option -O3 -O1') env.Append(CPPPATH=['/include', '/usr/local/include', '/usr/include']) env.MergeFlags('-whatever -I/usr/opt/include -O3 -I/usr/local/include') -print(env['CCFLAGS']) -print(env['CPPPATH']) +print("CCFLAGS:", env['CCFLAGS']) +print("CPPPATH:", env['CPPPATH']) </file> </scons_example> @@ -157,8 +159,8 @@ print(env['CPPPATH']) In the combined example above, &ParseFlags; has sorted the options into their corresponding variables and returned a dictionary for &MergeFlags; to apply - to the construction variables - in the specified construction environment. + to the &consvars; + in the specified &consenv;. </para> diff --git a/doc/user/parseconfig.xml b/doc/user/parseconfig.xml index a07201a..fc9a889 100644 --- a/doc/user/parseconfig.xml +++ b/doc/user/parseconfig.xml @@ -2,7 +2,7 @@ <!DOCTYPE sconsdoc [ <!ENTITY % scons SYSTEM "../scons.mod"> %scons; - + <!ENTITY % builders-mod SYSTEM "../generated/builders.mod"> %builders-mod; <!ENTITY % functions-mod SYSTEM "../generated/functions.mod"> @@ -21,7 +21,9 @@ <!-- - __COPYRIGHT__ + MIT License + + Copyright The SCons Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -48,22 +50,22 @@ Configuring the right options to build programs to work with libraries--especially shared libraries--that are available - on POSIX systems can be very complicated. + on POSIX systems can be complex. To help this situation, various utilies with names that end in <filename>config</filename> return the command-line options for the GNU Compiler Collection (GCC) - that are needed to use these libraries; + that are needed to build and link against those libraries; for example, the command-line options to use a library named <filename>lib</filename> - would be found by calling a utility named <filename>lib-config</filename>. + could be found by calling a utility named <command>lib-config</command>. </para> <para> A more recent convention is that these options - are available from the generic <filename>pkg-config</filename> program, - which has common framework, error handling, and the like, + are available through the generic <command>pkg-config</command> program, + providing a common framework, error handling, and the like, so that all the package creator has to do is provide the set of strings for his particular package. @@ -71,14 +73,12 @@ <para> - &SCons; construction environments have a &ParseConfig; method - that executes a <filename>*config</filename> utility - (either <filename>pkg-config</filename> or a - more specific utility) - and configures the appropriate construction variables - in the environment - based on the command-line options - returned by the specified command. + &SCons; &consvars; have a &f-link-ParseConfig; + method that asks the host system to execute a command + and then configures the appropriate &consvars; based on + the output of that command. + This lets you run a program like <command>pkg-config</command> + or a more specific utility to help set up your build. </para> @@ -87,7 +87,7 @@ env = Environment() env['CPPPATH'] = ['/lib/compat'] env.ParseConfig("pkg-config x11 --cflags --libs") -print(env['CPPPATH']) +print("CPPPATH:", env['CPPPATH']) </file> </scons_example> @@ -112,14 +112,14 @@ print(env['CPPPATH']) <screen> % <userinput>scons -Q</userinput> -['/lib/compat', '/usr/X11/include'] +CPPPATH: ['/lib/compat', '/usr/X11/include'] scons: `.' is up to date. </screen> <para> In the example above, &SCons; has added the include directory to - <varname>CPPPATH</varname>. + &cv-link-CPPPATH; (Depending upon what other flags are emitted by the <filename>pkg-config</filename> command, other variables may have been extended as well.) @@ -129,8 +129,8 @@ scons: `.' is up to date. <para> Note that the options are merged with existing options using - the &MergeFlags; method, - so that each option only occurs once in the construction variable: + the &f-link-MergeFlags; method, + so that each option only occurs once in the &consvar;. </para> @@ -139,7 +139,7 @@ scons: `.' is up to date. env = Environment() env.ParseConfig("pkg-config x11 --cflags --libs") env.ParseConfig("pkg-config x11 --cflags --libs") -print(env['CPPPATH']) +print("CPPPATH:", "CPPPATH:", env['CPPPATH']) </file> </scons_example> @@ -156,7 +156,7 @@ print(env['CPPPATH']) <screen> % <userinput>scons -Q</userinput> -['/usr/X11/include'] +CPPPATH: ['/usr/X11/include'] scons: `.' is up to date. </screen> diff --git a/doc/user/parseflags.xml b/doc/user/parseflags.xml index 1cd0bbf..a1ab7af 100644 --- a/doc/user/parseflags.xml +++ b/doc/user/parseflags.xml @@ -2,7 +2,7 @@ <!DOCTYPE sconsdoc [ <!ENTITY % scons SYSTEM "../scons.mod"> %scons; - + <!ENTITY % builders-mod SYSTEM "../generated/builders.mod"> %builders-mod; <!ENTITY % functions-mod SYSTEM "../generated/functions.mod"> @@ -21,7 +21,9 @@ <!-- - __COPYRIGHT__ + MIT License + + Copyright The SCons Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -55,10 +57,10 @@ <para> - &SCons; &consenvs; have a &f-link-env-ParseFlags; method + &SCons; &consenvs; have a &f-link-ParseFlags; method that takes a set of typical command-line options - and distributes them into the appropriate construction variables. - Historically, it was created to support the &f-link-env-ParseConfig; method, + and distributes them into the appropriate &consvars; + Historically, it was created to support the &f-link-ParseConfig; method, so it focuses on options used by the GNU Compiler Collection (GCC) for the C and C++ toolchains. @@ -67,8 +69,8 @@ <para> &ParseFlags; returns a dictionary containing the options - distributed into their respective construction variables. - Normally, this dictionary would then be passed to &MergeFlags; + distributed into their respective &consvars;. + Normally, this dictionary would then be passed to &f-link-MergeFlags; to merge the options into a &consenv;, but the dictionary can be edited if desired to provide additional functionality. @@ -164,8 +166,7 @@ void main() { return 0; } <para> - If a string begins with a an exclamation mark (<literal>!</literal>, - sometimes also called a bang), + If a string begins with a an exclamation mark (<literal>!</literal>), the string is passed to the shell for execution. The output of the command is then parsed: |