Bug#853285: ghc: Patch to add support for cross-compilation of GHC

Helmut Grohne helmut at subdivi.de
Tue Jan 31 19:17:32 UTC 2017


Control: clone -1 -2
Control: retitle -2 support building ghc without building haddock
Control: block -1 by -2

On Tue, Jan 31, 2017 at 09:20:46AM +0100, John Paul Adrian Glaubitz wrote:
>   Setting "--target" allows enabling cross-compiling, adding
>   --enable-unregisterised is important for architectures not
>   having native code generation support. Disabling the documentation
>   is required by GHC itself. Trying to build the documentation
>   when cross-compiling causes an error message.

I'm not entirely sold on the idea that we cannot cross build haddock.
What about using the haddock from the ghc:native package to build the
documentation? But then maybe I understand too little of the
requirements here.

In any case, disabling haddock should not be a thing that just happens
for cross compilation. We want cross builds to be reproducible (when
compared against native builds). So disabling haddock should be a
concious choice (even if cross building without disabling haddock
doesn't work). Also building ghc without haddock should produce a
package that doesn't list haddock under Provides. This calls for a build
profile. So I went ahead and split out this part of your patch into a
patch that adds a pkg.ghc.nohaddock build profile.

It's not clear to me whether some Build-Depends should become droppable
under the profile.

I hope that this makes sense and that the resulting profile is useful
for cross compiling ghc. Do you agree?

Helmut
-------------- next part --------------
diff --minimal -Nru ghc-8.0.1/debian/changelog ghc-8.0.1/debian/changelog
--- ghc-8.0.1/debian/changelog	2016-12-17 03:44:45.000000000 +0100
+++ ghc-8.0.1/debian/changelog	2017-01-31 15:39:43.000000000 +0100
@@ -1,3 +1,10 @@
+ghc (8.0.1-17.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Add pkg.ghc.nohaddock build profile for disabling haddock (Closes: #-1).
+
+ -- Helmut Grohne <helmut at subdivi.de>  Tue, 31 Jan 2017 15:39:43 +0100
+
 ghc (8.0.1-17) unstable; urgency=medium
 
   * Add upstream patch "Add relocation type R_X86_64_REX_GOTPCRELX".
diff --minimal -Nru ghc-8.0.1/debian/control ghc-8.0.1/debian/control
--- ghc-8.0.1/debian/control	2016-10-28 07:42:05.000000000 +0200
+++ ghc-8.0.1/debian/control	2017-01-31 15:39:43.000000000 +0100
@@ -49,8 +49,8 @@
   ${ghci},
   ${provided-devs},
   ${haskell:Provides},
-  haddock,
-  ghc-haddock,
+  haddock <!pkg.ghc.nohaddock>,
+  ghc-haddock <!pkg.ghc.nohaddock>,
   ${haddock:Provides}
 Replaces: ghc6 (<< 7), ghc-dynamic (<< 7.8), ghc-haddock (<< 7.10)
 Conflicts: ghc6 (<< 7), ghc-dynamic (<< 7.8), ${conflicting-devs}
@@ -94,6 +94,7 @@
 Breaks: libghc-terminfo-doc (<< 0.3.2.5-4), libghc-transformers-doc (<< 0.3.0.0-6), libghc-xhtml-doc (<< 3000.2.1-5)
 Depends: ${haddock:Depends}, ${misc:Depends}, perl, libjs-mathjax
 Pre-Depends: dpkg (>= 1.16.1)
+Build-Profiles: <!pkg.ghc.nohaddoc>
 Description: Documentation for the Glasgow Haskell Compilation system
  The Glorious Glasgow Haskell Compilation system (GHC) is a compiler for
  Haskell.
diff --minimal -Nru ghc-8.0.1/debian/rules ghc-8.0.1/debian/rules
--- ghc-8.0.1/debian/rules	2016-11-14 17:07:27.000000000 +0100
+++ ghc-8.0.1/debian/rules	2017-01-31 15:39:43.000000000 +0100
@@ -35,7 +35,6 @@
 GHC=$(firstword $(shell bash -c "type -p ghc"))
 EXTRA_CONFIGURE_FLAGS=--with-ghc="$(GHC)"
 
-BUILD_HADDOCK_DOCS=YES
 DEB_HOOGLE_TXT_DIR = /usr/lib/ghc-doc/hoogle/
 
 ifeq (x32,$(DEB_HOST_ARCH))
@@ -48,9 +47,13 @@
 override_dh_auto_configure:
 	dh_autoreconf perl -- boot
 	echo "SRC_HC_OPTS += -lffi -optl-pthread" >> mk/build.mk
+ifeq ($(filter pkg.ghc.nohaddock,$(DEB_BUILD_PROFILES)),)
 	echo "HADDOCK_DOCS := YES" >> mk/build.mk
 	echo "EXTRA_HADDOCK_OPTS += --mathjax=file:///usr/share/javascript/mathjax/MathJax.js" >> mk/build.mk
 	echo "XSLTPROC_OPTS += --nonet" >> mk/build.mk
+else
+	echo "HADDOCK_DOCS := NO" >> mk/build.mk
+endif
 ifneq (,$(findstring $(DEB_HOST_ARCH), arm64 armel armhf))
 	echo "SRC_HC_OPTS     += -optl-B/usr/bin/ld.gold" >> mk/build.mk
 endif
@@ -161,11 +164,11 @@
 	if test -e debian/tmp/usr/bin/ghci-$(ProjectVersion); then \
 	    echo 'ghci=ghc-ghci' >> debian/ghc.substvars ; fi
 
+ifeq ($(filter pkg.ghc.nohaddock,$(DEB_BUILD_PROFILES)),)
 	# Add haddock substvars
 	echo "haddock:Depends=haddock-interface-$$(debian/tmp/usr/lib/ghc/bin/haddock --interface-version)" >> debian/ghc-doc.substvars
 	echo "haddock:Provides=haddock-interface-$$(debian/tmp/usr/lib/ghc/bin/haddock --interface-version)" >> debian/ghc.substvars
 
-ifeq (YES,$(BUILD_HADDOCK_DOCS))
 	mkdir -p debian/tmp/usr/lib/ghc-doc
 	cp debian/gen_contents_index debian/tmp/usr/lib/ghc-doc/
 	chmod +x debian/tmp/usr/lib/ghc-doc/gen_contents_index
@@ -191,8 +194,10 @@
 	echo ".so man1/ghc-pkg.1" > debian/ghc-pkg-$(ProjectVersion).1
 
 	echo debian/*.1 > debian/ghc.manpages
+ifeq ($(filter pkg.ghc.nohaddock,$(DEB_BUILD_PROFILES)),)
 	cp debian/haddock.man debian/haddock.1
 	echo debian/haddock.1 >> debian/ghc.manpages
+endif
 
 	# ####################
 	# Now all the files are sorted, create the package filelists
@@ -207,16 +212,17 @@
 	# ghc-prof
 	find debian/tmp/usr/lib $(FILES) $(PROF_FILE) > debian/ghc-prof.install
 	echo debian/tmp/usr/share/lintian/overrides/ghc-prof >> debian/ghc-prof.install
+ifeq ($(filter pkg.ghc.nohaddock,$(DEB_BUILD_PROFILES)),)
 	# ghc-doc
-ifeq (YES,$(BUILD_HADDOCK_DOCS))
 	mkdir -p debian/tmp/$(DEB_HOOGLE_TXT_DIR)
 	cat debian/ghc-doc.links.in                     > debian/ghc-doc.links
 	find debian/tmp/usr/share/doc/ghc-doc/html/libraries/*/ -name "*.txt" \
 		-printf "%p $(DEB_HOOGLE_TXT_DIR)/%f\n" >> debian/ghc-doc.links
 	find debian/tmp/usr/share/doc/ghc-doc $(FILES) > debian/ghc-doc.install
 	find debian/tmp/usr/lib/ghc-doc $(FILES)      >> debian/ghc-doc.install
+	sed -i s,^debian/tmp,, debian/*.links
 endif
-	sed -i s,^debian/tmp,, debian/*.install debian/*.links
+	sed -i s,^debian/tmp,, debian/*.install
 	rm -f debian/ghc.links
 	echo "/var/lib/ghc/package.conf.d /usr/lib/ghc/package.conf.d" >> debian/ghc.links
 


More information about the Pkg-haskell-maintainers mailing list