Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Feb 2008 15:36:11 GMT
From:      User & modyun <jacula@gmail.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/120838: Hyperlinkable Libraries Documentation for: lang/ghc devel/hs-haddock
Message-ID:  <200802191536.m1JFaBS9096806@freefall.freebsd.org>
Resent-Message-ID: <200802191540.m1JFe8Iw097376@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         120838
>Category:       ports
>Synopsis:       Hyperlinkable Libraries Documentation for: lang/ghc devel/hs-haddock
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 19 15:40:08 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     User & modyun
>Release:        FreeBSD 7.0-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD splork.wirewater.yow 7.0-PRERELEASE FreeBSD 7.0-PRERELEASE #0: Sat Jan 19 15:48:03 UTC 2008 root@splork.wirewater.yow:/usr/obj/usr/src/sys/JACULA i386


	
>Description:

Hi all.

These two patches address many different kind of problems.
But the three principal reasons for them are:

1) Building the hyperlinkable documentation of ghc
   libraries directly, without to have to rebuild
   ghc itself and so razoring the chicken-egg problem
   for the couple ghc/haddock.

2) Solving the central problem for the port lang/ghc-doc
   about the haddock interface files (the files *.haddock).
   In fact these are architecture dependent and unless
   this port doesn't supply with the right files for a
   FreeBSD system, it's impossible to use these ones
   to hyperlink the documentation with haddock.
   At this moment, for example, the haddock interface files
   lang/ghc-doc install are dos files. Another problem
   of a binay port, like lang/ghc-doc, is that you have
   to update, in any case, the registered paths for the
   documentation if these are different from the standard
   of the port lang/ghc.
    
3) Building the libraries documentation of haddock without
   to have to rebuild haddock itself or to commit a new port.

The solutions adopted are cheapest that I could imagine, and
don't break any update process with circular dependences:
for example to use a already installed version of haddock
to compile the documentation of ghc could break down this
process and I don't add it like an option.

Another solution could be not to use a: 
cd ${PORTSDIR}/devel/hs-haddock && ${MAKE} ...

but incorporating this building process into the lang/ghc
port; this doesn't scale well, also because there are
others functionalities that might to be added in the same
way. 


A skeleton for these problems is this:

lang/ghc:

- A new knob WITH_DOCS is been introduced.

- The problem of the hidden CONFIGURE_TARGET variable is been solved.

- The DOCSDIR is been changed.

- Now ghc knows about MANDIR and INFODIR.

- A man page of ghc will be installed, in any case.

- Also the DOCSDIR, with an subdir "cabal"  is been cabalised
  for the libraries documentation that, at this moment, no ghc
  related port install. This is a pity.

- A pkg-message.haddock about the problem of the HSghc
  libraries, related to the WITH_DOCS, is been add.


devel/haddock:

- It's been introduced the internal option SLAVE to install
  the lang/ghc with the hyperlinkable documentation.

- A new knob WITH_DOCS is been introduced in substitution of
  NOPORTDOCS.

- A new knob WITH_DEVELOPER  is been introduced for the haddock
  hyperlinkable documentations.

- The DOCSDIR is been changed.

- The pkg-message.developer related to the WITH_DEVELOPER
  knob, is been add.

- The devel/readline dependence is been add, when the devel/readline
  port is been installed.

- The problem of an unregistered installation, using the package system, 
  is been correct. Also Installing a register.sh file permit to reregister
  haddock if, for example, ghc is deinstalled and reinstalled, without
  to have to reinstall haddock: lang/ghc is not a run dependency for the
  devel/haddock port.

I'm sorry, but both the pkg-descrs are been integrated; I hope this
is not a problem.

About the devel/haddock port I want add that any warnings is a good
warning, then I didn't clean the installation messages.

I hope you could commit these two patches.

Best Regards

Giuseppe Pilichi aka Jacula Modyun <jacula@gmail.com>

>How-To-Repeat:
	
>Fix:

	

--- patch-lang-ghc begins here ---
diff -uNr ghc.orig/Makefile ghc/Makefile
--- ghc.orig/Makefile	2008-02-09 18:05:45.000000000 +0000
+++ ghc/Makefile	2008-02-19 08:14:56.000000000 +0000
@@ -9,17 +9,19 @@
 CATEGORIES=	lang haskell
 MASTER_SITES=	http://www.haskell.org/ghc/dist/${PORTVERSION}/:source \
 		http://www.haskell.org/ghc/dist/${PORTVERSION}/FreeBSD/:boot \
-		${MASTER_SITE_LOCAL:S/$/:boot/}
+		${MASTER_SITE_LOCAL:S/$/:boot/} http://www.haskell.org/haddock/dist/:docs
 DISTFILES=	ghc-${PORTVERSION}-src${EXTRACT_SUFX}:source \
 		ghc-${PORTVERSION}-src-extralibs${EXTRACT_SUFX}:source
 
 MAINTAINER=	haskell@FreeBSD.org
 COMMENT=	A Compiler for the functional language Haskell
 
+GHC_VERSION=	${PORTVERSION}
 ONLY_FOR_ARCHS=	i386
 
-BOOT_DIST6=	ghc-${PORTVERSION}-i386-unknown-freebsd6-boot${EXTRACT_SUFX}:boot
-BOOT_DIST7=	ghc-${PORTVERSION}-i386-unknown-freebsd7-boot${EXTRACT_SUFX}:boot
+BOOT_DIST6=	ghc-${GHC_VERSION}-i386-unknown-freebsd6-boot${EXTRACT_SUFX}:boot
+BOOT_DIST7=	ghc-${GHC_VERSION}-i386-unknown-freebsd7-boot${EXTRACT_SUFX}:boot
+DOCS_DIST=	haddock-2.0.0.0.tar.gz:docs
 
 USE_AUTOTOOLS=	autoconf:261:env
 USE_BZIP2=	yes
@@ -27,9 +29,16 @@
 
 USE_PERL5=	yes
 USE_GMAKE=	yes
+
+# The configure process accepts,filters and canonicalises
+# the CONFIGURE_TARGET variable. You can read the files
+# ${WRKSRC}/configure and ${WRKSRC}/config.sub.
+# This is better fixed in the ${WRKSRC}/mk/build.mk.
+# You can view below.
 GNU_CONFIGURE=	yes
 
-OPTIONS=	PROFILE "Compile for profiling as well" on
+OPTIONS=	PROFILE "Compile for profiling as well" on \
+		DOCS "Install HTML documentation" off
 
 .include <bsd.port.pre.mk>
 
@@ -46,22 +55,29 @@
 #DISTFILES+=	${BOOT_DIST5}
 .endif
 
-PLIST_SUB+=	GHC_VERSION=${PORTVERSION}
+DOCSDIR=	${PREFIX}/share/doc/${DISTNAME}
+PORTDOCS=	*
+MAN1=		ghc.1
+
+PLIST_SUB+=	GHC_VERSION=${GHC_VERSION}
+
 .if defined(WITHOUT_PROFILE)
 PLIST_SUB+=	PROFILE="@comment "
 .else
 PLIST_SUB+=	PROFILE=""
 .endif
 
+.if defined(WITH_DOCS)
+SUB_FILES= pkg-message.haddock
+.endif
+
 # This port builds by downloading a minimal binary distribution of GHC and
 # using that to bootstrap.
-BOOT_DIR=	${WRKDIR}/ghc-${PORTVERSION}-boot
-BOOT_GHC=	${BOOT_DIR}/bin/ghc-${PORTVERSION}
+BOOT_DIR=	${WRKDIR}/ghc-${GHC_VERSION}-boot
+BOOT_GHC=	${BOOT_DIR}/bin/ghc-${GHC_VERSION}
 
 CONFIGURE_ARGS+=	--with-ghc=${BOOT_GHC}  --with-gcc=${CC} \
 	--with-gmp-includes=${LOCALBASE}/include --with-gmp-libraries=${LOCALBASE}/lib 
-# specifying CONFIGURE_TARGET doesn't work for some reason.
-CONFIGURE_TARGET=
 # libgmp:
 CONFIGURE_ENV+=	CFLAGS=-I${LOCALBASE}/include LDFLAGS=-L${LOCALBASE}/lib
 
@@ -71,10 +87,47 @@
 MAKE_ENV+=	TMPDIR=${TMPDIR}
 EXCLUDELIBS=	ALUT GLUT HGL OpenAL OpenGL X11
 
+# Defining WITH_DOCS:
+# An in place installation and registration of haddock will be
+# activated. In this way it's possible to use it directly into 
+# the build tree, without needing to install it. At the end
+# you could view the output of: ${BOOT_GHC} describe haddock
+.if defined(WITH_DOCS)
+BOOT_CABAL=	${BOOT_DIR}/bin/runghc -f ${BOOT_GHC} Setup.lhs
+
+HADDOCK_PREFIX=	${WRKDIR}/hs-haddock
+HADDOCK_WRKDIR=	${HADDOCK_PREFIX}/work
+
+MAKE_ENV+=	PATH=${PATH}:${HADDOCK_PREFIX}/bin
+CONFIGURE_ENV+=	PATH=${PATH}:${HADDOCK_PREFIX}/bin
+
+CONFIGURE_ARGS+= HaddockCmd=${HADDOCK_PREFIX}/bin/haddock
+
+DISTFILES+=	${DOCS_DIST}
+EXTRACT_ONLY=	${_DISTFILES:S/${DOCS_DIST:S/:docs//g}//g}
+BUILD_DEPENDS+=	${LOCALBASE}/share/xsl/docbook/html:${PORTSDIR}/textproc/docbook-xsl \
+		${LOCALBASE}/bin/xsltproc:${PORTSDIR}/textproc/libxslt
+.endif
+
 post-extract:
+	@${ECHO} >> ${WRKSRC}/mk/build.mk "HOSTPLATFORM = ${CONFIGURE_TARGET}"
+	@${ECHO} >> ${WRKSRC}/mk/build.mk "TARGETPLATFORM = ${CONFIGURE_TARGET}"
+	@${ECHO} >> ${WRKSRC}/mk/build.mk "BUILDPLATFORM = ${CONFIGURE_TARGET}"
+	@${ECHO} >> ${WRKSRC}/mk/build.mk "HOSTPLATFORM_CPP = ${CONFIGURE_TARGET}"
+	@${ECHO} >> ${WRKSRC}/mk/build.mk "TARGETPLATFORM_CPP = ${CONFIGURE_TARGET}"
+	@${ECHO} >> ${WRKSRC}/mk/build.mk "BUILDPLATFORM_CPP = ${CONFIGURE_TARGET}"
+	@${ECHO} >> ${WRKSRC}/mk/build.mk "docdir = ${PREFIX}/share/doc/ghc-${GHC_VERSION}"
+	@${ECHO} >> ${WRKSRC}/mk/build.mk "htmldir = ${PREFIX}/share/doc/ghc-${GHC_VERSION}"
+	@${ECHO} >> ${WRKSRC}/mk/build.mk "mandir = ${PREFIX}/man"
+	@${ECHO} >> ${WRKSRC}/mk/build.mk "infodir = ${PREFIX}/info"
 .if defined(WITHOUT_PROFILE)
-	@${ECHO} >>${WRKSRC}/mk/build.mk GhcLibWays=
+	@${ECHO} >> ${WRKSRC}/mk/build.mk "GhcLibWays="
+.endif
+.if defined(WITH_DOCS)
+	@${ECHO} >> ${WRKSRC}/mk/build.mk "XMLDocWays = html"
+	@${ECHO} >> ${WRKSRC}/mk/build.mk "HADDOCK_DOCS = YES"
 .endif
+	
 	@cd ${WRKSRC}/libraries && ${RM} -rf ${EXCLUDELIBS}
 
 post-patch:
@@ -85,10 +138,40 @@
 	@(cd ${BOOT_DIR} && ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS} --prefix=${BOOT_DIR})
 	@(cd ${BOOT_DIR} && ${GMAKE} install)
 
+# Defining WITH_DOCS:
+# Defining "SLAVE" in devel/hs-haddock flips the building process
+# functionally to this port.
+.if defined(WITH_DOCS)
+	@echo -e "\a"
+	@${ECHO_MSG} "================================================================="
+	@${ECHO_MSG} "  WARNING: Now Haddock will be built, the port devel/hs-haddock  "
+	@${ECHO_MSG} "           won't be installed, but it takes place an in-place    " 
+	@${ECHO_MSG} "           installation and registration of Haddock.             " 
+	@${ECHO_MSG} "================================================================="
+	@${ECHO_MSG} ""
+	@sleep 3
+
+	@(cd ${PORTSDIR}/devel/hs-haddock && \
+	  ${MAKE} -DSLAVE GHC_CMD=${BOOT_GHC} CABAL_CMD="${BOOT_CABAL}" \
+	  		  PREFIX=${HADDOCK_PREFIX} WRKDIR=${HADDOCK_WRKDIR} build)
+.endif
+
 pre-build:
 	@${MKDIR} ${TMPDIR}
 
 post-install:
-	@${MKDIR} ${PREFIX}/lib/ghc-${PORTVERSION}/cabal		# cabalised hs-foo-ghc ports
+	# cabalised hs-foo-ghc ports
+	@${MKDIR} ${PREFIX}/lib/ghc-${PORTVERSION}/cabal
+	@${MKDIR} ${PREFIX}/share/doc/ghc-${GHC_VERSION}/cabal
+
+.if defined(WITH_DOCS)
+	@(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} install-docs)
+
+	@${ECHO_MSG}
+	@${CAT} ${PKGMESSAGE}
+	@${ECHO_MSG}
+.else
+	@${INSTALL_MAN} ${WRKSRC}/docs/man/ghc.1 ${PREFIX}/man/man1
+.endif
 
 .include <bsd.port.post.mk>
diff -uNr ghc.orig/distinfo ghc/distinfo
--- ghc.orig/distinfo	2008-01-04 21:01:07.000000000 +0000
+++ ghc/distinfo	2008-02-13 07:45:21.000000000 +0000
@@ -10,3 +10,6 @@
 MD5 (ghc-6.8.2-i386-unknown-freebsd7-boot.tar.bz2) = 1761930aff8e7e55569ed9a69937fab7
 SHA256 (ghc-6.8.2-i386-unknown-freebsd7-boot.tar.bz2) = 54f66813e8abca0e77aa15709f482f11dbd1850d3f06ba31be73fdc600cc6136
 SIZE (ghc-6.8.2-i386-unknown-freebsd7-boot.tar.bz2) = 28717650
+MD5 (haddock-2.0.0.0.tar.gz) = ccd8b4a6f6b4fb084bdad02fbb215ca4
+SHA256 (haddock-2.0.0.0.tar.gz) = a2ea5bdc127bc8b189a8d869f582ec774fea0933e7f5ca89549a6c142b9993df
+SIZE (haddock-2.0.0.0.tar.gz) = 95311
diff -uNr ghc.orig/files/pkg-message.haddock.in ghc/files/pkg-message.haddock.in
--- ghc.orig/files/pkg-message.haddock.in	1970-01-01 00:00:00.000000000 +0000
+++ ghc/files/pkg-message.haddock.in	2008-02-19 08:58:28.000000000 +0000
@@ -0,0 +1,9 @@
+===============================================================
+
+  WARNING: Haddock doesn't like swimming in circles, so can't
+  handle mutually recursive modules currently, then the
+  documentation for the HSghc libraries isn't been compiled
+  and the paths haddock-interfaces and haddock-html about
+  ghc are fake (you can view ghp-pkg describe ghc).
+
+===============================================================
diff -uNr ghc.orig/pkg-descr ghc/pkg-descr
--- ghc.orig/pkg-descr	1999-11-10 17:25:28.000000000 +0000
+++ ghc/pkg-descr	2008-02-18 11:59:16.000000000 +0000
@@ -1,14 +1,29 @@
 GHC: The Glasgow Haskell Compiler.
 
+Haskell is the standard lazy purely functional programming language.
+The current language version is Haskell 98, agreed in December 1998,
+with a revised version published in January 2003.
+
+A wide variety of Haskell related resources (tutorials, libraries,
+specifications, documentation, compilers, interpreters, references,
+contact information, links to research groups) are available from
+the Haskell home page at http://haskell.org/.
+
 The Glasgow Haskell Compiler is a robust, fully-featured, optimising
-compiler for the functional programming language Haskell 98
-(http://www.haskell.org). GHC compiles Haskell to either native code
-or C. It implements numerous experimental language extensions to
+compiler for the functional programming language Haskell 98 generating
+good code for a variety of platforms. GHC is a state-of-the-art
+programming suite for Haskell and compiles Haskell to either native
+code or C. It implements numerous experimental language extensions to
 Haskell, including concurrency, a foreign language interface, several
 type-system extensions, exceptions, and so on. GHC comes with a
-generational garbage collector, a space and time profiler, and a
-comprehensive set of libraries.
+generational garbage collector, a space and time profiler, comprehensive
+set of libraries and an interactive system for convenient, quick
+development.
+
+The profiling libraries for Glorious Glasgow Haskell Compilation System
+should be installed when GHC's profiling subsystem is needed.
 
 Documentation can be found hanging off GHC's homepage, below.
 
 WWW: http://www.haskell.org/ghc/
+
diff -uNr ghc.orig/pkg-plist ghc/pkg-plist
--- ghc.orig/pkg-plist	2008-02-12 02:55:51.000000000 +0000
+++ ghc/pkg-plist	2008-02-18 06:20:44.000000000 +0000
@@ -1359,74 +1359,6 @@
 lib/ghc-%%GHC_VERSION%%/package.conf.old
 lib/ghc-%%GHC_VERSION%%/template-hsc.h
 lib/ghc-%%GHC_VERSION%%/unlit
-share/doc/ghc/libraries/Cabal/LICENSE
-share/doc/ghc/libraries/HUnit/LICENSE
-share/doc/ghc/libraries/QuickCheck/LICENSE
-share/doc/ghc/libraries/array/LICENSE
-share/doc/ghc/libraries/base/LICENSE
-share/doc/ghc/libraries/bytestring/LICENSE
-share/doc/ghc/libraries/cgi/LICENSE
-share/doc/ghc/libraries/containers/LICENSE
-share/doc/ghc/libraries/directory/LICENSE
-share/doc/ghc/libraries/fgl/LICENSE
-share/doc/ghc/libraries/haskell-src/LICENSE
-share/doc/ghc/libraries/haskell98/LICENSE
-share/doc/ghc/libraries/hpc/LICENSE
-share/doc/ghc/libraries/html/LICENSE
-share/doc/ghc/libraries/mtl/LICENSE
-share/doc/ghc/libraries/network/LICENSE
-share/doc/ghc/libraries/old-locale/LICENSE
-share/doc/ghc/libraries/old-time/LICENSE
-share/doc/ghc/libraries/packedstring/LICENSE
-share/doc/ghc/libraries/parallel/LICENSE
-share/doc/ghc/libraries/parsec/LICENSE
-share/doc/ghc/libraries/pretty/LICENSE
-share/doc/ghc/libraries/process/LICENSE
-share/doc/ghc/libraries/random/LICENSE
-share/doc/ghc/libraries/readline/LICENSE
-share/doc/ghc/libraries/regex-base/LICENSE
-share/doc/ghc/libraries/regex-compat/LICENSE
-share/doc/ghc/libraries/regex-posix/LICENSE
-share/doc/ghc/libraries/stm/LICENSE
-share/doc/ghc/libraries/template-haskell/LICENSE
-share/doc/ghc/libraries/time/LICENSE
-share/doc/ghc/libraries/unix/LICENSE
-share/doc/ghc/libraries/xhtml/LICENSE
-@dirrm share/doc/ghc/libraries/xhtml
-@dirrm share/doc/ghc/libraries/unix
-@dirrm share/doc/ghc/libraries/time
-@dirrm share/doc/ghc/libraries/template-haskell
-@dirrm share/doc/ghc/libraries/stm
-@dirrm share/doc/ghc/libraries/regex-posix
-@dirrm share/doc/ghc/libraries/regex-compat
-@dirrm share/doc/ghc/libraries/regex-base
-@dirrm share/doc/ghc/libraries/readline
-@dirrm share/doc/ghc/libraries/random
-@dirrm share/doc/ghc/libraries/process
-@dirrm share/doc/ghc/libraries/pretty
-@dirrm share/doc/ghc/libraries/parsec
-@dirrm share/doc/ghc/libraries/parallel
-@dirrm share/doc/ghc/libraries/packedstring
-@dirrm share/doc/ghc/libraries/old-time
-@dirrm share/doc/ghc/libraries/old-locale
-@dirrm share/doc/ghc/libraries/network
-@dirrm share/doc/ghc/libraries/mtl
-@dirrm share/doc/ghc/libraries/html
-@dirrm share/doc/ghc/libraries/hpc
-@dirrm share/doc/ghc/libraries/haskell98
-@dirrm share/doc/ghc/libraries/haskell-src
-@dirrm share/doc/ghc/libraries/fgl
-@dirrm share/doc/ghc/libraries/directory
-@dirrm share/doc/ghc/libraries/containers
-@dirrm share/doc/ghc/libraries/cgi
-@dirrm share/doc/ghc/libraries/bytestring
-@dirrm share/doc/ghc/libraries/base
-@dirrm share/doc/ghc/libraries/array
-@dirrm share/doc/ghc/libraries/QuickCheck
-@dirrm share/doc/ghc/libraries/HUnit
-@dirrm share/doc/ghc/libraries/Cabal
-@dirrm share/doc/ghc/libraries
-@dirrm share/doc/ghc
 @dirrm lib/ghc-%%GHC_VERSION%%/lib/xhtml-3000.0.2.1/Text/XHtml/Transitional
 @dirrm lib/ghc-%%GHC_VERSION%%/lib/xhtml-3000.0.2.1/Text/XHtml/Strict
 @dirrm lib/ghc-%%GHC_VERSION%%/lib/xhtml-3000.0.2.1/Text/XHtml/Frameset
@@ -1591,6 +1523,7 @@
 @dirrm lib/ghc-%%GHC_VERSION%%/hslibs-imports
 @exec mkdir -p %D/lib/ghc-%%GHC_VERSION%%/cabal
 @dirrm lib/ghc-%%GHC_VERSION%%/cabal
-@dirrm lib/ghc-%%GHC_VERSION%%
+@exec mkdir -p %D/share/doc/ghc-%%GHC_VERSION%%/cabal
 @unexec /bin/rm -f %D/lib/ghc-%%GHC_VERSION%%/package.conf || /usr/bin/true
 @unexec /bin/rm -f %D/lib/ghc-%%GHC_VERSION%%/package.conf.old || /usr/bin/true
+@dirrm lib/ghc-%%GHC_VERSION%%
--- patch-lang-ghc ends here ---

--- patch-devel-hs-haddock begins here ---
diff -uNr hs-haddock.orig/Makefile hs-haddock/Makefile
--- hs-haddock.orig/Makefile	2008-01-12 17:49:07.000000000 +0000
+++ hs-haddock/Makefile	2008-02-19 07:32:11.000000000 +0000
@@ -13,9 +13,28 @@
 MAINTAINER=	haskell@FreeBSD.org
 COMMENT=	A documentation tool for Haskell
 
+OPTIONS=	DOCS "Install HTML documentation" on \
+		DEVELOPER "Install development documentation" off
+
+.include <bsd.port.pre.mk>
+
+# Defining SLAVE:
+# This is only for the lang/ghc installation.
+# "SLAVE" turns lang/ghc and devel/hs-haddock in
+# two units functionally interdependent.
+.if !defined(SLAVE)
 BUILD_DEPENDS=	ghc:${PORTSDIR}/lang/ghc
 
-.if !defined(NOPORTDOCS)
+.if exists(${LOCALBASE}/lib/libreadline.so.5)
+LIB_DEPENDS+=	readline.5:${PORTSDIR}/devel/readline
+.endif
+
+.else
+WITHOUT_DOCS=
+WITHOUT_DEVELOPER=
+.endif
+
+.if !defined(WITHOUT_DOCS)
 BUILD_DEPENDS+=	${LOCALBASE}/share/sgml/docbook/dsssl/modular:${PORTSDIR}/textproc/dsssl-docbook-modular \
 		docbook<2:${PORTSDIR}/textproc/docbook \
 		${LOCALBASE}/share/sgml/iso8879:${PORTSDIR}/textproc/iso8879 \
@@ -30,36 +49,85 @@
 USE_GMAKE=	yes
 USE_AUTOTOOLS=	autoconf:261:env
 
-GHC_VERSION=	6.8.2
+GHC_VERSION=	 6.8.2
+HADDOCK_VERSION= ${PORTVERSION}
 
-PLIST_SUB+=	HADDOCK_VERSION=${PORTVERSION} GHC_VERSION=${GHC_VERSION}
-PORTDOCS=	*
+# Defining SLAVE:
+# ?= is for lang/ghc
+GHC_CMD?=   ${LOCALBASE}/bin/ghc
+CABAL_CMD?= ${LOCALBASE}/bin/runghc Setup.lhs
+
+PLIST_SUB+= HADDOCK_VERSION=${HADDOCK_VERSION} GHC_VERSION=${GHC_VERSION}
+
+DOCSDIR=    ${PREFIX}/share/doc/${DISTNAME}
+PORTDOCS=   *
+
+# Defining WITH_DEVELOPER:
+# This installs the hyperlinkable documentation
+# of the haddock libraries.
+.if !defined(WITHOUT_DEVELOPER)
+SUB_FILES+=	pkg-message.developer
+.endif
 
 post-patch:
 	@${REINPLACE_CMD} -e 's|/usr/local/share/sgml/catalog||' ${WRKSRC}/doc/configure.ac
 
 do-configure:
-	cd ${WRKSRC} && runhaskell Setup.lhs configure --ghc ${CONFIGURE_ARGS}
-.if !defined(NOPORTDOCS)
-	cd ${WRKSRC}/doc && ${AUTOCONF} && ./configure ${CONFIGURE_ARGS}
+	@(cd ${WRKSRC} && \
+	  ${CABAL_CMD} configure --ghc ${CONFIGURE_ARGS} \
+				 --with-compiler=${GHC_CMD})
+
+.if !defined(WITHOUT_DOCS)
+	@cd ${WRKSRC}/doc && ${AUTOCONF} && ./configure ${CONFIGURE_ARGS}
 .endif
 
 do-build:
-	cd ${WRKSRC} && runhaskell Setup.lhs build
+	@(cd ${WRKSRC} && ${CABAL_CMD} build)
 
 post-build:
-.if !defined(NOPORTDOCS)
+	@${STRIP_CMD} ${WRKSRC}/dist/build/haddock/haddock
+.if !defined(WITHOUT_DOCS)
 	@(cd ${WRKSRC}/doc && \
-	 ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} html)
+	  ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} html)
+.endif
+
+# Defining SLAVE:
+# This is only for the lang/ghc installation.
+# It's an in-place installation and last step
+# for the SLAVE option.
+# You can view the Makefile in lang/ghc.
+.if defined(SLAVE)
+	@(cd ${WRKSRC} && ${CABAL_CMD} install)
 .endif
 
 do-install:
-	cd ${WRKSRC} && runhaskell Setup.lhs install
+	@cd ${WRKSRC} && ${CABAL_CMD} install
 
 post-install:
-	@${STRIP_CMD} ${PREFIX}/bin/haddock
-.if !defined(NOPORTDOCS)
-	@(cd ${WRKSRC}/doc && ${CP} -R haddock ${PREFIX}/share/doc)
+.if !defined(WITHOUT_DOCS)
+	@${MKDIR} ${PREFIX}/share/doc/haddock-2.0.0.0/users_guide
+	@(cd ${WRKSRC}/doc/haddock && ${CP} -R * ${PREFIX}/share/doc/haddock-2.0.0.0/users_guide)
+.endif
+
+# Defining WITH_DEVELOPER:
+# The libraries documentation will be installed. It needs
+# to reconfigure to look for the haddock executable.
+# This process only updates the registered data.
+.if !defined(WITHOUT_DEVELOPER)
+	@(cd ${WRKSRC} && \
+	  ${CABAL_CMD} configure --ghc ${CONFIGURE_ARGS} --with-haddock=${PREFIX}/bin/haddock && \
+	  ${CABAL_CMD} haddock --executables && ${CABAL_CMD} register)
+
+	@${MKDIR} ${PREFIX}/share/doc/haddock-2.0.0.0/html
+	@(cd ${WRKSRC}/dist/doc/html/haddock && ${CP} -R * ${PREFIX}/share/doc/haddock-2.0.0.0/html)
+
+	@${ECHO_MSG}
+	@${CAT} ${PKGMESSAGE}
+	@${ECHO_MSG}
+
 .endif
+	 @cd ${WRKSRC} && \
+	  ${CABAL_CMD} register --gen-script && \
+	  ${INSTALL_SCRIPT} register.sh ${PREFIX}/lib/haddock-${HADDOCK_VERSION}/register.sh
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff -uNr hs-haddock.orig/files/pkg-message.developer.in hs-haddock/files/pkg-message.developer.in
--- hs-haddock.orig/files/pkg-message.developer.in	1970-01-01 00:00:00.000000000 +0000
+++ hs-haddock/files/pkg-message.developer.in	2008-02-19 09:03:46.000000000 +0000
@@ -0,0 +1,13 @@
+===================================================================
+
+  WARNING: if the lang/ghc port doesn't install the hyperlinkable
+  documentation for its libraries, then haddock can't know about
+  these. But also in this case haddock can't handle recursive
+  modules currently, so the lang/ghc port can't install the
+  hyperlinkable documentation of the HSghc libraries, and then
+  haddock can't know about these last.
+  In general haddock detects and reports as an error recursive
+  modules and emits chatting warnings listing all the identifiers
+  it couldn't resolve.
+
+===================================================================
diff -uNr hs-haddock.orig/pkg-descr hs-haddock/pkg-descr
--- hs-haddock.orig/pkg-descr	2002-05-21 18:46:56.000000000 +0000
+++ hs-haddock/pkg-descr	2008-02-18 13:56:21.000000000 +0000
@@ -1,6 +1,8 @@
 Haddock is a tool for automatically generating documentation from
 annotated Haskell source code. The documentation generated by Haddock
 is fully hyperlinked.
+Haddock can generate documentation in multiple formats; currently HTML
+is implemented, and there is partial support for generating DocBook.
 
 WWW:	http://www.haskell.org/haddock/
 
diff -uNr hs-haddock.orig/pkg-plist hs-haddock/pkg-plist
--- hs-haddock.orig/pkg-plist	2008-01-12 17:49:08.000000000 +0000
+++ hs-haddock/pkg-plist	2008-02-18 14:57:13.000000000 +0000
@@ -5,7 +5,7 @@
 lib/haddock-%%HADDOCK_VERSION%%/ghc-%%GHC_VERSION%%/Haddock/InterfaceFile.hi
 lib/haddock-%%HADDOCK_VERSION%%/ghc-%%GHC_VERSION%%/Haddock/Types.hi
 lib/haddock-%%HADDOCK_VERSION%%/ghc-%%GHC_VERSION%%/libHShaddock-%%HADDOCK_VERSION%%.a
-share/doc/haddock-%%HADDOCK_VERSION%%/LICENSE
+lib/haddock-%%HADDOCK_VERSION%%/register.sh
 share/haddock-%%HADDOCK_VERSION%%/html/haddock-DEBUG.css
 share/haddock-%%HADDOCK_VERSION%%/html/haddock-util.js
 share/haddock-%%HADDOCK_VERSION%%/html/haddock.css
@@ -16,8 +16,9 @@
 @dirrm lib/haddock-%%HADDOCK_VERSION%%/ghc-%%GHC_VERSION%%/Distribution
 @dirrm lib/haddock-%%HADDOCK_VERSION%%/ghc-%%GHC_VERSION%%
 @dirrm lib/haddock-%%HADDOCK_VERSION%%
-@dirrm share/doc/haddock-%%HADDOCK_VERSION%%
 @dirrm share/haddock-%%HADDOCK_VERSION%%/html
 @dirrm share/haddock-%%HADDOCK_VERSION%%
+@exec /bin/sh %D/lib/haddock-%%HADDOCK_VERSION%%/register.sh
 @exec rm -f %D/lib/ghc-%%GHC_VERSION%%/package.conf.old
+@unexec %D/bin/ghc-pkg unregister haddock
 @unexec rm -f %D/lib/ghc-%%GHC_VERSION%%/package.conf.old
--- patch-devel-hs-haddock ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802191536.m1JFaBS9096806>