From 67ace1c59dd582919bceb4fdadbefc1d98d3449a Mon Sep 17 00:00:00 2001
From: Matthew Pickering <matthewtpickering@gmail.com>
Date: Mon, 26 Feb 2024 11:35:52 +0000
Subject: [PATCH] ci: Enable more documentation building

Here we enable documentation building on

1. Darwin: The sphinx toolchain was already installed so we enable html
   and manpages.
2. Rocky8: Full documentation (toolchain already installed)
3. Alpine: Full documetnation (toolchain already installed)
4. Windows: HTML and manpages (toolchain already installed)

Fixes #24465
---
 .gitlab/ci.sh                 |  6 +++--
 .gitlab/generate-ci/gen_ci.hs | 10 +++------
 .gitlab/jobs.yaml             | 41 +++++++++++++++--------------------
 3 files changed, 24 insertions(+), 33 deletions(-)

diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh
index 131dd044b9c5..39845ba5caee 100755
--- a/.gitlab/ci.sh
+++ b/.gitlab/ci.sh
@@ -151,6 +151,8 @@ function mingw_init() {
 
   # We always use mingw64 Python to avoid path length issues like #17483.
   export PYTHON="/mingw64/bin/python3"
+  # And need to use sphinx-build from the environment
+  export SPHINXBUILD="/mingw64/bin/sphinx-build.exe"
 }
 
 # This will contain GHC's local native toolchain
@@ -305,7 +307,7 @@ function fetch_cabal() {
           fail "neither CABAL nor CABAL_INSTALL_VERSION are not set"
       fi
 
-      start_section "fetch GHC"
+      start_section "fetch cabal"
       case "$(uname)" in
         # N.B. Windows uses zip whereas all others use .tar.xz
         MSYS_*|MINGW*)
@@ -332,7 +334,7 @@ function fetch_cabal() {
           mv cabal "$toolchain/bin"
           ;;
       esac
-      end_section "fetch GHC"
+      end_section "fetch cabal"
   fi
 }
 
diff --git a/.gitlab/generate-ci/gen_ci.hs b/.gitlab/generate-ci/gen_ci.hs
index 41726b33344b..b352ace63e05 100644
--- a/.gitlab/generate-ci/gen_ci.hs
+++ b/.gitlab/generate-ci/gen_ci.hs
@@ -407,7 +407,7 @@ opsysVariables AArch64 (Darwin {}) =
           , "LANG" =: "en_US.UTF-8"
           , "CONFIGURE_ARGS" =: "--with-intree-gmp --with-system-libffi"
           -- Fonts can't be installed on darwin
-          , "HADRIAN_ARGS" =: "--docs=no-sphinx"
+          , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs"
           ]
 opsysVariables Amd64 (Darwin {}) =
   mconcat [ "NIX_SYSTEM" =: "x86_64-darwin"
@@ -421,14 +421,14 @@ opsysVariables Amd64 (Darwin {}) =
           , "LANG" =: "en_US.UTF-8"
           , "CONFIGURE_ARGS" =: "--with-intree-gmp --with-system-libffi"
           -- Fonts can't be installed on darwin
-          , "HADRIAN_ARGS" =: "--docs=no-sphinx"
+          , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs"
 
           ]
 opsysVariables _ (Windows {}) =
   mconcat [ "MSYSTEM" =: "CLANG64"
-          , "HADRIAN_ARGS" =: "--docs=no-sphinx"
           , "LANG" =: "en_US.UTF-8"
           , "CABAL_INSTALL_VERSION" =: "3.10.2.0"
+          , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs"
           , "GHC_VERSION" =: "9.6.4" ]
 opsysVariables _ _ = mempty
 
@@ -436,7 +436,6 @@ alpineVariables = mconcat
   [ -- Due to #20266
     "CONFIGURE_ARGS" =: "--disable-ld-override"
   , "INSTALL_CONFIGURE_ARGS" =: "--disable-ld-override"
-  , "HADRIAN_ARGS" =: "--docs=no-sphinx"
     -- encoding004: due to lack of locale support
     -- T10458, ghcilink002: due to #17869
   , "BROKEN_TESTS" =: "encoding004 T10458"
@@ -450,9 +449,6 @@ distroVariables Centos7 = mconcat [
     "HADRIAN_ARGS" =: "--docs=no-sphinx"
   , "BROKEN_TESTS" =: "T22012" -- due to #23979
   ]
-distroVariables Rocky8 = mconcat [
-  "HADRIAN_ARGS" =: "--docs=no-sphinx"
-  ]
 distroVariables Fedora33 = mconcat
   -- LLC/OPT do not work for some reason in our fedora images
   -- These tests fail with this error: T11649 T5681 T7571 T8131b
diff --git a/.gitlab/jobs.yaml b/.gitlab/jobs.yaml
index 71017e4aeba2..2c3ac84c4015 100644
--- a/.gitlab/jobs.yaml
+++ b/.gitlab/jobs.yaml
@@ -57,7 +57,7 @@
       "BIN_DIST_NAME": "ghc-aarch64-darwin-validate",
       "BUILD_FLAVOUR": "validate",
       "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
+      "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
       "LANG": "en_US.UTF-8",
       "MACOSX_DEPLOYMENT_TARGET": "11.0",
       "NIX_SYSTEM": "aarch64-darwin",
@@ -305,7 +305,7 @@
       "BIN_DIST_NAME": "ghc-aarch64-darwin-validate",
       "BUILD_FLAVOUR": "validate",
       "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
+      "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
       "LANG": "en_US.UTF-8",
       "MACOSX_DEPLOYMENT_TARGET": "11.0",
       "NIX_SYSTEM": "aarch64-darwin",
@@ -372,7 +372,6 @@
       "BROKEN_TESTS": "encoding004 T10458",
       "BUILD_FLAVOUR": "validate",
       "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
       "INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
       "RUNTEST_ARGS": "",
       "TEST_ENV": "aarch64-linux-alpine3_18-validate",
@@ -684,7 +683,7 @@
       "BIN_DIST_NAME": "ghc-x86_64-darwin-validate",
       "BUILD_FLAVOUR": "validate",
       "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
+      "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
       "LANG": "en_US.UTF-8",
       "MACOSX_DEPLOYMENT_TARGET": "10.13",
       "NIX_SYSTEM": "x86_64-darwin",
@@ -818,7 +817,6 @@
       "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458",
       "BUILD_FLAVOUR": "validate+fully_static",
       "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
       "INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
       "RUNTEST_ARGS": "",
       "TEST_ENV": "x86_64-linux-alpine3_12-int_native-validate+fully_static",
@@ -883,7 +881,6 @@
       "BROKEN_TESTS": "encoding004 T10458",
       "BUILD_FLAVOUR": "validate",
       "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
       "INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
       "RUNTEST_ARGS": "",
       "TEST_ENV": "x86_64-linux-alpine3_12-validate",
@@ -948,7 +945,6 @@
       "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458",
       "BUILD_FLAVOUR": "validate+fully_static",
       "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
       "INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
       "RUNTEST_ARGS": "",
       "TEST_ENV": "x86_64-linux-alpine3_12-validate+fully_static",
@@ -1013,7 +1009,6 @@
       "BROKEN_TESTS": "encoding004 T10458",
       "BUILD_FLAVOUR": "validate",
       "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
       "INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
       "RUNTEST_ARGS": "",
       "TEST_ENV": "x86_64-linux-alpine3_18-validate",
@@ -2526,7 +2521,6 @@
       "BIN_DIST_NAME": "ghc-x86_64-linux-rocky8-validate",
       "BUILD_FLAVOUR": "validate",
       "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
       "RUNTEST_ARGS": "",
       "TEST_ENV": "x86_64-linux-rocky8-validate",
       "XZ_OPT": "-9"
@@ -2710,7 +2704,7 @@
       "CABAL_INSTALL_VERSION": "3.10.2.0",
       "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
       "GHC_VERSION": "9.6.4",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
+      "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
       "LANG": "en_US.UTF-8",
       "MSYSTEM": "CLANG64",
       "RUNTEST_ARGS": "",
@@ -2772,7 +2766,7 @@
       "CABAL_INSTALL_VERSION": "3.10.2.0",
       "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
       "GHC_VERSION": "9.6.4",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
+      "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
       "LANG": "en_US.UTF-8",
       "MSYSTEM": "CLANG64",
       "RUNTEST_ARGS": "",
@@ -2837,7 +2831,7 @@
       "BIN_DIST_NAME": "ghc-aarch64-darwin-release",
       "BUILD_FLAVOUR": "release",
       "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
+      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs",
       "IGNORE_PERF_FAILURES": "all",
       "LANG": "en_US.UTF-8",
       "MACOSX_DEPLOYMENT_TARGET": "11.0",
@@ -2905,7 +2899,7 @@
       "BROKEN_TESTS": "encoding004 T10458",
       "BUILD_FLAVOUR": "release+no_split_sections",
       "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
+      "HADRIAN_ARGS": "--hash-unit-ids",
       "IGNORE_PERF_FAILURES": "all",
       "INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
       "RUNTEST_ARGS": "",
@@ -3162,7 +3156,7 @@
       "BIN_DIST_NAME": "ghc-x86_64-darwin-release",
       "BUILD_FLAVOUR": "release",
       "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
+      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs",
       "IGNORE_PERF_FAILURES": "all",
       "LANG": "en_US.UTF-8",
       "MACOSX_DEPLOYMENT_TARGET": "10.13",
@@ -3233,7 +3227,7 @@
       "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458",
       "BUILD_FLAVOUR": "release+fully_static",
       "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
+      "HADRIAN_ARGS": "--hash-unit-ids",
       "IGNORE_PERF_FAILURES": "all",
       "INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
       "RUNTEST_ARGS": "",
@@ -3299,7 +3293,7 @@
       "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458",
       "BUILD_FLAVOUR": "release+fully_static+no_split_sections",
       "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
+      "HADRIAN_ARGS": "--hash-unit-ids",
       "IGNORE_PERF_FAILURES": "all",
       "INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
       "RUNTEST_ARGS": "",
@@ -3365,7 +3359,7 @@
       "BROKEN_TESTS": "encoding004 T10458",
       "BUILD_FLAVOUR": "release+no_split_sections",
       "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
+      "HADRIAN_ARGS": "--hash-unit-ids",
       "IGNORE_PERF_FAILURES": "all",
       "INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
       "RUNTEST_ARGS": "",
@@ -3431,7 +3425,7 @@
       "BROKEN_TESTS": "encoding004 T10458",
       "BUILD_FLAVOUR": "release+no_split_sections",
       "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
+      "HADRIAN_ARGS": "--hash-unit-ids",
       "IGNORE_PERF_FAILURES": "all",
       "INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
       "RUNTEST_ARGS": "",
@@ -4143,7 +4137,7 @@
       "BIN_DIST_NAME": "ghc-x86_64-linux-rocky8-release",
       "BUILD_FLAVOUR": "release",
       "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
+      "HADRIAN_ARGS": "--hash-unit-ids",
       "IGNORE_PERF_FAILURES": "all",
       "RUNTEST_ARGS": "",
       "TEST_ENV": "x86_64-linux-rocky8-release",
@@ -4332,7 +4326,7 @@
       "CABAL_INSTALL_VERSION": "3.10.2.0",
       "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
       "GHC_VERSION": "9.6.4",
-      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
+      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs",
       "IGNORE_PERF_FAILURES": "all",
       "LANG": "en_US.UTF-8",
       "MSYSTEM": "CLANG64",
@@ -4395,7 +4389,7 @@
       "CABAL_INSTALL_VERSION": "3.10.2.0",
       "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
       "GHC_VERSION": "9.6.4",
-      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
+      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx-pdfs",
       "IGNORE_PERF_FAILURES": "all",
       "LANG": "en_US.UTF-8",
       "MSYSTEM": "CLANG64",
@@ -4461,7 +4455,7 @@
       "BIN_DIST_NAME": "ghc-x86_64-darwin-validate",
       "BUILD_FLAVOUR": "validate",
       "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
+      "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
       "LANG": "en_US.UTF-8",
       "MACOSX_DEPLOYMENT_TARGET": "10.13",
       "NIX_SYSTEM": "x86_64-darwin",
@@ -4593,7 +4587,6 @@
       "BROKEN_TESTS": "ghcilink002 linker_unload_native encoding004 T10458",
       "BUILD_FLAVOUR": "validate+fully_static",
       "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
       "INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
       "RUNTEST_ARGS": "",
       "TEST_ENV": "x86_64-linux-alpine3_12-validate+fully_static"
@@ -5588,7 +5581,7 @@
       "CABAL_INSTALL_VERSION": "3.10.2.0",
       "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
       "GHC_VERSION": "9.6.4",
-      "HADRIAN_ARGS": "--docs=no-sphinx",
+      "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
       "LANG": "en_US.UTF-8",
       "MSYSTEM": "CLANG64",
       "RUNTEST_ARGS": "",
-- 
GitLab