Bug 202585 - lang/ghc fails to install (bin/haddock-ghc missing)
Summary: lang/ghc fails to install (bin/haddock-ghc missing)
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: haskell
: 207658 (view as bug list)
Depends on:
Reported: 2015-08-23 09:23 UTC by Tobias Berner
Modified: 2018-01-16 12:43 UTC (History)
8 users (show)

See Also:
pgj: maintainer-feedback+
fk: merge-quarterly?

lang/ghc: Unbreak packaging with DOCS=off (1.66 KB, patch)
2017-08-04 07:34 UTC, Fabian Keil
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Berner 2015-08-23 09:23:53 UTC
lang/ghc fails to install with:
===>   Registering installation for ghc-7.10.2
pkg-static: Unable to access file /tmp/usr/ports/lang/ghc/work/stage/usr/local/bin/haddock-ghc-7.10.2: No such file or directory
*** Error code 74

Portoptions are as follows:
===> The following configuration options are available for ghc-7.10.2:
     DOCS=off: Install HTML documentation
     DYNAMIC=on: Add support for dynamic linking
     LLVM=off: Add support for generating code via LLVM
     PROFILE=on: Add support for performance profiling
====> Options available for the single C_Compiler: you have to select exactly one of them
     GCC=on: Build with GCC (from ports)
     PCLANG=off: Build with Clang from ports
     BCLANG=off: Build with Clang from base
===> Use 'make config' to modify these settings
Comment 1 Raymond Pasco 2015-12-05 18:46:31 UTC
I can reproduce this. It looks like it happens when the DOCS knob is off.
Comment 2 Gabor Pali freebsd_committer 2016-02-02 13:18:12 UTC
I have a half-baked solution for the problem.  Unfortunately, it is deeper than it looks at the first sight.  We wanted to maintain the possibility that Haddock could be installed as a port when it was not installed along GHC -- but it is not going to work properly for some reason, unfortunately I do not remember the exact ones.  Anyway, I will try not to solve all the entire problem together, just take care of this annoyance.
Comment 3 Gabor Pali freebsd_committer 2016-03-05 09:05:21 UTC
*** Bug 207658 has been marked as a duplicate of this bug. ***
Comment 4 Tobias Kortkamp freebsd_committer 2016-07-22 20:44:28 UTC
This happens to me too.  GHC fails in the package phase when the DOCS options is turned off.  This is in a Poudriere FreeBSD 10.3/amd64 jail.  See http://paste2.org/FIstBsV1 for the whole build log in case it helps.  With DOCS=on the build finishes again.
Comment 5 Fabian Keil 2017-08-04 07:34:44 UTC
Created attachment 185013 [details]
lang/ghc: Unbreak packaging with DOCS=off

I'm using the attached patch on ElectroBSD.

This fix was tested by building textproc/hs-pandoc and
it's dependencies with poudriere using the 2017Q3 branch                                            
with a global DOCS=off.                                                                             
Due to the post-install target the @exec and @unexec                                                
lines in the pkg-plist could probably be removed completely,                                        
but I haven't tested this.                                                                          

I'm not sure if this is the "half-baked solution" Gabor was
referring to in #c2 but (probably like most people building
lang/ghc) I only build it as a dependency for other Haskell ports
and AFAICT the ones I'm using don't need haddock.
Comment 6 Gabor Pali freebsd_committer 2017-08-05 04:14:43 UTC
That is about the interaction with the devel/hs-haddock port.  Even if you did not install lang/ghc with Haddock, there is a symlink-based solution for being able to add Haddock later by the devel/hs-haddock port.  Once you delete the hs-haddock package the link to the original Haddock binary should be restored, but only if lang/ghc was installed with Haddock support.

So that is why the solution is not that straightforward.

I am hoping to resolve this issue as part of the upcoming update to lang/ghc [1].  Currently it looks like using the following lines in the pkg-plist file of devel/hs-haddock can do the trick, in addition to the change to lang/ghc you have suggested:

@postexec /bin/ln -sf %%EXECUTABLE%% %%HADDOCK%%
@postunexec [ -f %%GHC_HADDOCK_CMD%% ] && /bin/ln -sf %%GHC_HADDOCK_CMD%% %%HADDOCK%% || rm -f %%HADDOCK%%

[1] https://reviews.freebsd.org/D11558
Comment 7 arrowd 2018-01-16 12:43:25 UTC
The port builds fine with DOCS=off currently, so I presume @pgj committed a proper fix for the issue. But I'd wait for his feedback.