I have been working on the library documentation, specificially debianizing
haddock 2.1.0, getting everything in the Debian repository to build with
haddock 2.1.0, and modifying the haskell CDBS script so it generates
correctly linked documentation and improved packaging, and so on.  I ended
up adding hlibrary.mk to haskell-devscripts, installed in
/usr/share/haskell-devscripts, in a separate binary package named
haskell-devscripts-cdbs.  Maybe it should go in its own source package, or
in cdbs.  I also added a postinst and postrm script for the -doc packages to
haskell-devscripts to get this all to go.  I've built about a hundred of the
haskell packages in sid successfully with only minor tweaks.  All the tweaks
to each package are in darcs repositories on src.seereason.com, mostly they
built without change.  The resulting packages are available in

 deb http://deb.seereason.com/ubuntu hardy-seereason main
 deb-src http://deb.seereason.com/ubuntu hardy-seereason main

Also, a sample of the linked documentation is visible in
http://test.seereason.com/usr/share/doc/ghc6-doc/libraries/index.html.  I
will update the lenny and sid versions shortly, and hopefully add amd64
builds as well.

I would love to see these changes make their way into Debian.

CHANGES TO THE ORIGINAL hlibrary.mk POSTED IN JANUARY:

1. Look at the control file, only pass the --enable-library-profiling
   if there is a -prof package there.  Some packages are not compatible
   with profiling, e.g. haskell-plugin and anything that uses it.

2. Use the cabal-debian program (if available) to generate the
   dev, prof, and doc package dependencies, they go into the
   appropriate substvar file as haskell:Depends.  The cabal-debian
   source lives in http://src.seereason.com/cabal-debian.

3. Add code to move any executables mentioned in the cabal file into their
   respective packages.

4. Add two symlinks to each documentation package: one so haddock
   can find the dependency documentation in
   /usr/share/doc/ghc6-doc/libraries/xxx during a package build,
   one in /usr/lib/haskell-packages/ghc6/share/doc/xxx because
   something breaks if its not there - trust me!

5. Call dh_haskell_prep when building the doc package so we get the postinst
   and postrm scripts which I added to haskell-devscripts.

6. Set DEB_COMPRESS_EXCLUDE=.haddock so the haddock interface file doesn't
   get compressed.

Changes to haskell-devscripts:

1. Add a postinst and postrm for the -doc package that calls
   /usr/lib/ghc6-doc/gen_contents_index.  These scripts are the same as the
   ones Ian is using in the bundled libraries.

2. Add code that creates the same link to /usr/share/doc/package/html
mentioned
   in (4) above, for packages that don't use cdbs.

Changes to ghc6:

1. Patch libraries/Makefile to not pass --hyperlink-source if
   haddock version is 2.1.0 or later

2. Make sure the directory that hscolour.css is being copied to exists

3. Pass -B `ghc --print-libdir` to haddock in gen_contents_index

I had to remove --hyperlink-source from the rules file of each bundled
library.
I patched missingh to change some syntax the new haddock doesn't like, etc,
etc.

Attachment: hlibrary.mk
Description: Binary data

--- ghc6/libraries/Makefile~	2008-05-27 00:05:47.000000000 +0000
+++ ghc6/libraries/Makefile	2008-05-31 14:50:20.000000000 +0000
@@ -294,9 +294,13 @@
 	sh gen_contents_index --inplace
 
 # Making hyperlinked source only works if we have hscolour
+# However, the flag is no longer accepted by haddock 2.1 and later.
 ifneq "$(HSCOLOUR)" ""
+HADDOCK21=$(shell haddock -V | grep '^Haddock version \\(2.[1-9]\\|[3-9].\\)')
+ifneq "$(HADDOCK21)" ""
 CABAL_HADDOCK_FLAGS=--hyperlink-source
 endif
+endif
 
 $(foreach SUBDIR,$(SUBDIRS),doc.library.$(SUBDIR)):\
 doc.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
@@ -310,7 +310,7 @@
 	                               $(CABAL_HADDOCK_FLAGS); \
 	fi
 ifneq "$(HSCOLOUR)" ""
-	if ifBuildable/ifBuildable $*; then cp hscolour.css $*/dist/doc/html/$*/src/; fi
+	if ifBuildable/ifBuildable $*; then install -D hscolour.css $*/dist/doc/html/$*/src/hscolour.css; fi
 endif
 
 .PHONY: distclean clean clean.library.%
--- ghc6/libraries/gen_contents_index~	2007-12-12 12:59:35.000000000 +0000
+++ ghc6/libraries/gen_contents_index	2008-06-03 17:05:30.000000000 +0000
@@ -22,7 +22,7 @@
 done
 
 # Now create the combined contents and index pages
-haddock --gen-index --gen-contents -o . \
+haddock -B `ghc --print-libdir` --gen-index --gen-contents -o . \
         -t "Haskell Hierarchical Libraries" \
         $HADDOCK_ARGS
 
--- ghc6/debian/control~	2008-06-02 17:42:55.000000000 +0000
+++ ghc6/debian/control	2008-06-03 17:07:24.000000000 +0000
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Ian Lynagh (wibble) <[EMAIL PROTECTED]>
 Standards-Version: 3.7.3
-Build-Depends: debhelper (>= 4), libgmp3-dev, xsltproc, libreadline5-dev | libreadline-dev, devscripts, haddock (>= 0.8-2), hscolour, ghc6, grep-dctrl, autotools-dev, docbook-xsl, docbook-xml, gcc (>= 4:4.2), procps
+Build-Depends: debhelper (>= 4), libgmp3-dev, xsltproc, libreadline5-dev | libreadline-dev, devscripts, haddock (>= 2.1.0), hscolour, ghc6, grep-dctrl, autotools-dev, docbook-xsl, docbook-xml, gcc (>= 4:4.2), procps
 
 Package: ghc6
 Architecture: any
@@ -45,7 +45,7 @@
 Architecture: all
 Suggests: haskell-doc
 Provides: ${provided-docs}
-Depends: haddock (>= 0.8-2), ${shlibs:Depends}, ${misc:Depends}
+Depends: haddock (>= 2.1.0), ${shlibs:Depends}, ${misc:Depends}
 Description: Documentation for the Glasgow Haskell Compilation system
  Version 6 of the Glorious Glasgow Haskell Compilation system (GHC).  GHC is
  a compiler for Haskell98.
diff -ruN haskell-devscripts-0.6.12.old/debian/haskell-devscripts.install haskell-devscripts-0.6.12/debian/haskell-devscripts.install
--- haskell-devscripts-0.6.12.old/debian/haskell-devscripts.install	2008-03-22 20:28:43.000000000 +0000
+++ haskell-devscripts-0.6.12/debian/haskell-devscripts.install	2008-06-04 17:44:49.000000000 +0000
@@ -7,4 +7,6 @@
 dh_haskell_prep 	usr/bin/
 prerm-ghc		usr/share/debhelper/autoscripts/
 postinst-ghc		usr/share/debhelper/autoscripts/
+postrm-ghc-doc		usr/share/debhelper/autoscripts/
+postinst-ghc-doc	usr/share/debhelper/autoscripts/
 Dh_Haskell.pm		usr/share/haskell-devscripts/
diff -ruN haskell-devscripts-0.6.12.old/dh_haskell_install haskell-devscripts-0.6.12/dh_haskell_install
--- haskell-devscripts-0.6.12.old/dh_haskell_install	2008-03-25 22:22:56.000000000 +0000
+++ haskell-devscripts-0.6.12/dh_haskell_install	2008-06-04 17:01:42.000000000 +0000
@@ -197,6 +197,9 @@
 	} elsif ($pkgtype eq "haddock" ) {
 	    doit("install", "-d", "$tmp" . "/usr/share/doc/$package");
 	    doit("cp", "-ar", "dist/doc/html", "$tmp/usr/share/doc/$package");
+	    doit("mkdir", "-p", "$tmp/usr/share/doc/ghc6-doc/libraries");
+	    doit("rm", "-f", "$tmp/usr/share/doc/ghc6-doc/libraries/$cabalname");
+	    doit("ln", "-s", "../../$package/html/$cabalname", "$tmp/usr/share/doc/ghc6-doc/libraries/$cabalname");
 	}
 	chdir($cwd);
     }
diff -ruN haskell-devscripts-0.6.12.old/dh_haskell_prep haskell-devscripts-0.6.12/dh_haskell_prep
--- haskell-devscripts-0.6.12.old/dh_haskell_prep	2008-03-22 20:28:43.000000000 +0000
+++ haskell-devscripts-0.6.12/dh_haskell_prep	2008-06-04 16:44:03.000000000 +0000
@@ -55,9 +55,23 @@
 
 		print "$ghcver $pkglibdir $cabalname $cabalversion\n";
 		autoscript($package,"postinst","postinst-ghc",
-			   "s%#GHCVER#%$ghcver%;s%#PKGLIBDIR#%$pkglibdir%;s%#CABALNAME#%$cabalname%;s%#CABALVERSION#%$cabalversion%");
+			   "s%#GHCVER#%$ghcver%;s%#PKGLIBDIR#%$pkglibdir%;s%#CABALNAME#%$cabalname%;s%#CABALVERSION#%$cabalversion%;s%#PACKAGE#%$package%");
 		autoscript($package,"prerm","prerm-ghc",
-			   "s%#GHCVER#%$ghcver%;s%#PKGLIBDIR#%$pkglibdir%;s%#CABALNAME#%$cabalname%;s%#CABALVERSION#%$cabalversion%");
+			   "s%#GHCVER#%$ghcver%;s%#PKGLIBDIR#%$pkglibdir%;s%#CABALNAME#%$cabalname%;s%#CABALVERSION#%$cabalversion%;s%#PACKAGE#%$package%");
+	    }
+	    elsif ($pkgtype eq "haddock") {
+		my $haddockver = "haddock-" . upstream_version(version_of_type($pkgtype));
+		my $pkglibdir = getcabalpkglibpath($pkgtype);
+		my $cabalname = getcabalname();
+		my $cabalversion = getcabalversion();
+
+		print "$haddockver $pkglibdir $cabalname $cabalversion\n";
+		autoscript($package,"postrm","postrm-ghc-doc",
+			   "s%#HADDOCKVER#%$haddockver%;s%#PKGLIBDIR#%$pkglibdir%;s%#CABALNAME#%$cabalname%;s%#CABALVERSION#%$cabalversion%;s%#PACKAGE#%$package%");
+		autoscript($package,"postinst","postinst-ghc-doc",
+			   "s%#HADDOCKVER#%$haddockver%;s%#PKGLIBDIR#%$pkglibdir%;s%#CABALNAME#%$cabalname%;s%#CABALVERSION#%$cabalversion%;s%#PACKAGE#%$package%");
+		addsubstvar($package, "haskell:Depends",
+			    "ghc6-doc", "")
 	    }
 	}
 
diff -ruN haskell-devscripts-0.6.12.old/postinst-ghc-doc haskell-devscripts-0.6.12/postinst-ghc-doc
--- haskell-devscripts-0.6.12.old/postinst-ghc-doc	1970-01-01 00:00:00.000000000 +0000
+++ haskell-devscripts-0.6.12/postinst-ghc-doc	2008-06-04 17:02:44.000000000 +0000
@@ -0,0 +1,27 @@
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see /usr/doc/packaging-manual/
+#
+# quoting from the policy:
+#     Any necessary prompting should almost always be confined to the
+#     post-installation script, and should be protected with a conditional
+#     so that unnecessary prompting doesn't happen if a package's
+#     installation fails and the `postinst' is called with `abort-upgrade',
+#     `abort-remove' or `abort-deconfigure'.
+
+case "$1" in
+    configure|abort-upgrade|abort-remove|abort-deconfigure)
+        cd /usr/share/doc/ghc6-doc/libraries
+        /usr/lib/ghc6-doc/gen_contents_index
+    ;;
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 0
+    ;;
+esac
diff -ruN haskell-devscripts-0.6.12.old/postrm-ghc-doc haskell-devscripts-0.6.12/postrm-ghc-doc
--- haskell-devscripts-0.6.12.old/postrm-ghc-doc	1970-01-01 00:00:00.000000000 +0000
+++ haskell-devscripts-0.6.12/postrm-ghc-doc	2008-06-04 17:22:26.000000000 +0000
@@ -0,0 +1,15 @@
+# Generic doc postrm script for Haskell cabal libraries v9 by Ian Lynagh.
+
+set -e
+
+DIR=/usr/share/doc/ghc6-doc/libraries
+GEN=/usr/lib/ghc6-doc/gen_contents_index
+
+case "$1" in
+    *)
+        [ -d $DIR ] && [ -e $GEN ] && cd $DIR && $GEN
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
_______________________________________________
debian-haskell mailing list
[email protected]
http://urchin.earth.li/mailman/listinfo/debian-haskell

Reply via email to