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

Helmut Grohne helmut at subdivi.de
Tue Jan 31 14:25:36 UTC 2017


Control: clone -1 -2
Control: retitle -2 ghc: honour DEB_BUILD_OPTIONS=nocheck
Control: block -1 by -2

On Tue, Jan 31, 2017 at 09:20:46AM +0100, John Paul Adrian Glaubitz wrote:
> Since building GHC natively on slower machines like m68k or sh4 can be quite
> painful, I have started working on making the GHC package cross-buildable.

Thank you. I was always reluctant to try it due to the size of the task,
but having your proof of concept shows that it really is feasible.

I think splitting the discussion into a few smaller subtopics could make
the whole thing easier. Thus I'll reply to various aspects in multiple
replies. This one will only cover running tests.

>   Additionally, I'm also guarding out the section which tries
>   to run the compiler for cross-builds, e.g. ("# Do some very
>   simple tests that the compiler actually works"). But Helmut
>   Grohne already pointed out that the proper way would be to
>   guard this by checking for "nocheck" in DEB_BUILD_OPTIONS
>   as both sbuild and pbuilder set "nocheck" by default when
>   cross-compiling. However, in some cases, like cross-compiling
>   from amd64 to i386, running the tests is still desired.

I refactored this part of the patch into checking DEB_BUILD_OPTIONS for
the presence of nocheck. I think that this is a direct improvement to
the ghc package and tested it with two native amd64 builds (one with
tests and the other without, unfortunately ghc isn't reproducible). I
can commit it to the experimental branch of DHG_packages if some other
DHG member agrees.

Let me also observe two things I found weird:
 * ghc does have a test suite, but the Debian package doesn't run it.
 * debian/rules uses findstring a lot where it should be using filter.

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 13:33:36.000000000 +0100
@@ -1,3 +1,10 @@
+ghc (8.0.1-17.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Do not run tests under DEB_BUILD_OPTIONS=nocheck (Closes: #-1).
+
+ -- Helmut Grohne <helmut at subdivi.de>  Tue, 31 Jan 2017 13:33:36 +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/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 13:32:58.000000000 +0100
@@ -108,6 +108,9 @@
 
 override_dh_auto_build:
 	dh_auto_build
+
+override_dh_auto_test:
+ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
 	# Do some very simple tests that the compiler actually works
 	rm -rf debian/testghc
 	mkdir debian/testghc
@@ -122,6 +125,7 @@
 	@printf "====BEGIN GHC INFO OUTPUT====\n"
 	@inplace/bin/ghc-stage2 --info
 	@printf "====END GHC INFO OUTPUT====\n"
+endif
 
 FILES = \( -type f -o -type l \)
 PROF_FILE = \( -name "*.p_*" -o -name "lib*_p.a" \)


More information about the Pkg-haskell-maintainers mailing list