diff --git a/src/doc/en/reference/repl/meson.build b/src/doc/en/reference/repl/meson.build
index eb492404897..9b162becf3b 100644
--- a/src/doc/en/reference/repl/meson.build
+++ b/src/doc/en/reference/repl/meson.build
@@ -9,10 +9,3 @@ doc_sources = [
 foreach file : doc_sources
   doc_src += fs.copyfile(file)
 endforeach
-
-doc_src_repl = custom_target(
-  'options',
-  output: ['options.txt'],
-  command: [py, src / 'sage' / 'cli', '--help'],
-  capture: true,
-)
diff --git a/src/doc/meson.build b/src/doc/meson.build
index 1f33822cf5f..5ba1ab0397b 100644
--- a/src/doc/meson.build
+++ b/src/doc/meson.build
@@ -1,11 +1,21 @@
-if not get_option('build-docs')
-  subdir_done()
-endif
-
-warning(
-  'Documentation building enabled, generating targets may be slow. To disable this, pass -Dbuild-docs=false.',
+project(
+  'SageMath',
+  ['c', 'cpp', 'cython'],
+  version: '10.9',
+  license: 'GPL v3',
+  default_options: ['c_std=c17', 'cpp_std=c++17', 'python.install_env=auto'],
+  meson_version: '>=1.5',
 )
 
+src = meson.current_source_dir()
+fs = import('fs')
+
+# Python module
+# https://mesonbuild.com/Python-module.html
+py_module = import('python')
+py = py_module.find_installation(pure: false)
+py_dep = py.dependency()
+
 sphinx_check = py_module.find_installation(required: false, modules: ['sphinx'])
 if not sphinx_check.found()
   warning(
@@ -35,21 +45,17 @@ doc_bootstrap = custom_target(
   'bootstrap',
   output: ['autogen'],
   command: [
-    py,
-    files('../../tools/bootstrap-docs.py'),
+    'sage',
+    '-python',
+    files('bootstrap-docs.py'),
     meson.current_build_dir(),
   ],
-  env: {'SAGE_ROOT': root},
-  # doc_src is not really a dependency of the bootstrap, but we want to make sure
-  # that all the source files are present before running the actual doc build
-  # so let's collect all source-related targets here.
-  depends: doc_src,
 )
 
 references = run_command(
-  py,
   [
-    src / 'build-docs.py',
+    'sage',
+    '--docbuild',
     '--no-prune-empty-dirs',
     '--all-documents',
     'reference',
@@ -71,10 +77,7 @@ foreach type : ['inventory', 'html', 'pdf']
       short_ref = ref
     endif
     deps = []
-    deps += doc_bootstrap
-    if short_ref == 'repl'
-      deps += doc_src_repl
-    endif
+    deps += doc_bootstrap
     if type == 'html' or type == 'pdf'
       deps += reference_inventory
     endif
@@ -93,8 +96,8 @@ foreach type : ['inventory', 'html', 'pdf']
       'doc-' + type + '-reference-' + short_ref,
       output: [type + short_ref],
       command: [
-        py,
-        src / 'build-docs.py',
+        'sage',
+        '--docbuild',
         '--no-prune-empty-dirs',
         '--no-pdf-links',
         ref,
@@ -120,9 +123,9 @@ foreach type : ['inventory', 'html', 'pdf']
 endforeach
 
 other_documents = run_command(
-  py,
   [
-    src / 'build-docs.py',
+    'sage',
+    '--docbuild',
     '--no-prune-empty-dirs',
     '--all-documents',
     'all',
@@ -140,8 +143,8 @@ foreach type : ['html', 'pdf']
       'doc-' + type + '-other-' + short_doc,
       output: [type + short_doc],
       command: [
-        py,
-        src / 'build-docs.py',
+        'sage',
+        '--docbuild',
         '--no-prune-empty-dirs',
         '--no-pdf-links',
         doc,
diff --git a/src/meson.build b/src/meson.build
index 039cbbd1294..dfb82d980fb 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -309,4 +309,3 @@ src = meson.current_source_dir()
 
 # Submodules
 subdir('sage')
-subdir('doc')
