@@ -645,6 +645,9 @@ how it is built:
645
645
Environment variables
646
646
---------------------
647
647
648
+ Environment variables controlling the build process
649
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
650
+
648
651
Sage uses several environment variables to control its build process.
649
652
Most users won't need to set any of these: the build process just works on many
650
653
platforms.
@@ -662,17 +665,17 @@ packages before building). Package downloads use the Sage mirror
662
665
network, the nearest mirror will be determined automatically for
663
666
you. This is influenced by the following environment variable:
664
667
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
670
669
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.
672
673
673
674
Here are some of the more commonly used variables affecting the build process:
674
675
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
676
679
``MAKE='make -jNUM' `` to tell the ``make `` program to run ``NUM `` jobs in
677
680
parallel when building.
678
681
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:
693
696
Some users on single-core macOS machines have reported problems when
694
697
building Sage with ``MAKE='make -jNUM' `` with ``NUM `` greater than one.
695
698
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.
699
704
700
705
If this is not set, then determine the number of threads using the value of
701
706
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:
709
714
When ``sage -t -p `` runs under the control of the GNU ``make ``
710
715
jobserver, then Sage will request as most this number of job slots.
711
716
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::
716
723
717
724
$ make -s V=0
718
725
719
726
(Note that the above uses the syntax of setting a Makefile variable.)
720
727
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,
722
731
or when installing packages manually,
723
732
run the test suite for each package which has one, and stop with an error
724
733
if tests are failing. If set to ``warn ``, then only a warning is printed
725
734
in this case.
726
735
See also :envvar: `SAGE_CHECK_PACKAGES `.
727
736
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 ``,
729
740
then the default behavior is to run test suites for all spkgs which contain
730
741
them.
731
742
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:
742
753
on most platforms. So when this variable is empty or unset, Sage
743
754
uses a default of ``!python2,!python3 ``.
744
755
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
746
761
747
- - :envvar: ` SAGE_INSTALL_CCACHE ` - by default Sage doesn't install ccache,
762
+ By default Sage doesn't install :ref: ` ccache < spkg_ccache >` ,
748
763
however by setting ``SAGE_INSTALL_CCACHE=yes `` Sage will install ccache.
749
764
Because the Sage distribution is quite large, the maximum cache is set to 4G.
750
765
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:
756
771
building ccache for Sage, so that Sage can pull down the necessary
757
772
sources.
758
773
759
- - .. _sage_debug:
774
+ .. envvar :: SAGE_DEBUG
760
775
761
- :envvar: `SAGE_DEBUG ` - controls debugging support.
762
- There are three different possible values:
776
+ Controls debugging support. There are three different possible values:
763
777
764
778
* Not set (or set to anything else than "yes" or "no"): build binaries with
765
779
debugging symbols, but no special debug builds.
@@ -778,12 +792,16 @@ Here are some of the more commonly used variables affecting the build process:
778
792
Instead of using :envvar: `SAGE_DEBUG ` one can configure with
779
793
``--enable-debug={no|symbols|yes} ``.
780
794
781
- - :envvar: `SAGE_PROFILE ` - controls profiling support. If this is set
795
+ .. envvar :: SAGE_PROFILE
796
+
797
+ Controls profiling support. If this is set
782
798
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
784
800
profiling in Cython modules.
785
801
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
787
805
subdirectory of :file: `$SAGE_ROOT/local/var/tmp/sage/build/ `; for
788
806
example, build version 7.27.0 of
789
807
:file: `ipython ` in the directory
@@ -806,7 +824,9 @@ Here are some of the more commonly used variables affecting the build process:
806
824
permission to create.
807
825
The path name must contain **no spaces **.
808
826
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
810
830
build directory -- the appropriate subdirectory of
811
831
:file: `$SAGE_ROOT/local/var/tmp/sage/build ` or
812
832
:file: `$SAGE_BUILD_DIR ` -- after each spkg
@@ -841,17 +861,19 @@ Here are some of the more commonly used variables affecting the build process:
841
861
So you can set this variable to ``yes `` instead of using the ``-s `` flag
842
862
for ``sage -i `` and ``sage -f ``.
843
863
844
- - .. _sage_fat_binary:
864
+ .. envvar :: SAGE_FAT_BINARY
845
865
846
- :envvar: ` SAGE_FAT_BINARY ` - to build binaries that will run on the
866
+ To build binaries that will run on the
847
867
widest range of target CPUs set this variable to ``yes `` before
848
868
building Sage or configure with ``--enable-fat-binary ``.
849
869
This does not make the binaries relocatable, it only
850
870
avoids newer CPU instruction set extensions. For relocatable (=can
851
871
be moved to a different directory) binaries, you must use
852
872
https://github.com/sagemath/binary-pkg
853
873
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
855
877
command prefix that is necessary to write into a installation
856
878
hierarchy (:envvar: `SAGE_LOCAL `) owned by root or another user.
857
879
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:
864
886
supports :envvar: `SAGE_SUDO `, into a root-owned installation
865
887
hierarchy (:envvar: `SAGE_LOCAL `).
866
888
867
- Environment variables for documentation build:
889
+ Environment variables for documentation build
890
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
891
+
892
+ .. envvar :: SAGE_DOCBUILD_OPTS
868
893
869
- - :envvar: ` SAGE_DOCBUILD_OPTS ` - the value of this variable is passed as an
894
+ The value of this variable is passed as an
870
895
argument to ``sage --docbuild all html `` or ``sage --docbuild all pdf `` when
871
896
you run ``make ``, ``make doc ``, or ``make doc-pdf ``. For example, you can
872
897
add ``--no-plot `` to this variable to avoid building the graphics coming from
873
898
the ``.. PLOT `` directive within the documentation, or you can add
874
899
``--include-tests-blocks `` to include all "TESTS" blocks in the reference
875
900
manual. Run ``sage --docbuild help `` to see the full list of options.
876
901
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
878
905
package-specific documentation to
879
906
:file: `$SAGE_ROOT/local/share/doc/PACKAGE_NAME/ ` when an spkg is installed.
880
907
This option may not be supported by all spkgs. Some spkgs might also assume
881
908
that certain programs are available on the system (for example, ``latex `` or
882
909
``pdflatex ``).
883
910
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
885
914
using CDNs (Content Distribution Networks) for scripts necessary for HTML
886
915
documentation, such as `MathJax <https://www.mathjax.org/ >`_.
887
916
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
889
920
documentation. If the ``Make live `` button on any webpage of the live doc is
890
921
clicked, every example code gets a `CodeMirror <https://codemirror.net >`_
891
922
code cell runnable via `Thebe <https://thebe.readthedocs.io/en/stable/ >`_.
@@ -895,9 +926,10 @@ Environment variables for documentation build:
895
926
local Jupyter server. The environment variable :envvar: `SAGE_JUPYTER_SERVER `
896
927
is used for this purpose.
897
928
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.
901
933
902
934
- ``binder `` refers to `Sage's official Binder repo
903
935
<https://github.com/sagemath/sage-binder-env> `_. This is assumed if the
@@ -925,84 +957,123 @@ Environment variables for documentation build:
925
957
before opening the Sage documentation webpage.
926
958
927
959
928
- Environment variables dealing with specific Sage packages:
960
+ Environment variables dealing with specific Sage packages
961
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
929
962
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 ``,
931
966
then Sage will attempt to build the graphical backend when it builds the
932
967
matplotlib package.
933
968
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
935
977
PARI's ``Configure `` script, for example to specify graphics
936
978
support (which is disabled by default). See the file
937
979
:file: `build/pkgs/pari/spkg-install.in ` for more information.
938
980
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
940
984
this can be time-consuming. If you set this variable to "yes", you
941
985
will also see this: ``WARNING: Tuning PARI/GP is unreliable. You may
942
986
find your build of PARI fails, or PARI/GP does not work properly
943
987
once built. We recommend to build this package with
944
988
SAGE_CHECK="yes". ``
945
989
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
947
993
argument to the ``$MAKE `` command when compiling PARI.
948
994
949
- Some standard environment variables which are used by Sage:
995
+ Standard environment controlling the build process
996
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
950
997
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
952
1001
compiler, **not every Sage package recognizes this **.
953
1002
If GCC is installed within Sage, :envvar: `CC ` is ignored and Sage's ``gcc ``
954
1003
is used instead.
955
1004
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
957
1008
packages, and similarly, using it is likely quite risky.
958
1009
If GCC is installed within Sage, :envvar: `CPP ` is ignored and Sage's ``cpp ``
959
1010
is used instead.
960
1011
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
962
1015
packages, and similarly, using it is likely quite risky.
963
1016
If GCC is installed within Sage, :envvar: `CXX ` is ignored and Sage's ``g++ ``
964
1017
is used instead.
965
1018
966
- - :envvar: `FC ` - similarly, this will set the Fortran compiler.
1019
+ .. envvar :: FC
1020
+
1021
+ Similarly, this will set the Fortran compiler.
967
1022
This is supported by all Sage packages which have Fortran code.
968
1023
However, for historical reasons, the value is hardcoded during the initial
969
1024
``make `` and subsequent changes to ``$FC `` might be ignored (in which case,
970
1025
the original value will be used instead).
971
1026
If GCC is installed within Sage, :envvar: `FC ` is ignored and Sage's
972
1027
``gfortran `` is used instead.
973
1028
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
975
1034
the C compiler, the C++ compiler and the Fortran compiler, respectively.
976
1035
The same comments apply to these: setting them may cause problems, because
977
1036
they are not universally respected among the Sage packages. Note
978
1037
also that ``export CFLAGS="" `` does not have the same effect as
979
1038
``unset CFLAGS ``. The latter is preferable.
980
1039
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
984
1045
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.
987
1047
988
- Environment variables dealing with doctesting:
1048
+ Environment variables dealing with doctesting
1049
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
989
1050
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
991
1054
to allow a doctest before timing it out.
992
1055
If this isn't set, the default is 300 seconds (5 minutes).
993
1056
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
995
1060
seconds to allow a doctest before timing it out, if tests are run using
996
1061
``sage -t --long ``.
997
1062
If this isn't set, the default is 1800 seconds (30 minutes).
998
1063
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
1000
1068
be used instead of passing the flags ``--global-iterations `` and
1001
1069
``--file-iterations ``, respectively, to ``sage -t ``. Indeed, these
1002
1070
variables are only used if the flags are unset. Run ``sage -t -h ``
1003
1071
for more information on the effects of these flags (and therefore
1004
1072
these variables).
1005
1073
1074
+ Environment variables set within Sage environments
1075
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1076
+
1006
1077
Sage sets some other environment variables. The most accurate way to
1007
1078
see what Sage does is to first run ``env `` from a shell prompt to see
1008
1079
what environment variables you have set. Then run ``sage --sh -c
0 commit comments