summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2025-11-06 14:31:56 +0100
committerColomban Wendling <[email protected]>2025-11-06 14:41:54 +0100
commitf7277c4a02d44522fbcfd5d91cdd95eb2c788064 (patch)
tree2298ba54f2b130707daf4d4b62765b59c745071e
parentf1a68c30ae822f82b3aad2e40c626e3260e8db2b (diff)
downloadatril-meson-fixes.tar.bz2
atril-meson-fixes.tar.xz
epub: Try and locate MathJax at configure timemeson-fixes
Based on an XReader change[1], look up the MathJax source at configure time for better portability. If not specified manually, look in the common locations. This adds the --with-mathjax-directory=DIR configure option to manually specify the location, overriding the automatic discovery. The Meson part already exists, although was not used by the code. [1]: https://github.com/linuxmint/xreader/commit/9c6f363ad47f33b290d270489e50f7ad6071987a
-rw-r--r--backend/epub/epub-document.c2
-rw-r--r--configure.ac20
2 files changed, 21 insertions, 1 deletions
diff --git a/backend/epub/epub-document.c b/backend/epub/epub-document.c
index b63f91cb..224ab4b8 100644
--- a/backend/epub/epub-document.c
+++ b/backend/epub/epub-document.c
@@ -1683,7 +1683,7 @@ static void
epub_document_add_mathJax(gchar* containeruri,gchar* documentdir)
{
gchar *containerfilename= g_filename_from_uri(containeruri,NULL,NULL);
- GString *mathjaxdir = g_string_new("/usr/share/javascript/mathjax");
+ GString *mathjaxdir = g_string_new(MATHJAX_DIRECTORY);
gchar *mathjaxref = g_filename_to_uri(mathjaxdir->str,NULL,NULL);
gchar *nodedata = g_strdup_printf("%s/MathJax.js?config=TeX-AMS-MML_SVG",mathjaxref);
diff --git a/configure.ac b/configure.ac
index 65d1c05d..7add952b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -642,6 +642,25 @@ if test "x$enable_epub" = "xyes"; then
fi
fi
+AC_ARG_WITH([mathjax-directory],
+ [AS_HELP_STRING([--with-mathjax-directory=DIRECTORY],
+ [Specify the directory containing MathJax.js])],
+ [],[with_mathjax_directory=check])
+AC_MSG_CHECKING([for the MathJax directory])
+mathjax_default_dir=/usr/share/javascript/mathjax
+AS_IF([test x$have_webkit = xyes -a "x$with_mathjax_directory" = xcheck],
+ [for dir in "$mathjax_default_dir" /usr/share/mathjax; do
+ if test -f "$dir/MathJax.js"; then
+ with_mathjax_directory="$dir"
+ break
+ fi
+ done])
+AS_IF([test "x$with_mathjax_directory" = xcheck],
+ [AC_MSG_RESULT([not found, falling back to $mathjax_default_dir])
+ with_mathjax_directory="$mathjax_default_dir"],
+ [AC_MSG_RESULT([$with_mathjax_directory])])
+AC_DEFINE_UNQUOTED([MATHJAX_DIRECTORY], ["$with_mathjax_directory"], [Directory where to look up MathJax.js])
+
AM_CONDITIONAL(ENABLE_EPUB, test x$have_webkit = xyes)
dnl ================== End of EPUB checks ===================================================
@@ -791,6 +810,7 @@ Configure summary:
GObj. Introspection.: $enable_introspection
Use NLS.............: ${USE_NLS}
Tests...............: $enable_tests
+ MathJax.............: $with_mathjax_directory
PDF Backend.........: $enable_pdf
Synctex enabled.....: $enable_synctex