Skip to content

Commit 81bdd75

Browse files
author
Matthias Koeppe
committed
src/doc/en/installation/source.rst: Use '.. envvar::' to define variables
1 parent 439065e commit 81bdd75

File tree

1 file changed

+127
-56
lines changed

1 file changed

+127
-56
lines changed

src/doc/en/installation/source.rst

Lines changed: 127 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,9 @@ how it is built:
645645
Environment variables
646646
---------------------
647647

648+
Environment variables controlling the build process
649+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
650+
648651
Sage uses several environment variables to control its build process.
649652
Most users won't need to set any of these: the build process just works on many
650653
platforms.
@@ -662,17 +665,17 @@ packages before building). Package downloads use the Sage mirror
662665
network, the nearest mirror will be determined automatically for
663666
you. This is influenced by the following environment variable:
664667

665-
- :envvar:`SAGE_SERVER` - Try the specified mirror first, before
666-
falling back to the official Sage mirror list. Note that Sage will
667-
search the directory
668-
669-
- ``SAGE_SERVER/spkg/upstream``
668+
.. envvar:: SAGE_SERVER
670669

671-
for upstream tarballs.
670+
Try the specified mirror first, before falling back to the official
671+
Sage mirror list. Note that Sage will search the directory
672+
``SAGE_SERVER/spkg/upstream`` for upstream tarballs.
672673

673674
Here are some of the more commonly used variables affecting the build process:
674675

675-
- :envvar:`MAKE` - one useful setting for this variable when building Sage is
676+
.. envvar:: MAKE
677+
678+
One useful setting for this variable when building Sage is
676679
``MAKE='make -jNUM'`` to tell the ``make`` program to run ``NUM`` jobs in
677680
parallel when building.
678681
Note that some Sage packages may not support this variable.
@@ -693,9 +696,11 @@ Here are some of the more commonly used variables affecting the build process:
693696
Some users on single-core macOS machines have reported problems when
694697
building Sage with ``MAKE='make -jNUM'`` with ``NUM`` greater than one.
695698

696-
- :envvar:`SAGE_NUM_THREADS` - if set to a number, then when rebuilding with
697-
``sage -b`` or parallel doctesting with ``sage -t -p 0``, use at most this
698-
many threads.
699+
.. envvar:: SAGE_NUM_THREADS
700+
701+
If set to a number, then when rebuilding with ``sage -b`` or
702+
parallel doctesting with ``sage -t -p 0``, use at most this many
703+
threads.
699704

700705
If this is not set, then determine the number of threads using the value of
701706
the :envvar:`MAKE` (see above) or :envvar:`MAKEFLAGS` environment variables.
@@ -709,23 +714,29 @@ Here are some of the more commonly used variables affecting the build process:
709714
When ``sage -t -p`` runs under the control of the GNU ``make``
710715
jobserver, then Sage will request as most this number of job slots.
711716

712-
- :envvar:`V` - if set to ``0``, silence the build. Instead of
713-
showing a detailed compilation log, only one line of output is shown
714-
at the beginning and at the end of the installation of each Sage
715-
package. To see even less output, use::
717+
.. envvar:: V
718+
719+
If set to ``0``, silence the build. Instead of showing a detailed
720+
compilation log, only one line of output is shown at the beginning
721+
and at the end of the installation of each Sage package. To see
722+
even less output, use::
716723

717724
$ make -s V=0
718725

719726
(Note that the above uses the syntax of setting a Makefile variable.)
720727

721-
- :envvar:`SAGE_CHECK` - if set to ``yes``, then during the build process,
728+
.. envvar:: SAGE_CHECK
729+
730+
If set to ``yes``, then during the build process,
722731
or when installing packages manually,
723732
run the test suite for each package which has one, and stop with an error
724733
if tests are failing. If set to ``warn``, then only a warning is printed
725734
in this case.
726735
See also :envvar:`SAGE_CHECK_PACKAGES`.
727736

728-
- :envvar:`SAGE_CHECK_PACKAGES` - if :envvar:`SAGE_CHECK` is set to ``yes``,
737+
.. envvar:: SAGE_CHECK_PACKAGES
738+
739+
If :envvar:`SAGE_CHECK` is set to ``yes``,
729740
then the default behavior is to run test suites for all spkgs which contain
730741
them.
731742
If :envvar:`SAGE_CHECK_PACKAGES` is set, it should be a comma-separated list
@@ -742,9 +753,13 @@ Here are some of the more commonly used variables affecting the build process:
742753
on most platforms. So when this variable is empty or unset, Sage
743754
uses a default of ``!python2,!python3``.
744755

745-
- :envvar:`SAGE_INSTALL_GCC` - **Obsolete, do not use, to be removed**
756+
.. envvar:: SAGE_INSTALL_GCC
757+
758+
**Obsolete, do not use, to be removed**
759+
760+
.. envvar:: SAGE_INSTALL_CCACHE
746761

747-
- :envvar:`SAGE_INSTALL_CCACHE` - by default Sage doesn't install ccache,
762+
By default Sage doesn't install :ref:`ccache <spkg_ccache>`,
748763
however by setting ``SAGE_INSTALL_CCACHE=yes`` Sage will install ccache.
749764
Because the Sage distribution is quite large, the maximum cache is set to 4G.
750765
This can be changed by running ``sage -sh -c "ccache --max-size=SIZE"``,
@@ -756,10 +771,9 @@ Here are some of the more commonly used variables affecting the build process:
756771
building ccache for Sage, so that Sage can pull down the necessary
757772
sources.
758773

759-
- .. _sage_debug:
774+
.. envvar:: SAGE_DEBUG
760775

761-
:envvar:`SAGE_DEBUG` - controls debugging support.
762-
There are three different possible values:
776+
Controls debugging support. There are three different possible values:
763777

764778
* Not set (or set to anything else than "yes" or "no"): build binaries with
765779
debugging symbols, but no special debug builds.
@@ -778,12 +792,16 @@ Here are some of the more commonly used variables affecting the build process:
778792
Instead of using :envvar:`SAGE_DEBUG` one can configure with
779793
``--enable-debug={no|symbols|yes}``.
780794

781-
- :envvar:`SAGE_PROFILE` - controls profiling support. If this is set
795+
.. envvar:: SAGE_PROFILE
796+
797+
Controls profiling support. If this is set
782798
to ``yes``, profiling support is enabled where possible. Note that
783-
Python-level profiling is always available; This option enables
799+
Python-level profiling is always available; this option enables
784800
profiling in Cython modules.
785801

786-
- :envvar:`SAGE_BUILD_DIR` - the default behavior is to build each spkg in a
802+
.. envvar:: SAGE_BUILD_DIR
803+
804+
The default behavior is to build each spkg in a
787805
subdirectory of :file:`$SAGE_ROOT/local/var/tmp/sage/build/`; for
788806
example, build version 7.27.0 of
789807
:file:`ipython` in the directory
@@ -806,7 +824,9 @@ Here are some of the more commonly used variables affecting the build process:
806824
permission to create.
807825
The path name must contain **no spaces**.
808826

809-
- :envvar:`SAGE_KEEP_BUILT_SPKGS` - the default behavior is to delete each
827+
.. envvar:: SAGE_KEEP_BUILT_SPKGS
828+
829+
The default behavior is to delete each
810830
build directory -- the appropriate subdirectory of
811831
:file:`$SAGE_ROOT/local/var/tmp/sage/build` or
812832
:file:`$SAGE_BUILD_DIR` -- after each spkg
@@ -841,17 +861,19 @@ Here are some of the more commonly used variables affecting the build process:
841861
So you can set this variable to ``yes`` instead of using the ``-s`` flag
842862
for ``sage -i`` and ``sage -f``.
843863

844-
- .. _sage_fat_binary:
864+
.. envvar:: SAGE_FAT_BINARY
845865

846-
:envvar:`SAGE_FAT_BINARY` - to build binaries that will run on the
866+
To build binaries that will run on the
847867
widest range of target CPUs set this variable to ``yes`` before
848868
building Sage or configure with ``--enable-fat-binary``.
849869
This does not make the binaries relocatable, it only
850870
avoids newer CPU instruction set extensions. For relocatable (=can
851871
be moved to a different directory) binaries, you must use
852872
https://github.com/sagemath/binary-pkg
853873

854-
- :envvar:`SAGE_SUDO` - set this to ``sudo -E`` or to any other
874+
.. envvar:: SAGE_SUDO
875+
876+
Set this to ``sudo -E`` or to any other
855877
command prefix that is necessary to write into a installation
856878
hierarchy (:envvar:`SAGE_LOCAL`) owned by root or another user.
857879
Note that this command needs to preserve environment variable
@@ -864,28 +886,37 @@ Here are some of the more commonly used variables affecting the build process:
864886
supports :envvar:`SAGE_SUDO`, into a root-owned installation
865887
hierarchy (:envvar:`SAGE_LOCAL`).
866888

867-
Environment variables for documentation build:
889+
Environment variables for documentation build
890+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
891+
892+
.. envvar:: SAGE_DOCBUILD_OPTS
868893

869-
- :envvar:`SAGE_DOCBUILD_OPTS` - the value of this variable is passed as an
894+
The value of this variable is passed as an
870895
argument to ``sage --docbuild all html`` or ``sage --docbuild all pdf`` when
871896
you run ``make``, ``make doc``, or ``make doc-pdf``. For example, you can
872897
add ``--no-plot`` to this variable to avoid building the graphics coming from
873898
the ``.. PLOT`` directive within the documentation, or you can add
874899
``--include-tests-blocks`` to include all "TESTS" blocks in the reference
875900
manual. Run ``sage --docbuild help`` to see the full list of options.
876901

877-
- :envvar:`SAGE_SPKG_INSTALL_DOCS` - if set to ``yes``, then install
902+
.. envvar:: SAGE_SPKG_INSTALL_DOCS
903+
904+
If set to ``yes``, then install
878905
package-specific documentation to
879906
:file:`$SAGE_ROOT/local/share/doc/PACKAGE_NAME/` when an spkg is installed.
880907
This option may not be supported by all spkgs. Some spkgs might also assume
881908
that certain programs are available on the system (for example, ``latex`` or
882909
``pdflatex``).
883910

884-
- :envvar:`SAGE_USE_CDNS` -- if set to ``yes``, then build the documentation
911+
.. envvar:: SAGE_USE_CDNS
912+
913+
If set to ``yes``, then build the documentation
885914
using CDNs (Content Distribution Networks) for scripts necessary for HTML
886915
documentation, such as `MathJax <https://www.mathjax.org/>`_.
887916

888-
- :envvar:`SAGE_LIVE_DOC` -- if set to ``yes``, then build live Sage
917+
.. envvar:: SAGE_LIVE_DOC
918+
919+
If set to ``yes``, then build live Sage
889920
documentation. If the ``Make live`` button on any webpage of the live doc is
890921
clicked, every example code gets a `CodeMirror <https://codemirror.net>`_
891922
code cell runnable via `Thebe <https://thebe.readthedocs.io/en/stable/>`_.
@@ -895,9 +926,10 @@ Environment variables for documentation build:
895926
local Jupyter server. The environment variable :envvar:`SAGE_JUPYTER_SERVER`
896927
is used for this purpose.
897928

898-
:envvar:`SAGE_JUPYTER_SERVER` - set this to either ``binder``,
899-
``binder:repo`` with ``repo`` specifying a Binder repo or the URL to a local
900-
Jupyter server.
929+
.. envvar:: SAGE_JUPYTER_SERVER
930+
931+
Set this to either ``binder``, ``binder:repo`` with ``repo``
932+
specifying a Binder repo or the URL to a local Jupyter server.
901933

902934
- ``binder`` refers to `Sage's official Binder repo
903935
<https://github.com/sagemath/sage-binder-env>`_. This is assumed if the
@@ -925,84 +957,123 @@ Environment variables for documentation build:
925957
before opening the Sage documentation webpage.
926958

927959

928-
Environment variables dealing with specific Sage packages:
960+
Environment variables dealing with specific Sage packages
961+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
929962

930-
- :envvar:`SAGE_MATPLOTLIB_GUI` - if set to anything non-empty except ``no``,
963+
.. envvar:: SAGE_MATPLOTLIB_GUI
964+
965+
If set to anything non-empty except ``no``,
931966
then Sage will attempt to build the graphical backend when it builds the
932967
matplotlib package.
933968

934-
- :envvar:`PARI_CONFIGURE` - use this to pass extra parameters to
969+
.. envvar:: OPENBLAS_CONFIGURE
970+
971+
Adds additional configuration flags for
972+
the OpenBLAS package that gets added to the make command. (see :trac:`23272`)
973+
974+
.. envvar:: PARI_CONFIGURE
975+
976+
Use this to pass extra parameters to
935977
PARI's ``Configure`` script, for example to specify graphics
936978
support (which is disabled by default). See the file
937979
:file:`build/pkgs/pari/spkg-install.in` for more information.
938980

939-
- :envvar:`SAGE_TUNE_PARI` - if yes, enable PARI self-tuning. Note that
981+
.. envvar:: SAGE_TUNE_PARI
982+
983+
If yes, enable PARI self-tuning. Note that
940984
this can be time-consuming. If you set this variable to "yes", you
941985
will also see this: ``WARNING: Tuning PARI/GP is unreliable. You may
942986
find your build of PARI fails, or PARI/GP does not work properly
943987
once built. We recommend to build this package with
944988
SAGE_CHECK="yes".``
945989

946-
- :envvar:`PARI_MAKEFLAGS` - The value of this variable is passed as an
990+
.. envvar:: PARI_MAKEFLAGS
991+
992+
The value of this variable is passed as an
947993
argument to the ``$MAKE`` command when compiling PARI.
948994

949-
Some standard environment variables which are used by Sage:
995+
Standard environment controlling the build process
996+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
950997

951-
- :envvar:`CC` - while some programs allow you to use this to specify your C
998+
.. envvar:: CC
999+
1000+
While some programs allow you to use this to specify your C
9521001
compiler, **not every Sage package recognizes this**.
9531002
If GCC is installed within Sage, :envvar:`CC` is ignored and Sage's ``gcc``
9541003
is used instead.
9551004

956-
- :envvar:`CPP` - similarly, this will set the C preprocessor for some Sage
1005+
.. envvar:: CPP
1006+
1007+
Similarly, this will set the C preprocessor for some Sage
9571008
packages, and similarly, using it is likely quite risky.
9581009
If GCC is installed within Sage, :envvar:`CPP` is ignored and Sage's ``cpp``
9591010
is used instead.
9601011

961-
- :envvar:`CXX` - similarly, this will set the C++ compiler for some Sage
1012+
.. envvar:: CXX
1013+
1014+
Similarly, this will set the C++ compiler for some Sage
9621015
packages, and similarly, using it is likely quite risky.
9631016
If GCC is installed within Sage, :envvar:`CXX` is ignored and Sage's ``g++``
9641017
is used instead.
9651018

966-
- :envvar:`FC` - similarly, this will set the Fortran compiler.
1019+
.. envvar:: FC
1020+
1021+
Similarly, this will set the Fortran compiler.
9671022
This is supported by all Sage packages which have Fortran code.
9681023
However, for historical reasons, the value is hardcoded during the initial
9691024
``make`` and subsequent changes to ``$FC`` might be ignored (in which case,
9701025
the original value will be used instead).
9711026
If GCC is installed within Sage, :envvar:`FC` is ignored and Sage's
9721027
``gfortran`` is used instead.
9731028

974-
- :envvar:`CFLAGS`, :envvar:`CXXFLAGS` and :envvar:`FCFLAGS` - the flags for
1029+
.. envvar:: CFLAGS
1030+
.. envvar:: CXXFLAGS
1031+
.. envvar:: FCFLAGS
1032+
1033+
The flags for
9751034
the C compiler, the C++ compiler and the Fortran compiler, respectively.
9761035
The same comments apply to these: setting them may cause problems, because
9771036
they are not universally respected among the Sage packages. Note
9781037
also that ``export CFLAGS=""`` does not have the same effect as
9791038
``unset CFLAGS``. The latter is preferable.
9801039

981-
- Similar comments apply to other compiler and linker flags like
982-
:envvar:`CPPFLAGS`, :envvar:`LDFLAGS`, :envvar:`CXXFLAG64`,
983-
:envvar:`LDFLAG64`, and :envvar:`LD`.
1040+
.. envvar:: CPPFLAGS
1041+
.. envvar:: LDFLAGS
1042+
.. envvar:: CXXFLAG64
1043+
.. envvar:: LDFLAG64
1044+
.. envvar:: LD
9841045

985-
- :envvar:`OPENBLAS_CONFIGURE` - adds additional configuration flags for
986-
the OpenBLAS package that gets added to the make command. (see :trac:`23272`)
1046+
Similar comments apply to these compiler and linker flags.
9871047

988-
Environment variables dealing with doctesting:
1048+
Environment variables dealing with doctesting
1049+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9891050

990-
- :envvar:`SAGE_TIMEOUT` - used for Sage's doctesting: the number of seconds
1051+
.. envvar:: SAGE_TIMEOUT
1052+
1053+
used for Sage's doctesting: the number of seconds
9911054
to allow a doctest before timing it out.
9921055
If this isn't set, the default is 300 seconds (5 minutes).
9931056

994-
- :envvar:`SAGE_TIMEOUT_LONG` - used for Sage's doctesting: the number of
1057+
.. envvar:: SAGE_TIMEOUT_LONG
1058+
1059+
used for Sage's doctesting: the number of
9951060
seconds to allow a doctest before timing it out, if tests are run using
9961061
``sage -t --long``.
9971062
If this isn't set, the default is 1800 seconds (30 minutes).
9981063

999-
- :envvar:`SAGE_TEST_GLOBAL_ITER`, :envvar:`SAGE_TEST_ITER` - these can
1064+
.. envvar:: SAGE_TEST_GLOBAL_ITER
1065+
.. envvar:: SAGE_TEST_ITER
1066+
1067+
These can
10001068
be used instead of passing the flags ``--global-iterations`` and
10011069
``--file-iterations``, respectively, to ``sage -t``. Indeed, these
10021070
variables are only used if the flags are unset. Run ``sage -t -h``
10031071
for more information on the effects of these flags (and therefore
10041072
these variables).
10051073

1074+
Environment variables set within Sage environments
1075+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1076+
10061077
Sage sets some other environment variables. The most accurate way to
10071078
see what Sage does is to first run ``env`` from a shell prompt to see
10081079
what environment variables you have set. Then run ``sage --sh -c

0 commit comments

Comments
 (0)