[DHG_packages] 01/01: ghc: make ghc cross-buildable, with patch from John Paul Adrian Glaubitz.

Gianfranco Costamagna locutusofborg at moszumanska.debian.org
Tue Aug 29 21:10:13 UTC 2017


This is an automated email from the git hooks/post-receive script.

locutusofborg pushed a commit to branch master
in repository DHG_packages.

commit e571d399b5e1995f60225647e93ad2b7381aa02d
Author: Gianfranco Costamagna <costamagnagianfranco at yahoo.it>
Date:   Tue Aug 29 23:09:49 2017 +0200

    ghc: make ghc cross-buildable, with patch from John Paul Adrian Glaubitz.
---
 p/ghc/debian/control        |  6 +++---
 p/ghc/debian/patches/series |  3 +++
 p/ghc/debian/rules          | 44 +++++++++++++++++++++++++++-----------------
 3 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/p/ghc/debian/control b/p/ghc/debian/control
index dae2947..17d46e8 100644
--- a/p/ghc/debian/control
+++ b/p/ghc/debian/control
@@ -6,17 +6,17 @@ Uploaders: Joachim Breitner <nomeata at debian.org>, Clint Adams <clint at debian.org>
 Standards-Version: 3.9.8
 Build-Depends:
   debhelper (>= 10),
-  haskell-devscripts-minimal,
+  haskell-devscripts-minimal <!cross>,
   devscripts,
   grep-dctrl,
   pkg-config,
-  ghc (>= 7.8),
+  ghc:native (>= 7.8),
   libgmp-dev,
   llvm-3.7 [arm64 armel armhf],
   libffi-dev,
   binutils [arm64 armel armhf],
   libncurses5-dev,
-  python-sphinx,
+  python-sphinx <!cross>,
   dpkg-dev (>= 1.16.1.1)
 Build-Depends-Indep:
   hscolour,
diff --git a/p/ghc/debian/patches/series b/p/ghc/debian/patches/series
index 869c987..a3563ea 100644
--- a/p/ghc/debian/patches/series
+++ b/p/ghc/debian/patches/series
@@ -8,3 +8,6 @@ do-not-use-SHELL
 compiler-cmm-PprC-sparc-alignment.patch
 x32-use-native-x86_64-insn.patch
 osdecommitmemory-compat.patch
+use-stage1-binaries-for-install.patch
+build-unlit-and-hp2ps-twice.patch
+avoid-CrossCompilerPrefix-stage2.patch
diff --git a/p/ghc/debian/rules b/p/ghc/debian/rules
index f8d30d6..b0a7dc0 100755
--- a/p/ghc/debian/rules
+++ b/p/ghc/debian/rules
@@ -22,20 +22,20 @@ export HOME = /homedoesnotexistatbuildtime
 export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 export DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
-# Commented out for now.  The build scripts don't recognise i486 as an
-# architecture and cross compiling isn't supported anyway.
-#ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
-#  confflags += --build $(DEB_HOST_GNU_TYPE)
-#else
-#  confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
-#endif
+
+# We're cross-building if DEB_BUILD_GNU_TYPE != DEB_HOST_GNU_TYPE
+ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+  confflags += --target $(DEB_HOST_GNU_TYPE) --enable-unregisterised
+  BUILD_CROSS=YES
+else
+  BUILD_CROSS=NO
+endif
 
 ProjectVersion=$(shell cat VERSION)
 
 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/
 
 ifneq (,$(filter powerpcspe x32, $(DEB_HOST_ARCH)))
@@ -53,9 +53,20 @@ endif
 
 override_dh_auto_configure:
 	echo "SRC_HC_OPTS += -lffi -optl-pthread" >> mk/build.mk
+ifeq (NO,$(BUILD_CROSS))
 	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 "SRC_HC_OPTS += -O0 -H64m" >> mk/build.mk
+	echo "GhcStage1HcOpts = -O" >> mk/build.mk
+	echo "GhcStage2HcOpts = -O0" >> mk/build.mk
+	echo "GhcLibHcOpts = -O" >> mk/build.mk
+	echo "SplitObjs = NO" >> mk/build.mk
+	echo "HADDOCK_DOCS := NO" >> mk/build.mk
+	echo "BUILD_SPHINX_HTML := NO" >> mk/build.mk
+	echo "BUILD_SPHINX_PDF := NO" >> mk/build.mk
+endif
 ifneq (,$(filter armel armhf, $(DEB_HOST_ARCH)))
 	echo "SRC_HC_OPTS     += -optl-B/usr/bin/ld.gold" >> mk/build.mk
 endif
@@ -103,6 +114,8 @@ endif
 	echo 'dvidir  := $$(docdir)'                   >> mk/build.mk
 	echo 'pdfdir  := $$(docdir)'                   >> mk/build.mk
 	echo 'psdir   := $$(docdir)'                   >> mk/build.mk
+	echo 'STRIP_CMD = $(DEB_HOST_GNU_TYPE)-strip'  >> mk/build.mk
+	echo 'RANLIB_CMD = $(DEB_HOST_GNU_TYPE)-ranlib'>> mk/build.mk
 	# We want verbose builds
 	echo 'V=1'                                     >> mk/build.mk
 	./configure $(confflags) --prefix=/usr \
@@ -169,12 +182,11 @@ override_dh_auto_install:
 	# Check if we have a ghci binary
 	if test -e debian/tmp/usr/bin/ghci-$(ProjectVersion); then \
 	    echo 'ghci=ghc-ghci' >> debian/ghc.substvars ; fi
-
+ifeq (NO,$(BUILD_CROSS))
 	# 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))
+	find debian/tmp/usr/share/man $(FILES)           >> debian/ghc.install
 	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
@@ -184,9 +196,8 @@ ifeq (YES,$(BUILD_HADDOCK_DOCS))
 	    mkdir debian/tmp/usr/lib/ghc-doc/haddock/ghc/`basename $$f` ; \
 	    mv $$f/*.haddock debian/tmp/usr/lib/ghc-doc/haddock/ghc/`basename $$f` ; done
 	cd debian/tmp/usr/share/doc/ghc-doc/html/libraries/; ln -s ghc-$(ProjectVersion) ghc
-	install -Dm 644 debian/index.html debian/tmp/usr/share/doc/ghc-doc/index.html
-endif
 
+	install -Dm 644 debian/index.html debian/tmp/usr/share/doc/ghc-doc/index.html
 	# manpages
 	rm -f debian/*.1
 	echo ".so man1/ghc.1" > debian/ghc-$(ProjectVersion).1
@@ -202,14 +213,13 @@ endif
 	echo debian/*.1 > debian/ghc.manpages
 	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
 
 	# ghc
 	find debian/tmp/usr/bin $(FILES)                  > debian/ghc.install
 #	find debian/tmp/usr/share/ghc* $(FILES)          >> debian/ghc.install
-	find debian/tmp/usr/share/man $(FILES)           >> debian/ghc.install
 	find debian/tmp/usr/lib/ghc $(FILES) ! $(PROF_FILE) >> debian/ghc.install
 	find debian/tmp/var				 >> debian/ghc.install
 	echo debian/tmp/usr/share/lintian/overrides/ghc >> debian/ghc.install
@@ -217,14 +227,14 @@ endif
 	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
 	# ghc-doc
-ifeq (YES,$(BUILD_HADDOCK_DOCS))
+ifeq (NO,$(BUILD_CROSS))
 	mkdir -p debian/tmp/$(DEB_HOOGLE_TXT_DIR)
 	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
-endif
 	sed -i s,^debian/tmp,, debian/*.install debian/*.links
+endif
 	rm -f debian/ghc.links
 	echo "/var/lib/ghc/package.conf.d /usr/lib/ghc/package.conf.d" >> debian/ghc.links
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/DHG_packages.git



More information about the Pkg-haskell-commits mailing list