[Git][haskell-team/DHG_packages][hadrian] ghc: Disable cross-compilation

Ilias Tsitsimpis (@iliastsi) gitlab at salsa.debian.org
Wed Sep 20 09:22:16 BST 2023



Ilias Tsitsimpis pushed to branch hadrian at Debian Haskell Group / DHG_packages


Commits:
a10b258a by Ilias Tsitsimpis at 2023-09-20T11:21:23+03:00
ghc: Disable cross-compilation

Unfortunately, cross compilation seems to be impossible with newer
versions of GHC. For more information, see
https://gitlab.haskell.org/ghc/ghc/-/issues/23975.

- - - - -


4 changed files:

- p/ghc/debian/control
- + p/ghc/debian/patches/hadrian-no-pkg-recache
- p/ghc/debian/patches/series
- p/ghc/debian/rules


Changes:

=====================================
p/ghc/debian/control
=====================================
@@ -9,22 +9,20 @@ Standards-Version: 4.6.2
 Rules-Requires-Root: no
 Build-Depends:
   debhelper-compat (= 12),
-  haskell-devscripts-minimal <!cross>,
+  haskell-devscripts-minimal (>= 0.16.31) <!cross>,
   devscripts,
   pkg-config,
   ghc:native (>= 9.0),
   hadrian:native (>= 9.4) <!pkg.ghc.nohadrian>,
-  libgmp-dev,
   llvm-15 [armel armhf],
+  libgmp-dev,
   libffi-dev,
   libncurses-dev,
   python3:native,
   python3-sphinx <!cross>,
-  python3-sphinx-rtd-theme <!cross>,
-  dpkg-dev,
 Build-Depends-Indep:
   hscolour,
-  fop
+  python3-sphinx-rtd-theme,
 Build-Conflicts: ccache
 Homepage: https://haskell.org/ghc/
 Vcs-Git: https://salsa.debian.org/haskell-team/DHG_packages.git [p/ghc]


=====================================
p/ghc/debian/patches/hadrian-no-pkg-recache
=====================================
@@ -0,0 +1,22 @@
+Description: Do not call 'ghc-pkg recache' in 'make install'
+ Do not call 'ghc-pkg recache' during 'make install'. We do that for two reasons:
+ .
+   * This will fail if we are building a cross compiler, since we
+     cannot run 'ghc-pkg recache'.
+   * We don't need to do this anyways, since we remove the resulting file
+     from the final deb packages. In Debian, we run 'ghc-pkg recache' during
+     installation of the package.
+Author: Ilias Tsitsimpis <iliastsi at debian.org>
+
+Index: b/hadrian/bindist/Makefile
+===================================================================
+--- a/hadrian/bindist/Makefile
++++ b/hadrian/bindist/Makefile
+@@ -230,7 +230,6 @@ update_package_db: install_bin install_l
+ 	@echo "Updating the package DB"
+ 	$(foreach p, $(PKG_CONFS),\
+ 		$(call patchpackageconf,$(shell echo $(notdir $p) | sed 's/-\([0-9]*[0-9]\.\)*conf//g'),$(shell echo "$p" | sed 's:\0xxx\0:   :g'),$(docdir),$(shell realpath -z --relative-to="$(ActualLibsDir)" "$(docdir)"),$(shell echo $(notdir $p) | sed 's/.conf//g')))
+-	'$(DESTDIR)$(ActualBinsDir)/$(CrossCompilePrefix)ghc-pkg' --global-package-db "$(DESTDIR)$(ActualLibsDir)/package.conf.d" recache
+ 
+ install_mingw:
+ 	@echo "Installing MingGW"


=====================================
p/ghc/debian/patches/series
=====================================
@@ -16,3 +16,4 @@ hadrian-relpath
 hadrian-iserv
 allow-setting-llvm-program
 fix-cross-compilation
+hadrian-no-pkg-recache


=====================================
p/ghc/debian/rules
=====================================
@@ -38,13 +38,11 @@ DEB_HOOGLE_TXT_DIR := /usr/lib/ghc-doc/hoogle/
 # script fails to properly detect them (e.g., it detects 'x86_64-unknown-linux'
 # instead of 'x86_64-linux-gnu'.
 EXTRA_CONFIGURE_FLAGS += --host $(DEB_BUILD_GNU_TYPE) --build $(DEB_BUILD_GNU_TYPE) --target $(DEB_HOST_GNU_TYPE)
-EXTRA_INSTALL_CONFIGURE_FLAGS += --host $(DEB_BUILD_GNU_TYPE) --build $(DEB_BUILD_GNU_TYPE) --target $(DEB_HOST_GNU_TYPE)
 
 # We're cross-building if DEB_BUILD_GNU_TYPE != DEB_HOST_GNU_TYPE
 ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
   # EXTRA_CONFIGURE_FLAGS += --enable-unregisterised
   # EXTRA_HADRIAN_FLAGS += --integer-simple
-  # EXTRA_CONFIGURE_FLAGS += --program-prefix=""
   EXTRA_HADRIAN_FLAGS += --flavour=quickest
   # Do not build docs *at all* (avoid dependency on Sphinx)
   EXTRA_HADRIAN_FLAGS += --docs=none
@@ -145,6 +143,11 @@ override_dh_auto_configure:
 
 override_dh_auto_build-arch: export LC_ALL=C.UTF-8
 override_dh_auto_build-arch: hadrian/hadrian
+ifeq (YES,$(BUILD_CROSS))
+	# See https://gitlab.haskell.org/ghc/ghc/-/issues/23975
+	# and https://gitlab.haskell.org/ghc/ghc/-/issues/22006
+	$(error cross-compilation is not supported)
+endif
 	hadrian/hadrian \
 		-V -j \
 		--docs=no-haddocks --docs=no-sphinx-html --docs=no-sphinx-pdfs \
@@ -158,6 +161,9 @@ override_dh_auto_build-arch: hadrian/hadrian
 # OOM errors on some weak builders.
 override_dh_auto_build-indep: export LC_ALL=C.UTF-8
 override_dh_auto_build-indep: hadrian/hadrian
+ifeq (YES,$(BUILD_CROSS))
+	$(error override_dh_auto_build-indep is not supported when cross compiling)
+endif
 	hadrian/hadrian \
 		-V -j \
 		--docs=no-sphinx-pdfs \
@@ -208,6 +214,7 @@ debian/tmp: $(BINDIST)/mk/install.mk
 	sed -ri 's,share/doc/ghc-doc/html/libraries/(.*)\.haddock,lib/ghc-doc/haddock/ghc/\1.haddock,' debian/tmp/var/lib/ghc/package.conf.d/*.conf
 
 	# manpages
+ifeq (NO,$(BUILD_CROSS))
 	echo ".so man1/ghc.1" > debian/tmp/usr/share/man/man1/ghc-$(ProjectVersion).1
 	if test -e debian/tmp/usr/bin/ghci-$(ProjectVersion); then \
 		echo ".so man1/ghc.1" > debian/tmp/usr/share/man/man1/ghci.1 ;\
@@ -217,6 +224,7 @@ debian/tmp: $(BINDIST)/mk/install.mk
 	cp debian/ghc-pkg.man debian/tmp/usr/share/man/man1/ghc-pkg.1
 	echo ".so man1/ghc-pkg.1" > debian/tmp/usr/share/man/man1/ghc-pkg-$(ProjectVersion).1
 	cp debian/haddock.man debian/tmp/usr/share/man/man1/haddock.1
+endif
 
 	# Delete all the library LICENSE files
 	rm -f debian/tmp/usr/share/doc/ghc-doc/html/libraries/*/LICENSE
@@ -257,7 +265,9 @@ PROF_FILE = \( -name "*.p_*" -o -name "lib*_p.a" \)
 
 override_dh_auto_install-arch: debian/tmp
 	# Manpages
+ifeq (NO,$(BUILD_CROSS))
 	find debian/tmp/usr/share/man $(FILES)           >> debian/ghc.install
+endif
 	# ghc
 	find debian/tmp/usr/bin $(FILES)                 >> debian/ghc.install
 #	find debian/tmp/usr/share/ghc* $(FILES)          >> debian/ghc.install
@@ -276,6 +286,7 @@ override_dh_auto_install-indep: debian/tmp
 		-printf "%p $(DEB_HOOGLE_TXT_DIR)/%f\n" >> debian/ghc-doc.links
 	find debian/tmp/usr/share/doc/ghc-doc/html $(FILES) > debian/ghc-doc.install
 	find debian/tmp/usr/lib/ghc-doc $(FILES)      >> debian/ghc-doc.install
+	echo debian/tmp/usr/share/doc/ghc-doc/index.html >> debian/ghc-doc.install
 	# Normalize paths
 	sed -i s,^debian/tmp,, debian/*.install debian/*.links
 
@@ -284,8 +295,6 @@ override_dh_auto_install-indep: debian/tmp
 # Cleanup and other rules
 
 override_dh_auto_clean: clean-hadrian
-	dh_auto_clean
-
 	# Build artifacts
 	rm -rf _build/
 
@@ -297,6 +306,7 @@ override_dh_auto_clean: clean-hadrian
 	rm -rf debian/tmp-db
 
 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
@@ -311,11 +321,13 @@ override_dh_auto_test:
 	@printf "====BEGIN GHC INFO OUTPUT====\n"
 	@_build/stage1/bin/ghc --info
 	@printf "====END GHC INFO OUTPUT====\n"
+endif
 
 override_dh_compress:
 	dh_compress -X.haddock -X.txt
 
 override_dh_gencontrol:
+ifeq (NO,$(BUILD_CROSS))
 	# Generate substvars
 	chmod +x debian/provided_substvars
 	debian/provided_substvars
@@ -323,11 +335,10 @@ override_dh_gencontrol:
 	if test -e debian/tmp/usr/bin/ghci-$(ProjectVersion); then \
 		echo 'ghci=ghc-ghci' >> debian/ghc.substvars ; fi
 	# Add haddock substvars
-ifeq (NO,$(BUILD_CROSS))
 	echo "haddock:Provides=haddock-interface-$$(debian/tmp/usr/lib/ghc/bin/haddock --interface-version)" >> debian/ghc.substvars
 	echo "haddock:Depends=haddock-interface-$$(debian/tmp/usr/lib/ghc/bin/haddock --interface-version)" >> debian/ghc-doc.substvars
-endif
 	dh_haskell_provides
+endif
 	dh_gencontrol
 
 override_dh_shlibdeps:



View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/commit/a10b258a0247f4159dcd32d4a874a5529ada4735

-- 
View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/commit/a10b258a0247f4159dcd32d4a874a5529ada4735
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-haskell-commits/attachments/20230920/f5c8e87a/attachment-0001.htm>


More information about the Pkg-haskell-commits mailing list