Skip to content

hadrian binary-dist-dir installs two copies of ghc.1 manpage

Summary

I just finally enabled the ghc.1 manpage in the Fedora ghc9.6 package (with Hadrian). This was harder than expected because Hadrian seems to install two copies of ghc.1 (distros usually have to account for every packaged dir/file).

See https://src.fedoraproject.org/rpms/ghc9.6/c/65f403571c7033887a40ebef04753ae0d4f01898 for my workaround.

Steps to reproduce

Build binary-dist-dir of ghc-9.6.2 (with sphinx manpage enabled).

Hadrian bin-dist-dir installs a copy of ghc.1 in

%{_ghc_doc_dir}/users_guide/build-man/ghc.1

as well as expected %{_mandir}/man1/ghc.1.

Expected behavior

There should not be a copy of ghc.1 installed in %{_ghc_doc_dir}/users_guide/build-man/.

I think the buildsystem problem is that building of ghc.1 is triggered by the users_guide/build-man/ghc.1 target if I am not mistaken?

Environment

  • GHC version used: 9.6.2

Optional:

  • Operating System: Fedora Linux
  • System Architecture:

I tried poking around the Hadrian source but I couldn't really see how to fix this. I think the mandir install takes place from users_guide/build-man:

https://kojipkgs.fedoraproject.org/packages/ghc9.6/9.6.2/9.fc39/data/logs/x86_64/build.log (1.6MB)

:
/usr/bin/install -c -m 755 -d "/builddir/build/BUILDROOT/ghc9.6-9.6.2-9.fc39.x86_64/usr/lib64/ghc-9.6.2/lib"
# Work around #17418 on Darwin
if [ -e "" ]; then \
	"" -c -r "/builddir/build/BUILDROOT/ghc9.6-9.6.2-9.fc39.x86_64/usr/lib64/ghc-9.6.2/lib"; \
fi
if [ -f doc/users_guide/build-man/ghc.1 ]; then \
	/usr/bin/install -c -m 755 -d "/builddir/build/BUILDROOT/ghc9.6-9.6.2-9.fc39.x86_64/usr/share/man"; \
	/usr/bin/install -c -m 755 -d "/builddir/build/BUILDROOT/ghc9.6-9.6.2-9.fc39.x86_64/usr/share/man/man1"; \
	/usr/bin/install -c -m 644  doc/users_guide/build-man/ghc.1 "/builddir/build/BUILDROOT/ghc9.6-9.6.2-9.fc39.x86_64/usr/share/man/man1"; \
fi
Copying docs to /builddir/build/BUILDROOT/ghc9.6-9.6.2-9.fc39.x86_64/usr/share/doc/ghc9.6
/usr/bin/install -c -m 755 -d "/builddir/build/BUILDROOT/ghc9.6-9.6.2-9.fc39.x86_64/usr/share/doc/ghc9.6"
if [ -d doc ]; then \
	cd doc; /usr/bin/find . -type f -exec sh -c \
		'/usr/bin/install -c -m 755 -d "/builddir/build/BUILDROOT/ghc9.6-9.6.2-9.fc39.x86_64/usr/share/doc/ghc9.6/`dirname $1`" && /usr/bin/install -c -m 644 "$1" "/builddir/build/BUILDROOT/ghc9.6-9.6.2-9.fc39.x86_64/usr/share/doc/ghc9.6/`dirname $1`"' \
		sh '{}' ';'; \
fi
:

This is not such a big deal (not a high a priority and there's a workaround) but it also feels messy - so it would be good to improve this.

As a general principle I would also encourage upstream to consider packaging ghc (or just checking the binary content) in CI ideally to avoid this kind of cruft from occurring.

Edited by Jens Petersen
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information