diff --git a/build/pkgs/mathjax/distros/gentoo.txt b/build/pkgs/mathjax/distros/gentoo.txt new file mode 100644 index 00000000000..e0d633a9b98 --- /dev/null +++ b/build/pkgs/mathjax/distros/gentoo.txt @@ -0,0 +1 @@ +>=dev-libs/mathjax-3 diff --git a/build/pkgs/mathjax/spkg-configure.m4 b/build/pkgs/mathjax/spkg-configure.m4 new file mode 100644 index 00000000000..70fb46a2067 --- /dev/null +++ b/build/pkgs/mathjax/spkg-configure.m4 @@ -0,0 +1,26 @@ +SAGE_SPKG_CONFIGURE([mathjax], [ + # Arch: /usr/share/mathjax + # Gentoo: /usr/share/mathjax + # Void: /usr/share/mathjax + AC_MSG_CHECKING([for MathJax-3.x]) + m4_foreach([mathjax_dir], [/usr/share/mathjax], [ + # tex-chtml.hs is used in src/sage_docbuild/conf.py + # and was not present in MathJax-2.x + AS_IF([test -f "mathjax_dir/tex-chtml.js"], [ + SAGE_MATHJAX_DIR="mathjax_dir" + AC_MSG_RESULT([mathjax_dir]) + ]) + ]) + AS_IF([test -z "${SAGE_MATHJAX_DIR}"], [ + AC_MSG_RESULT([no]) + sage_spkg_install_mathjax=yes + ]) +],[],[],[ + # post-check + AS_IF([test x$sage_spkg_install_mathjax = xyes], [ + # Our spkg-src script adds an extra "mathjax" + SAGE_MATHJAX_DIR='${prefix}'/share/mathjax/mathjax + ]) + + AC_SUBST(SAGE_MATHJAX_DIR, "${SAGE_MATHJAX_DIR}") +]) diff --git a/pkgs/sage-conf/_sage_conf/_conf.py.in b/pkgs/sage-conf/_sage_conf/_conf.py.in index f2e197b45ed..87b27ca05cb 100644 --- a/pkgs/sage-conf/_sage_conf/_conf.py.in +++ b/pkgs/sage-conf/_sage_conf/_conf.py.in @@ -50,7 +50,7 @@ SAGE_ARCHFLAGS = "@SAGE_ARCHFLAGS@" SAGE_PKG_CONFIG_PATH = "@SAGE_PKG_CONFIG_PATH@".replace('$SAGE_LOCAL', SAGE_LOCAL) # Used in sage.repl.ipython_kernel.install -MATHJAX_DIR = SAGE_LOCAL + "/share/mathjax" +MATHJAX_DIR = "@SAGE_MATHJAX_DIR@".replace('${prefix}', SAGE_LOCAL) THREEJS_DIR = SAGE_LOCAL + "/share/threejs-sage" # OpenMP flags, if available. diff --git a/src/sage_docbuild/conf.py b/src/sage_docbuild/conf.py index b493b3b2897..d488a6a13a4 100644 --- a/src/sage_docbuild/conf.py +++ b/src/sage_docbuild/conf.py @@ -374,8 +374,7 @@ def set_intersphinx_mappings(app, config): if os.environ.get('SAGE_USE_CDNS', 'no') == 'yes': mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" else: - mathjax_path = 'mathjax/tex-chtml.js' - html_common_static_path += [MATHJAX_DIR] + mathjax_path = os.path.join(MATHJAX_DIR, 'tex-chtml.js') # A list of glob-style patterns that should be excluded when looking for source # files. They are matched against the source file names relative to the