[DHG_packages] 02/02: ghc: Support building ghc without building haddock, for cross-compilation. closes: #853285, #853773.
Clint Adams
clint at moszumanska.debian.org
Sun Jun 25 14:46:07 UTC 2017
This is an automated email from the git hooks/post-receive script.
clint pushed a commit to branch master
in repository DHG_packages.
commit 2f25c98a0c9678352ec2252551d8d9ceed46b070
Author: Clint Adams <clint at debian.org>
Date: Sun Jun 25 10:43:05 2017 -0400
ghc: Support building ghc without building haddock, for cross-compilation. closes: #853285, #853773.
---
p/ghc/debian/changelog | 4 +-
p/ghc/debian/control | 8 +--
.../patches/build-unlit-and-hp2ps-twice.patch | 80 ++++++++++++++++++++++
p/ghc/debian/patches/series | 2 +
.../patches/use-stage1-binaries-for-install.patch | 26 +++++++
p/ghc/debian/rules | 31 +++++----
6 files changed, 133 insertions(+), 18 deletions(-)
diff --git a/p/ghc/debian/changelog b/p/ghc/debian/changelog
index bfb6988..8bdb832 100644
--- a/p/ghc/debian/changelog
+++ b/p/ghc/debian/changelog
@@ -1,7 +1,9 @@
-ghc (8.0.2-3) UNRELEASED; urgency=medium
+ghc (8.0.2-3) unstable; urgency=medium
[ John Paul Adrian Glaubitz ]
* Build with --enable-unregisterised on powerpcspe. closes: #861806.
+ * Support building ghc without building haddock, for cross-compilation.
+ closes: #853285, #853773.
[ Helmut Grohne ]
* Do not run tests under DEB_BUILD_OPTIONS=nocheck (Closes: #853743).
diff --git a/p/ghc/debian/control b/p/ghc/debian/control
index dae2947..5ff6603 100644
--- a/p/ghc/debian/control
+++ b/p/ghc/debian/control
@@ -6,21 +6,21 @@ 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,
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,
dpkg-dev (>= 1.16.1.1)
Build-Depends-Indep:
hscolour,
- fop
+ fop,
+ python-sphinx,
+ haskell-devscripts-minimal,
Build-Conflicts:
ccache,
ghc (= 8.0.0.20160111-3),
diff --git a/p/ghc/debian/patches/build-unlit-and-hp2ps-twice.patch b/p/ghc/debian/patches/build-unlit-and-hp2ps-twice.patch
new file mode 100644
index 0000000..53d6ba1
--- /dev/null
+++ b/p/ghc/debian/patches/build-unlit-and-hp2ps-twice.patch
@@ -0,0 +1,80 @@
+Description: Build unlit and hp2ps twice
+Author: Thomas Miedema <thomasmiedema at gmail.com>
+ John Paul Adrian Glaubitz <glaubitz at physik.fu-berlin.de>
+
+Index: ghc-8.0.1/utils/ghc-pkg/ghc.mk
+===================================================================
+--- ghc-8.0.1.orig/utils/ghc-pkg/ghc.mk
++++ ghc-8.0.1/utils/ghc-pkg/ghc.mk
+@@ -27,7 +27,7 @@ utils/ghc-pkg_PACKAGE = ghc-pkg
+ # Note [Why build certain utils twice?]
+ #
+ # We build certain utils twice: once with stage0, and once with stage1.
+-# Examples are ghc-pkg and hsc2hs.
++# Examples are ghc-pkg, hsc2hs, hp2ps and unlit.
+ #
+ # These tools are needed during the bootstrapping process, so we have to use
+ # stage0 to build them at first (stage1 doesn't exist yet). (side note: they're
+@@ -38,6 +38,11 @@ utils/ghc-pkg_PACKAGE = ghc-pkg
+ # dynamically linked. But the stage0 copies are either statically linked, or
+ # linked against libraries on the build machine.
+ #
++# Another reason why we can't install the stage0 copies is that they are
++# built to run on the build(=host) platform, but when installing a
++# "cross-compiled stage2 compiler" we need copies that run on the target
++# platform.
++#
+ # Therefore we build fresh copies, using the stage1 compiler, and install them
+ # when you run 'make install'. They are not used for any other purpose.
+
+Index: ghc-8.0.1/utils/hp2ps/ghc.mk
+===================================================================
+--- ghc-8.0.1.orig/utils/hp2ps/ghc.mk
++++ ghc-8.0.1/utils/hp2ps/ghc.mk
+@@ -17,10 +17,23 @@ utils/hp2ps_dist_C_SRCS = AreaB
+ Utilities.c
+ utils/hp2ps_dist_EXTRA_LIBRARIES = m
+ utils/hp2ps_dist_PROGNAME = $(CrossCompilePrefix)hp2ps
+-utils/hp2ps_dist_INSTALL = YES
++utils/hp2ps_dist_INSTALL = NO
+ utils/hp2ps_dist_INSTALL_INPLACE = YES
+
+ utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
+
+ $(eval $(call build-prog,utils/hp2ps,dist,0))
+
++utils/hp2ps_dist-install_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \
++ Reorder.c TopTwenty.c AuxFile.c Deviation.c \
++ HpFile.c Marks.c Scale.c TraceElement.c \
++ Axes.c Dimensions.c Key.c PsFile.c Shade.c \
++ Utilities.c
++utils/hp2ps_dist-install_EXTRA_LIBRARIES = m
++utils/hp2ps_dist-install_PROGNAME = hp2ps
++utils/hp2ps_dist-install_TOPDIR = YES
++utils/hp2ps_dist-install_INSTALL = YES
++utils/hp2ps_dist-install_INSTALL_INPLACE = NO
++
++# See Note [Why build certain utils twice?].
++$(eval $(call build-prog,utils/hp2ps,dist-install,1))
+Index: ghc-8.0.1/utils/unlit/ghc.mk
+===================================================================
+--- ghc-8.0.1.orig/utils/unlit/ghc.mk
++++ ghc-8.0.1/utils/unlit/ghc.mk
+@@ -13,8 +13,16 @@
+ utils/unlit_dist_C_SRCS = unlit.c
+ utils/unlit_dist_PROGNAME = unlit
+ utils/unlit_dist_TOPDIR = YES
+-utils/unlit_dist_INSTALL = YES
++utils/unlit_dist_INSTALL = NO
+ utils/unlit_dist_INSTALL_INPLACE = YES
+
+ $(eval $(call build-prog,utils/unlit,dist,0))
+
++utils/unlit_dist-install_C_SRCS = unlit.c
++utils/unlit_dist-install_PROGNAME = unlit
++utils/unlit_dist-install_TOPDIR = YES
++utils/unlit_dist-install_INSTALL = YES
++utils/unlit_dist-install_INSTALL_INPLACE = NO
++
++# See Note [Why build certain utils twice?].
++$(eval $(call build-prog,utils/unlit,dist-install,1))
diff --git a/p/ghc/debian/patches/series b/p/ghc/debian/patches/series
index 869c987..8725959 100644
--- a/p/ghc/debian/patches/series
+++ b/p/ghc/debian/patches/series
@@ -8,3 +8,5 @@ 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
diff --git a/p/ghc/debian/patches/use-stage1-binaries-for-install.patch b/p/ghc/debian/patches/use-stage1-binaries-for-install.patch
new file mode 100644
index 0000000..897b0ef
--- /dev/null
+++ b/p/ghc/debian/patches/use-stage1-binaries-for-install.patch
@@ -0,0 +1,26 @@
+Description: Use the stage1 binaries for install
+ In order to be able to perform a cross-build, we need to use
+ the stage1 binaries during installation. Both ghc and ghc-pkg
+ are run during the install target and therefore must be able
+ to run on the build machine.
+ .
+Author: John Paul Adrian Glaubitz <glaubitz at physik.fu-berlin.de>
+Last-Update: 2017-01-29
+
+--- ghc-8.0.1.orig/ghc.mk
++++ ghc-8.0.1/ghc.mk
+@@ -958,8 +958,12 @@ INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdi
+ # Install packages in the right order, so that ghc-pkg doesn't complain.
+ # Also, install ghc-pkg first.
+ ifeq "$(Windows_Host)" "NO"
+-INSTALLED_GHC_REAL=$(DESTDIR)$(ghclibexecdir)/bin/ghc
+-INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(ghclibexecdir)/bin/ghc-pkg
++# Use the inplace/stage1 versions for installation,
++# since the installed versions are built for the target
++#INSTALLED_GHC_REAL=$(DESTDIR)$(ghclibexecdir)/bin/ghc
++#INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(ghclibexecdir)/bin/ghc-pkg
++INSTALLED_GHC_REAL=$(CURDIR)/inplace/bin/ghc-stage1
++INSTALLED_GHC_PKG_REAL=$(CURDIR)/utils/ghc-pkg/dist/build/tmp/ghc-pkg
+ else
+ INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe
+ INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
diff --git a/p/ghc/debian/rules b/p/ghc/debian/rules
index 901b8af..3a0e2c7 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_HADDOCK_DOCS=NO
+else
+ BUILD_HADDOCK_DOCS=YES
+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 (,$(findstring $(DEB_HOST_ARCH), powerpcspe x32))
@@ -50,9 +50,13 @@ override_dh_autoreconf:
override_dh_auto_configure:
echo "SRC_HC_OPTS += -lffi -optl-pthread" >> mk/build.mk
+ifeq (YES,$(BUILD_HADDOCK_DOCS))
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
@@ -100,6 +104,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 \
@@ -181,9 +187,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
@@ -199,14 +204,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
@@ -215,13 +219,14 @@ endif
echo debian/tmp/usr/share/lintian/overrides/ghc-prof >> debian/ghc-prof.install
# ghc-doc
ifeq (YES,$(BUILD_HADDOCK_DOCS))
+ find debian/tmp/usr/share/man $(FILES) >> debian/ghc.install
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