diff --git a/ghc.spec b/ghc.spec
index de0f1501293fbe8f337c94dc1c4d90b2e345ac9c..0b1de834ad0e5c6a05d1625fc5e2e24ba554f210 100644
--- a/ghc.spec
+++ b/ghc.spec
@@ -56,7 +56,7 @@
Name: ghc
Version: %{full_version}
-Release: 1
+Release: 2
Summary: The Glorious Glasgow Haskell Compiler
License: BSD-3-Clause
URL: https://www.haskell.org/ghc
@@ -145,6 +145,7 @@ Haskell home page at .
%package compiler
Summary: GHC compiler and utilities
License: BSD-3-Clause
+Requires: %{name}-filesystem = %{version}-%{release}
Requires: gcc
Requires: ghc-base-devel = %{base_ver}-%{release}
Provides: hsc2hs-%{hsc2hs_ver}-%{release}
@@ -170,6 +171,15 @@ BuildArch: noarch
%description help
This package provides the GHC User Guide, Haddock manual and
GHC Haskell libraries documentation.
+
+%package filesystem
+Summary: Shared directories for Haskell documentation
+License: BSD-3-Clause
+BuildArch: noarch
+
+%description filesystem
+This package provides some common directories used for
+Haskell libraries documentation.
%endif
# These are libraries included with GHC compiler.
@@ -235,19 +245,19 @@ Installing this package causes %{name}-*-prof packages corresponding to
%prep
%setup -q
-%patch1 -p1
-%patch2 -p1
-%patch3 -p1
+%patch -P1 -p1
+%patch -P2 -p1
+%patch -P3 -p1
# Judging whether we need to apply the sphinx7 patch.
%if %{with help}
%define sphinx_version_7 %( if [[ `sphinx-build --version | cut -d' ' -f2` < "7.0.0" ]]; then echo "0"; else echo "1"; fi )
%if %sphinx_version_7
-%patch4 -p1
+%patch -P4 -p1
%endif
%endif
-%patch5 -p1
+%patch -P5 -p1
# Delete in-tree libffi tarballs for using system libffi
rm libffi-tarballs/libffi-*.tar.gz
@@ -509,11 +519,13 @@ $GHC --info
%{ghc_html_libraries_dir}/gen_contents_index
%verify(not size mtime) %{ghc_html_libraries_dir}/doc-index*.html
%verify(not size mtime) %{ghc_html_libraries_dir}/index*.html
+%{ghc_html_dir}/users_guide
+%{ghc_html_dir}/Haddock
+
+%files filesystem
%dir %_ghc_doc_dir
%dir %ghc_html_dir
%dir %ghc_html_libraries_dir
-%{ghc_html_dir}/users_guide
-%{ghc_html_dir}/Haddock
%endif
%if %{with ghc_prof}
@@ -521,5 +533,9 @@ $GHC --info
%endif
%changelog
+* Fri Jul 26 2024 Lin Runze 9.6.3-2
+- Replace %patchN with %patch -P, %patchN is deprecated.
+- Add ghc-filesystem subpackage.
+
* Fri Oct 27 2023 Lin Runze 9.6.3-1
- Package init