From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1562629-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 97B9D15814C
	for <garchives@archives.gentoo.org>; Sat, 14 Oct 2023 00:47:52 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 8B47A2BC033;
	Sat, 14 Oct 2023 00:47:51 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 54D202BC02C
	for <gentoo-commits@lists.gentoo.org>; Sat, 14 Oct 2023 00:47:51 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 51887335C5D
	for <gentoo-commits@lists.gentoo.org>; Sat, 14 Oct 2023 00:47:50 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id A8514118B
	for <gentoo-commits@lists.gentoo.org>; Sat, 14 Oct 2023 00:47:48 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1697244425.d53d537ffcafbf92c3d364db95427303ecf6aed1.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/ghc/
X-VCS-Repository: repo/gentoo
X-VCS-Files: dev-lang/ghc/ghc-9.0.2-r4.ebuild
X-VCS-Directories: dev-lang/ghc/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: d53d537ffcafbf92c3d364db95427303ecf6aed1
X-VCS-Branch: master
Date: Sat, 14 Oct 2023 00:47:48 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 2238b77a-7694-4fcb-b356-e12831400f4b
X-Archives-Hash: 71b2fd7a700af4aad126c08cf537e077

commit:     d53d537ffcafbf92c3d364db95427303ecf6aed1
Author:     hololeap <hololeap <AT> protonmail <DOT> com>
AuthorDate: Sun Oct  8 19:56:47 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct 14 00:47:05 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d53d537f

dev-lang/ghc: Use system sphinx-rtd-theme

This allows sphinx-7 to build the GHC user's guide

The upstream rtd-theme that is bundled with GHC has been updated but
none of our GHC versions contain this fix.

See: https://gitlab.haskell.org/ghc/ghc/-/commit/70526f5bd8886126f49833ef20604a2c6477780a
Closes: https://bugs.gentoo.org/906784
Signed-off-by: hololeap <hololeap <AT> protonmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-lang/ghc/ghc-9.0.2-r4.ebuild | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/dev-lang/ghc/ghc-9.0.2-r4.ebuild b/dev-lang/ghc/ghc-9.0.2-r4.ebuild
index 1691ba87bc87..b3d72fb4d5eb 100644
--- a/dev-lang/ghc/ghc-9.0.2-r4.ebuild
+++ b/dev-lang/ghc/ghc-9.0.2-r4.ebuild
@@ -165,6 +165,7 @@ BDEPEND="
 		app-text/docbook-xml-dtd:4.5
 		app-text/docbook-xsl-stylesheets
 		dev-python/sphinx
+		dev-python/sphinx-rtd-theme
 		>=dev-libs/libxslt-1.1.2 )
 	!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )
 	test? ( ${PYTHON_DEPS} )
@@ -597,6 +598,22 @@ src_prepare() {
 		eapply "${FILESDIR}"/${PN}-9.0.2-fptools.patch # clang-16 workaround
 		eapply "${FILESDIR}"/${PN}-9.0.2-sphinx-6.patch
 
+		# FIXME: A hack that allows dev-python/sphinx-7 to build the docs
+		#
+		# GHC has updated the bundled version here:
+		# <https://gitlab.haskell.org/ghc/ghc/-/commit/70526f5bd8886126f49833ef20604a2c6477780a>
+		# However, the patch is difficult to apply and our versions of GHC don't
+		# have the update, so we symlink to the system version instead.
+		if use doc; then
+			local python_str="import sphinx_rtd_theme; print(sphinx_rtd_theme.__file__)"
+			local rtd_theme_dir="$(dirname $("${EPYTHON}" -c "$python_str"))"
+			local orig_rtd_theme_dir="${S}/docs/users_guide/rtd-theme"
+
+			einfo "Replacing bundled rtd-theme with dev-python/sphinx-rtd-theme"
+			rm -r "${orig_rtd_theme_dir}" || die
+			ln -s "${rtd_theme_dir}" "${orig_rtd_theme_dir}" || die
+		fi
+
 		# mingw32 target
 		pushd "${S}/libraries/Win32"
 			eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround