From 3b3946cf6feb6c1114c8182ffc98c6b828f7d962 Mon Sep 17 00:00:00 2001 From: ii8 Date: Fri, 4 Jul 2025 21:18:03 +0100 Subject: [PATCH] ghc: update to 9.8.4. --- srcpkgs/ghc-bin/template | 66 ++-- srcpkgs/ghc-devel | 1 + srcpkgs/ghc/files/plan-bootstrap-9_8_4.json | 288 ++++++++++++++++++ .../ghc/patches/Disable-unboxed-arrays.patch | 33 -- srcpkgs/ghc/patches/fix-build-sphinx7.patch | 66 ---- srcpkgs/ghc/patches/libffi-autogen.patch | 25 -- srcpkgs/ghc/patches/ppc64-be-elfv2.patch | 168 ---------- srcpkgs/ghc/template | 191 ++++++------ 8 files changed, 404 insertions(+), 434 deletions(-) create mode 120000 srcpkgs/ghc-devel create mode 100644 srcpkgs/ghc/files/plan-bootstrap-9_8_4.json delete mode 100644 srcpkgs/ghc/patches/Disable-unboxed-arrays.patch delete mode 100644 srcpkgs/ghc/patches/fix-build-sphinx7.patch delete mode 100644 srcpkgs/ghc/patches/libffi-autogen.patch delete mode 100644 srcpkgs/ghc/patches/ppc64-be-elfv2.patch diff --git a/srcpkgs/ghc-bin/template b/srcpkgs/ghc-bin/template index 786a57b73d8..73f196f3d80 100644 --- a/srcpkgs/ghc-bin/template +++ b/srcpkgs/ghc-bin/template @@ -1,53 +1,35 @@ # Template file for 'ghc-bin' pkgname=ghc-bin -version=9.0.2 +version=9.8.4 revision=1 -archs="i686 x86_64* ppc64le* ppc64 aarch64*" -hostmakedepends="perl libffi libnuma" -depends="ncurses perl gcc libffi-devel gmp-devel" -short_desc="Glorious Haskell Compiler - precompiled binaries" +archs="i686 x86_64* aarch64*" +hostmakedepends="patchelf" +depends="gcc libffi-devel gmp-devel" +short_desc="Glasgow Haskell Compiler - precompiled binaries" maintainer="Orphaned " license="BSD-3-Clause" homepage="http://www.haskell.org/ghc/" nocross=yes nostrip=yes noshlibprovides=yes -conflicts="ghc>=0 ghc-doc>=0" +conflicts="ghc>=0 ghc-doc>=0 ghc-devel>=0" + case "$XBPS_TARGET_MACHINE" in -x86_64) - distfiles="https://downloads.haskell.org/ghc/${version%[!0-9]}/ghc-${version}-x86_64-deb9-linux.tar.xz" - checksum=805f5628ce6cec678ba77ff48c924831ebdf75ec2c66368e8935a618913a150e - ;; -x86_64-musl) - # create with "make binary-dist" - distfiles="https://repo-default.voidlinux.org/distfiles/ghc-${version}-x86_64-void-linux-musl.tar.xz" - checksum=e21eaddeffcd5de7abe43b1f3982a3bc2c5b5f408d2574857cb2b0368106e12c +x86_64*) + distfiles="https://downloads.haskell.org/ghc/${version}/ghc-${version}-x86_64-alpine3_12-linux-static.tar.xz" + checksum=02535eaef4f57aef8b7b272ef6f48d386d186ebd07fa47e227b46b93fa7eb0ab ;; i686) - distfiles="https://downloads.haskell.org/ghc/${version%[!0-9]}/ghc-${version}-i386-deb9-linux.tar.xz" - checksum=fdeb9f8928fbe994064778a8e1e85bb1a58a6cd3dd7b724fcc2a1dcfda6cad47 - ;; -ppc64le) - distfiles="https://repo-default.voidlinux.org/distfiles/ghc-${version}-powerpc64le-void-linux.tar.xz" - checksum=7de8114c991f9a2a3b0f5e472da76e3956be6447efec4b1157f14e707049f22d - ;; -ppc64le-musl) - distfiles="https://repo-default.voidlinux.org/distfiles/ghc-${version}-powerpc64le-void-linux-musl.tar.xz" - checksum=37de8e069712307c9b2039e92f56e540e80ca1390dd27aa247ebe18c40e0c629 - ;; -ppc64) - distfiles="https://repo-default.voidlinux.org/distfiles/ghc-${version}-powerpc64-void-linux.tar.xz" - checksum=6eb8684fdbede0cded7e3f7b93574b968f5f66dd2fcd4ec30ac5f0c402af6602 + distfiles="https://downloads.haskell.org/ghc/${version}/ghc-${version}-i386-deb10-linux.tar.xz" + checksum=e5efce16c654d5e702986258a87dd9531e1722b8051823c8ce1150ce3c5899ae ;; aarch64) - distfiles="https://repo-default.voidlinux.org/distfiles/ghc-${version}-aarch64-void-linux.tar.xz" - checksum=44a20a896246dce64392b7d0feedd0a28a9d733245a803e95dbe4b4b7e15b4fd - depends+=" llvm" + distfiles="https://downloads.haskell.org/ghc/${version}/ghc-${version}-aarch64-deb11-linux.tar.xz" + checksum=310204daf2df6ad16087be94b3498ca414a0953b29e94e8ec8eb4a5c9bf603d3 ;; aarch64-musl) - distfiles="https://repo-default.voidlinux.org/distfiles/ghc-${version}-aarch64-void-linux-musl.tar.xz" - checksum=de98e2ff33a25cb32a28c738066fecacb736a33cac12688876eec4eb96d88607 - depends+=" llvm" + distfiles="https://downloads.haskell.org/ghc/${version}/ghc-${version}-aarch64-alpine3_18-linux.tar.xz" + checksum=b5c86a0cda0bd62d5eeeb52b1937c3bd00c70cd67dd74226ce787d5c429a4e62 ;; *) broken="No distfiles available for this target" @@ -59,13 +41,15 @@ do_configure() { } do_install() { - ln -sf /usr/lib/libncursesw.so.6 libtinfo.so.5 - export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH - make install DESTDIR="$DESTDIR" - # Fake libtinfo into rpath of ghc: - ln -sf /usr/lib/libncursesw.so.6 \ - $DESTDIR/usr/lib/ghc-${version%[!0-9]}/rts/libtinfo.so.5 - vlicense LICENSE + # quiet lint: vlicense not needed, installed by make +} + +post_install() { + if [ "$XBPS_TARGET_MACHINE" = "aarch64-musl" ]; then + for _cur_binary in $(find ${DESTDIR} -type f -exec file {} \; |grep ELF |grep -v static |cut -d ':' -f 1); do + patchelf --replace-needed libc.musl-aarch64.so.1 libc.so $_cur_binary + done + fi } diff --git a/srcpkgs/ghc-devel b/srcpkgs/ghc-devel new file mode 120000 index 00000000000..a064d2670ec --- /dev/null +++ b/srcpkgs/ghc-devel @@ -0,0 +1 @@ +ghc \ No newline at end of file diff --git a/srcpkgs/ghc/files/plan-bootstrap-9_8_4.json b/srcpkgs/ghc/files/plan-bootstrap-9_8_4.json new file mode 100644 index 00000000000..adf66a184ef --- /dev/null +++ b/srcpkgs/ghc/files/plan-bootstrap-9_8_4.json @@ -0,0 +1,288 @@ +{ + "builtin": [ + { + "package": "rts", + "version": "1.0.2" + }, + { + "package": "ghc-prim", + "version": "0.11.0" + }, + { + "package": "ghc-bignum", + "version": "1.3" + }, + { + "package": "base", + "version": "4.19.2.0" + }, + { + "package": "array", + "version": "0.5.8.0" + }, + { + "package": "deepseq", + "version": "1.5.1.0" + }, + { + "package": "ghc-boot-th", + "version": "9.8.4" + }, + { + "package": "pretty", + "version": "1.1.3.6" + }, + { + "package": "template-haskell", + "version": "2.21.0.0" + }, + { + "package": "bytestring", + "version": "0.12.1.0" + }, + { + "package": "containers", + "version": "0.6.8" + }, + { + "package": "binary", + "version": "0.8.9.1" + }, + { + "package": "transformers", + "version": "0.6.1.0" + }, + { + "package": "mtl", + "version": "2.3.1" + }, + { + "package": "stm", + "version": "2.5.3.1" + }, + { + "package": "exceptions", + "version": "0.10.7" + }, + { + "package": "filepath", + "version": "1.4.301.0" + }, + { + "package": "time", + "version": "1.12.2" + }, + { + "package": "unix", + "version": "2.8.6.0" + }, + { + "package": "directory", + "version": "1.3.8.5" + }, + { + "package": "text", + "version": "2.1.1" + }, + { + "package": "parsec", + "version": "3.1.17.0" + }, + { + "package": "Cabal-syntax", + "version": "3.10.3.0" + }, + { + "package": "process", + "version": "1.6.25.0" + }, + { + "package": "Cabal", + "version": "3.10.3.0" + } + ], + "dependencies": [ + { + "cabal_sha256": "a694e88f9ec9fc79f0b03f233d3fea592b68f70a34aac2ddb5bcaecb6562e2fd", + "flags": [], + "package": "base16-bytestring", + "revision": 1, + "source": "hackage", + "src_sha256": "1d5a91143ef0e22157536093ec8e59d226a68220ec89378d5dcaeea86472c784", + "version": "1.0.2.0" + }, + { + "cabal_sha256": "b938655b00cf204ce69abfff946021bed111d2609a9f7a9c22e28a1a202e9115", + "flags": [ + "-llvm" + ], + "package": "clock", + "revision": 0, + "source": "hackage", + "src_sha256": "6ae9898afe788a5e334cd5fad5d18a3c2e8e59fa09aaf7b957dbb38a4767df2e", + "version": "0.8.4" + }, + { + "cabal_sha256": "0e9de2ccce261e7a5b027e842f6f47f50eb0e6059a0de98a5479f75aa8164107", + "flags": [ + "-exe", + "+use-cbits" + ], + "package": "cryptohash-sha256", + "revision": 6, + "source": "hackage", + "src_sha256": "73a7dc7163871a80837495039a099967b11f5c4fe70a118277842f7a713c6bf6", + "version": "0.11.102.1" + }, + { + "cabal_sha256": "57d9200fbea2e88e05e0be35925511764827b1c86d3214106b0b610f331fc40c", + "flags": [], + "package": "extra", + "revision": 0, + "source": "hackage", + "src_sha256": "2fa4ce5eae50560bba80f1883913cf2ed52b3d87fd290dae27d838c94f5389a1", + "version": "1.8" + }, + { + "cabal_sha256": "372c1733d83b90045eb29da9f010fed79bfef8771ce65eb126a1d83ecc54a9a2", + "flags": [], + "package": "filepattern", + "revision": 0, + "source": "hackage", + "src_sha256": "cc445d439ea2f65cac7604d3578aa2c3a62e5a91dc989f4ce5b3390db9e59636", + "version": "0.1.3" + }, + { + "cabal_sha256": "2efc549644dd418bad537d1601fdd437c440d807265016bd993b6996c679ad2f", + "flags": [], + "package": "os-string", + "revision": 0, + "source": "hackage", + "src_sha256": "339c35fd3a290522f23de4e33528423cfd0b0a8f22946b0b9816a817b926cba0", + "version": "2.0.7" + }, + { + "cabal_sha256": "2f23146cbe0325029927b221647695a4c7d6e97548ff731110979e34361f58ef", + "flags": [ + "-arch-native", + "-random-initial-seed" + ], + "package": "hashable", + "revision": 1, + "source": "hackage", + "src_sha256": "e58b3a8e18da5f6cd7e937e5fd683e500bb1f8276b3768269759119ca0cddb6a", + "version": "1.5.0.0" + }, + { + "cabal_sha256": "74ce60a23b8ef247b8bca71eeb38289e82b3b5e83b2383600b2c838a68218068", + "flags": [], + "package": "heaps", + "revision": 0, + "source": "hackage", + "src_sha256": "8763a4663a2d0b3c912400a547d66ae11b46a954403b6747272148e950aa0382", + "version": "0.4.1" + }, + { + "cabal_sha256": "f75cb4fa53c88c65794becdd48eb0d3b2b8abd89a3d5c19e87af91f5225c15e4", + "flags": [], + "package": "js-dgtable", + "revision": 0, + "source": "hackage", + "src_sha256": "e28dd65bee8083b17210134e22e01c6349dc33c3b7bd17705973cd014e9f20ac", + "version": "0.5.2" + }, + { + "cabal_sha256": "4c1c447a9a2fba0adba6d30678302a30c32b9dfde9e7aa9e9156483e1545096d", + "flags": [], + "package": "js-flot", + "revision": 0, + "source": "hackage", + "src_sha256": "1ba2f2a6b8d85da76c41f526c98903cbb107f8642e506c072c1e7e3c20fe5e7a", + "version": "0.8.3" + }, + { + "cabal_sha256": "fdbdfd4d413848c678a3737f2b985a5db66b796c6847b1ae08246ea3795c0ba2", + "flags": [], + "package": "js-jquery", + "revision": 0, + "source": "hackage", + "src_sha256": "a087fa01a1c52f5386d43f5355f64841c5a4b56b53720090d66b5aa00bfeb106", + "version": "3.7.1" + }, + { + "cabal_sha256": "dfdd6572944c11e69208237dd32a2eb9d975b4f4e9064a7b8dc952cb0e256846", + "flags": [], + "package": "primitive", + "revision": 0, + "source": "hackage", + "src_sha256": "44b4de41813c7bc5db8a57f87c3612a069b65086946268ba165097252ebd3d76", + "version": "0.9.1.0" + }, + { + "cabal_sha256": "8f92088f1c51c8d4569279a07565f8aa6b534a6735615b2295d2961dec8f1783", + "flags": [ + "-optimised-mixer" + ], + "package": "splitmix", + "revision": 0, + "source": "hackage", + "src_sha256": "d678c41a603a62032cf7e5f8336bb8222c93990e4b59c8b291b7ca26c7eb12c7", + "version": "0.1.1" + }, + { + "cabal_sha256": "0b4f649c3e78713b2ccad1535251ee34b148237fb2229d7058c2b1d9ccc324b8", + "flags": [], + "package": "random", + "revision": 0, + "source": "hackage", + "src_sha256": "d840ac83f265b0cfa2a678f8ec78627eb50cf9be2f067c52c8a4239c29b71a35", + "version": "1.3.1" + }, + { + "cabal_sha256": "233cbcdda6c2698932bb391ce0935fb44f80c115621ee815a21ed33ac8ede422", + "flags": [ + "-debug" + ], + "package": "unordered-containers", + "revision": 4, + "source": "hackage", + "src_sha256": "d9cfb287cf00592d39dc9c3cac8b99627ea08f2c01798e70130fc39f7c90f11d", + "version": "0.2.20" + }, + { + "cabal_sha256": "79416292186feeaf1f60e49ac5a1ffae9bf1b120e040a74bf0e81ca7f1d31d3f", + "flags": [], + "package": "utf8-string", + "revision": 0, + "source": "hackage", + "src_sha256": "ee48deada7600370728c4156cb002441de770d0121ae33a68139a9ed9c19b09a", + "version": "1.0.2" + }, + { + "cabal_sha256": "03c8f06de478e07ad6fde95984c9206920106d0d8432ecb7ab825ef108d45382", + "flags": [ + "-cloud", + "-embed-files", + "-portable", + "+threaded" + ], + "package": "shake", + "revision": 0, + "source": "hackage", + "src_sha256": "6384e33a26a2590bf33719e88881076b899ac4b5340c1c9271e4caa37e9d6535", + "version": "0.19.8" + }, + { + "cabal_sha256": null, + "flags": [ + "-selftest", + "+threaded" + ], + "package": "hadrian", + "revision": null, + "source": "local", + "src_sha256": null, + "version": "0.1.0.0" + } + ] +} diff --git a/srcpkgs/ghc/patches/Disable-unboxed-arrays.patch b/srcpkgs/ghc/patches/Disable-unboxed-arrays.patch deleted file mode 100644 index 46c2cf1091d..00000000000 --- a/srcpkgs/ghc/patches/Disable-unboxed-arrays.patch +++ /dev/null @@ -1,33 +0,0 @@ -From c74cdea9e6804d10660035700136975cfd39da8d Mon Sep 17 00:00:00 2001 -From: Peter Trommler -Date: Fri, 31 Dec 2021 18:20:45 +0100 -Subject: [PATCH] Disable unboxed arrays on big-endian - -Unboxed arrays are broken on big-endian architectures, see -https://gitlab.haskell.org/ghc/ghc/-/issues/16998 for details. -This patch makes the use of unboxed arrays conditional on -little-endian architecture. - -Fixes #673 - -diff --git a/libraries/containers/containers/include/containers.h b/libraries/containers/containers/include/containers.h -index cd201ca..fc2a0e8 100644 ---- a/libraries/containers/containers/include/containers.h -+++ b/libraries/containers/containers/include/containers.h -@@ -35,7 +35,13 @@ - - #ifdef __GLASGOW_HASKELL__ - # define USE_ST_MONAD 1 -+#ifndef WORDS_BIGENDIAN -+/* -+ * Unboxed arrays are broken on big-endian architectures. -+ * See https://gitlab.haskell.org/ghc/ghc/-/issues/16998 -+ */ - # define USE_UNBOXED_ARRAYS 1 - #endif -+#endif - - #endif --- -2.31.1 - diff --git a/srcpkgs/ghc/patches/fix-build-sphinx7.patch b/srcpkgs/ghc/patches/fix-build-sphinx7.patch deleted file mode 100644 index 8d256945ad0..00000000000 --- a/srcpkgs/ghc/patches/fix-build-sphinx7.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 00dc51060881df81258ba3b3bdf447294618a4de Mon Sep 17 00:00:00 2001 -From: Matthew Pickering -Date: Tue, 3 Jan 2023 15:56:37 +0000 -Subject: [PATCH] sphinx: Use modern syntax for extlinks - -This fixes the following build error: - -``` - Command line: /opt/homebrew/opt/sphinx-doc/bin/sphinx-build -b man -d /private/tmp/extra-dir-55768274273/.doctrees-man -n -w /private/tmp/extra-dir-55768274273/.log docs/users_guide /private/tmp/extra-dir-55768274273 - ===> Command failed with error code: 2 - - Exception occurred: - File "/opt/homebrew/Cellar/sphinx-doc/6.0.0/libexec/lib/python3.11/site-packages/sphinx/ext/extlinks.py", line 101, in role - title = caption % part - ~~~~~~~~^~~~~~ - TypeError: not all arguments converted during string formatting -``` - -I tested on Sphinx-5.1.1 and Sphinx-6.0.0 - -Thanks for sterni for providing instructions about how to test using -sphinx-6.0.0. - -Fixes #22690 ---- - docs/users_guide/ghc_config.py.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/docs/users_guide/ghc_config.py.in b/docs/users_guide/ghc_config.py.in -index dcc7fbaef624..c9888a13adc5 100644 ---- a/docs/users_guide/ghc_config.py.in -+++ b/docs/users_guide/ghc_config.py.in -@@ -1,6 +1,6 @@ - extlinks = { -- 'ghc-ticket': ('https://gitlab.haskell.org/ghc/ghc/issues/%s', '#'), -- 'ghc-wiki': ('https://gitlab.haskell.org/ghc/ghc/wikis/%s', '#'), -+ 'ghc-ticket': ('https://gitlab.haskell.org/ghc/ghc/issues/%s', '%s'), -+ 'ghc-wiki': ('https://gitlab.haskell.org/ghc/ghc/wikis/%s', '#%s'), - } - - libs_base_uri = '../libraries' -From 52d701b31dc4427b7e321a04be3f5f13a5fc271e Mon Sep 17 00:00:00 2001 -From: "mimi.vx" -Date: Wed, 24 May 2023 12:42:15 +0000 -Subject: [PATCH] Fix for Sphinx 7 removed style key - -Fixes https://gitlab.haskell.org/ghc/ghc/-/issues/23444 ---- - docs/users_guide/rtd-theme/layout.html | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/docs/users_guide/rtd-theme/layout.html b/docs/users_guide/rtd-theme/layout.html -index 2a61142514a..7ffeff7befc 100644 ---- a/docs/users_guide/rtd-theme/layout.html -+++ b/docs/users_guide/rtd-theme/layout.html -@@ -64,7 +64,7 @@ - {%- endif %} - - {# CSS #} -- -+ - - {%- for css in css_files %} - {%- if css|attr("rel") %} --- -GitLab diff --git a/srcpkgs/ghc/patches/libffi-autogen.patch b/srcpkgs/ghc/patches/libffi-autogen.patch deleted file mode 100644 index 7b08c65a39b..00000000000 --- a/srcpkgs/ghc/patches/libffi-autogen.patch +++ /dev/null @@ -1,25 +0,0 @@ -Since we replace bundled tarball with our own and it's a git -snapshot, it is necessary to generate the build system ourselves - -Source: @q66 - ---- a/libffi/ghc.mk -+++ b/libffi/ghc.mk -@@ -58,16 +58,7 @@ $(libffi_STAMP_CONFIGURE): $(TOUCH_DEP) - $(CP) "$(TOP)/config.guess" libffi/build/config.guess - $(CP) "$(TOP)/config.sub" libffi/build/config.sub - --# We have to fake a non-working ln for configure, so that the fallback --# option (cp -p) gets used instead. Otherwise the libffi build system --# will use cygwin symbolic links which cannot be read by mingw gcc. -- chmod +x libffi/ln -- -- # We need to use -MMD rather than -MD, as otherwise we get paths -- # like c:/... in the dependency files on Windows, and the extra -- # colons break make -- mv libffi/build/Makefile.in libffi/build/Makefile.in.orig -- sed "s/-MD/-MMD/" < libffi/build/Makefile.in.orig > libffi/build/Makefile.in -+ cd libffi && cd build && "$(SHELL)" ./autogen.sh - - # We attempt to specify the installation directory below with --libdir, - # but libffi installs into 'toolexeclibdir' instead, which may differ diff --git a/srcpkgs/ghc/patches/ppc64-be-elfv2.patch b/srcpkgs/ghc/patches/ppc64-be-elfv2.patch deleted file mode 100644 index df1a0bfe15b..00000000000 --- a/srcpkgs/ghc/patches/ppc64-be-elfv2.patch +++ /dev/null @@ -1,168 +0,0 @@ -From 587edc0d9786aff3c7a4728ba941f6a993e59bdc Mon Sep 17 00:00:00 2001 -From: q66 -Date: Thu, 28 Apr 2022 00:48:04 +0200 -Subject: [PATCH] fix up runtime for ppc64 BE ELFv2 + ensure it's used - ---- - configure | 2 +- - libraries/ghci/GHCi/InfoTable.hsc | 36 ++++++++++++------------------- - m4/fptools.m4 | 2 +- - rts/AdjustorAsm.S | 2 +- - rts/StgCRun.c | 4 ++-- - rts/StgCRunAsm.S | 2 +- - rts/adjustor/NativeIA64.c | 2 +- - rts/adjustor/NativePowerPC.c | 2 +- - 8 files changed, 22 insertions(+), 30 deletions(-) - -diff --git a/configure b/configure -index 8310e6f..eac1124 100755 ---- a/configure -+++ b/configure -@@ -10508,7 +10508,7 @@ printf "%s\n" "no" >&6; } - test -z "$2" || eval "$2=ArchPPC" - ;; - powerpc64) -- test -z "$2" || eval "$2=\"ArchPPC_64 {ppc_64ABI = ELF_V1}\"" -+ test -z "$2" || eval "$2=\"ArchPPC_64 {ppc_64ABI = ELF_V2}\"" - ;; - powerpc64le) - test -z "$2" || eval "$2=\"ArchPPC_64 {ppc_64ABI = ELF_V2}\"" -diff --git a/libraries/ghci/GHCi/InfoTable.hsc b/libraries/ghci/GHCi/InfoTable.hsc -index ad4eb4d..e4f1c0c 100644 ---- a/libraries/ghci/GHCi/InfoTable.hsc -+++ b/libraries/ghci/GHCi/InfoTable.hsc -@@ -231,30 +231,22 @@ mkJumpToAddr' platform a = case platform of - , fromIntegral w64 - , fromIntegral (w64 `shiftR` 32) ] - ArchPPC64 -> -- -- We use the compiler's register r12 to read the function -- -- descriptor and the linker's register r11 as a temporary -- -- register to hold the function entry point. -- -- In the medium code model the function descriptor -- -- is located in the first two gigabytes, i.e. the address -- -- of the function pointer is a non-negative 32 bit number. -- -- 0x0EADBEEF stands for the address of the function pointer: -- -- 0: 3d 80 0e ad lis r12,0x0EAD -- -- 4: 61 8c be ef ori r12,r12,0xBEEF -- -- 8: e9 6c 00 00 ld r11,0(r12) -- -- c: e8 4c 00 08 ld r2,8(r12) -- -- 10: 7d 69 03 a6 mtctr r11 -- -- 14: e9 6c 00 10 ld r11,16(r12) -- -- 18: 4e 80 04 20 bctr -- let w32 = fromIntegral (funPtrToInt a) -+ -- The ABI requires r12 to point to the function's entry point. -+ -- We use the medium code model where code resides in the first -+ -- two gigabytes, so loading a non-negative32 bit address -+ -- with lis followed by ori is fine. -+ -- 0x0EADBEEF stands for the address: -+ -- 3D800EAD lis r12,0x0EAD -+ -- 618CBEEF ori r12,r12,0xBEEF -+ -- 7D8903A6 mtctr r12 -+ -- 4E800420 bctr -+ -+ let w32 = fromIntegral (funPtrToInt a) - hi16 x = (x `shiftR` 16) .&. 0xFFFF - lo16 x = x .&. 0xFFFF -- in Right [ 0x3D800000 .|. hi16 w32, -- 0x618C0000 .|. lo16 w32, -- 0xE96C0000, -- 0xE84C0008, -- 0x7D6903A6, -- 0xE96C0010, -- 0x4E800420] -+ in Right [ 0x3D800000 .|. hi16 w32, -+ 0x618C0000 .|. lo16 w32, -+ 0x7D8903A6, 0x4E800420 ] - - ArchPPC64LE -> - -- The ABI requires r12 to point to the function's entry point. -diff --git a/m4/fptools.m4 b/m4/fptools.m4 -index 8c6c9b7..eb25c37 100644 ---- a/m4/fptools.m4 -+++ b/m4/fptools.m4 -@@ -201,7 +201,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS], - test -z "[$]2" || eval "[$]2=ArchPPC" - ;; - powerpc64) -- test -z "[$]2" || eval "[$]2=\"ArchPPC_64 {ppc_64ABI = ELF_V1}\"" -+ test -z "[$]2" || eval "[$]2=\"ArchPPC_64 {ppc_64ABI = ELF_V2}\"" - ;; - powerpc64le) - test -z "[$]2" || eval "[$]2=\"ArchPPC_64 {ppc_64ABI = ELF_V2}\"" -diff --git a/rts/AdjustorAsm.S b/rts/AdjustorAsm.S -index 2795b83..63cfe91 100644 ---- a/rts/AdjustorAsm.S -+++ b/rts/AdjustorAsm.S -@@ -2,7 +2,7 @@ - - /* ******************************** PowerPC ******************************** */ - --#if defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) -+#if defined(powerpc_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF != 2)) - #if !(defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS)) - /* The following code applies, with some differences, - to all powerpc platforms except for powerpc32-linux, -diff --git a/rts/StgCRun.c b/rts/StgCRun.c -index f43227a..927d44a 100644 ---- a/rts/StgCRun.c -+++ b/rts/StgCRun.c -@@ -724,7 +724,7 @@ StgRunIsImplementedInAssembler(void) - Everything is in assembler, so we don't have to deal with GCC... - -------------------------------------------------------------------------- */ - --#if defined(powerpc64_HOST_ARCH) -+#if defined(powerpc64_HOST_ARCH) && (_CALL_ELF != 2) - /* 64-bit PowerPC ELF ABI 1.9 - * - * Stack frame organization (see Figure 3-17, ELF ABI 1.9, p 14) -@@ -792,7 +792,7 @@ StgRunIsImplementedInAssembler(void) - - #endif - --#if defined(powerpc64le_HOST_ARCH) -+#if defined(powerpc64le_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF == 2)) - /* ----------------------------------------------------------------------------- - PowerPC 64 little endian architecture - -diff --git a/rts/StgCRunAsm.S b/rts/StgCRunAsm.S -index 60f1bf9..c6794d7 100644 ---- a/rts/StgCRunAsm.S -+++ b/rts/StgCRunAsm.S -@@ -5,7 +5,7 @@ - * then functions StgRun/StgReturn are implemented in file StgCRun.c */ - #if !defined(USE_MINIINTERPRETER) - --#if defined(powerpc64le_HOST_ARCH) -+#if defined(powerpc64le_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF == 2)) - # if defined(linux_HOST_OS) - /* 64-bit PowerPC ELF V2 ABI Revision 1.4 - * -diff --git a/rts/adjustor/NativeIA64.c b/rts/adjustor/NativeIA64.c -index 9fd1991..816b3ef 100644 ---- a/rts/adjustor/NativeIA64.c -+++ b/rts/adjustor/NativeIA64.c -@@ -39,7 +39,7 @@ void* - createAdjustor(int cconv, StgStablePtr hptr, - StgFunPtr wptr, - char *typeString --#if !defined(powerpc_HOST_ARCH) && !defined(powerpc64_HOST_ARCH) && !defined(x86_64_HOST_ARCH) -+#if !defined(powerpc_HOST_ARCH) && (!defined(powerpc64_HOST_ARCH) || (_CALL_ELF == 2)) && !defined(x86_64_HOST_ARCH) - STG_UNUSED - #endif - ) -diff --git a/rts/adjustor/NativePowerPC.c b/rts/adjustor/NativePowerPC.c -index 2e5d605..caef5d3 100644 ---- a/rts/adjustor/NativePowerPC.c -+++ b/rts/adjustor/NativePowerPC.c -@@ -29,7 +29,7 @@ __asm__("obscure_ccall_ret_code:\n\t" - extern void obscure_ccall_ret_code(void); - #endif /* defined(linux_HOST_OS) */ - --#if defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) -+#if defined(powerpc_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF != 2)) - #if !(defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS)) - - /* !!! !!! WARNING: !!! !!! --- -2.35.1 - diff --git a/srcpkgs/ghc/template b/srcpkgs/ghc/template index 1f52ca7b438..99142cd088d 100644 --- a/srcpkgs/ghc/template +++ b/srcpkgs/ghc/template @@ -1,38 +1,28 @@ # Template file for 'ghc' pkgname=ghc # Keep this synchronized with http://www.stackage.org/lts -version=9.0.2 -revision=2 -build_style=gnu-configure -hostmakedepends="automake docbook-xsl ghc-bin libxslt libnuma-devel - ncurses-devel python3-Sphinx python3-setuptools" -makedepends="libnuma-devel" -depends="perl gcc libffi-devel gmp-devel libnuma-devel" -short_desc="Glorious Haskell Compiler" +version=9.8.4 +revision=1 +build_helper="haskell" +_configure_args="--prefix=/usr" +_hadrian_args="--prefix=/usr" +hostmakedepends="ghc-bin python3 tar xz automake" +makedepends="libffi-devel" +depends="gcc libffi-devel gmp-devel libnuma-devel" +short_desc="Glasgow Haskell Compiler" maintainer="Orphaned " license="BSD-3-Clause" homepage="http://www.haskell.org/ghc/" -distfiles="http://www.haskell.org/ghc/dist/${version%[!0-9]}/${pkgname}-${version%[!0-9]}-src.tar.xz" -checksum=140e42b96346322d1a39eb17602bcdc76e292028ad4a69286b230bab188a9197 +distfiles="http://www.haskell.org/ghc/dist/${version}/${pkgname}-${version}-src.tar.xz" +checksum=17e8188f3c8a5c2f73fb4e35d01032e8dc258835ec876d52c8ad8ee3d24b2fc5 +_hadrian_cmd="hadrian/bootstrap/_build/bin/hadrian" nocross=yes # this is conditionally unset for cross bindist -nodebug=yes # work around assembler error "Fatal error: duplicate .debug_line sections" -_bindir="/usr/lib/${pkgname}-${version}/bin" -nopie_files=" - ${_bindir}/ghc - ${_bindir}/ghc-iserv - ${_bindir}/ghc-iserv-dyn - ${_bindir}/ghc-iserv-prof - ${_bindir}/ghc-pkg - ${_bindir}/haddock - ${_bindir}/hp2ps - ${_bindir}/hpc - ${_bindir}/hsc2hs - ${_bindir}/runghc - ${_bindir}/unlit -" +nopie=yes +_ghc_ver="${version//./_}" -build_options="bindist" +build_options="bindist stage3" desc_option_bindist="Create a binary distribution" +desc_option_stage3="Build a stage3 compiler" # it is not possible to cross-compile an entire ghc distribution as # some components rely on stage2 binaries being runnable on the host @@ -40,114 +30,113 @@ desc_option_bindist="Create a binary distribution" # use them to compile proper bindists on newly bootstrapped targets if [ -z "$build_option_bindist" ]; then # final package builds use system libffi as well as gmp and ncurses - configure_args=" --with-system-libffi" - makedepends+=" libffi-devel ncurses-devel gmp-devel" + _configure_args+=" --with-system-libffi" + + # --hash-unit-ids is needed because it only became part of the + # release flavour in later GHC versions. + _hadrian_args+=" --flavour=release --hash-unit-ids --docs=no-sphinx-pdfs" + + hostmakedepends+=" python3-Sphinx docbook-xsl" + makedepends+=" ncurses-devel gmp-devel libnuma-devel" elif [ -z "$CROSS_BUILD" ]; then - # native bindist builds use gmp and ncurses, but builtin libffi + # native bindist builds use system libffi as well as gmp and ncurses + _configure_args+=" --with-system-libffi --disable-numa" + _hadrian_args+=" --flavour=quick --docs=none" + makedepends+=" ncurses-devel gmp-devel" elif [ "${XBPS_MACHINE%-*}" != "${XBPS_TARGET_MACHINE%-*}" ]; then # ghc's cross mode only works when the actual target arch differs # i.e. cross-compiling to same arch but different libc does not work unset nocross - # host must equal build and target must be set when cross-compiling - configure_args+=" --host=${XBPS_TRIPLET} --target=${XBPS_CROSS_TRIPLET}" -fi - -case "$XBPS_TARGET_MACHINE" in -aarch64*) - # GHC uses LLVM to generate code on aarch64 - hostmakedepends+=" llvm17-devel" - depends+=" llvm17-devel" - ;; -esac - -# Recent safe to use tarball -# GHC's bundled tarball is from 2017, buggy on some archs -_ffi_rev=4d6d2866ae43e55325e8ee96561221804602cd7a - -if [ "$build_option_bindist" ]; then - # Required to make the binary distribution tarball - hostmakedepends+=" tar xz libtool libltdl-devel" - # Fetch a safe libffi tarball - distfiles+=" https://github.com/libffi/libffi/archive/${_ffi_rev}.tar.gz>libffi-${_ffi_rev}.tar.gz" - checksum+=" f7a17fa61261942e93450ec52272b5f09d8f42cfffd147867587f969ee01b739" - skip_extraction+=" libffi-${_ffi_rev}.tar.gz" + _configure_args+=" --with-system-libffi --disable-numa" + _configure_args+=" --target=${XBPS_CROSS_TRIPLET} --enable-unregistered" + _hadrian_args+=" --flavour=quick --docs=none --bignum=native" fi post_extract() { - [ "$build_option_bindist" ] || return 0 + if [ -e ${FILESDIR}/plan-bootstrap-${_ghc_ver}.json ]; then + cp "${FILESDIR}/plan-bootstrap-${_ghc_ver}.json" hadrian/bootstrap/ + fi +} - # update libffi for all bindists - rm -f libffi-tarballs/libffi-*.tar.gz - cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/libffi-${_ffi_rev}.tar.gz \ - libffi-tarballs - - [ "$CROSS_BUILD" ] || return 0 - - # create build config for cross bindists - local flav="quick" - - echo "BuildFlavour = ${flav}" >> mk/build.mk - cat mk/flavours/${flav}.mk >> mk/build.mk - - # gmp segfaults when cross-built - echo "INTEGER_LIBRARY = integer-simple" >> mk/build.mk - # otherwise needs ncurses for target - echo "WITH_TERMINFO = NO" >> mk/build.mk - # cannot be cross-compiled - echo "HADDOCK_DOCS = NO" >> mk/build.mk - # just wastes time - echo "BUILD_SPHINX_HTML = NO" >> mk/build.mk - echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk - echo "BUILD_MAN = NO" >> mk/build.mk +do_patch() { + if [ "$build_option_stage3" ]; then + sed -i 's/finalStage = Stage2/finalStage = Stage3/' hadrian/src/UserSettings.hs + fi } pre_configure() { - # stage0 and stage1 are built for build/host (which are the - # same in ghc) and stage2 is built for target (when cross) - export CONF_CC_OPTS_STAGE0=$CFLAGS_FOR_BUILD - export CONF_CC_OPTS_STAGE1=$CFLAGS_FOR_BUILD - export CONF_CC_OPTS_STAGE2=$CFLAGS - export CONF_GCC_LINKER_OPTS_STAGE0=$LDFLAGS_FOR_BUILD - export CONF_GCC_LINKER_OPTS_STAGE1=$LDFLAGS_FOR_BUILD - export CONF_GCC_LINKER_OPTS_STAGE2=$LDFLAGS - export CONF_CPP_OPTS_STAGE0=$CPPFLAGS_FOR_BUILD - export CONF_CPP_OPTS_STAGE1=$CPPFLAGS_FOR_BUILD - export CONF_CPP_OPTS_STAGE2=$CPPFLAGS + if [ ! -e hadrian/bootstrap/plan-bootstrap-${_ghc_ver}.json ]; then + # To generate a bootstrap plan for a new ghc version ensure a + # cabal binary is available, run this, then move the plan to + # ${FILESDIR} + cabal update + cd hadrian + cabal build --flags=-selftest --dry-run hadrian + cp dist-newstyle/cache/plan.json bootstrap/plan-${_ghc_ver}.json + cd bootstrap + cabal build hadrian-bootstrap-gen --allow-newer + cabal run -v0 hadrian-bootstrap-gen -- "plan-${_ghc_ver}.json" \ + | python3 -m json.tool > "plan-bootstrap-${_ghc_ver}.json" + msg_normal "Please install hadrian/bootstrap/plan-bootstrap-${_ghc_ver}.json in ${FILESDIR}\n" + exit 1 + else + cd hadrian/bootstrap + fi - autoreconf -fi + ./bootstrap.py -d plan-bootstrap-${_ghc_ver}.json } -post_install() { - sed -i 's#/usr/lib/ccache/bin/##g' ${DESTDIR}/usr/lib/ghc-${version%[!0-9]}/settings - vlicense LICENSE +do_configure() { + # GNU binutils ld does not work on ARM with haskell, see + # https://sourceware.org/bugzilla/show_bug.cgi?id=16177 + # ld.gold works but was removed from binutils in 2.44 + # So we set LD to CC and the configure script will set -fuse-ld to lld + export LD="$CC" + ./configure ${_configure_args} +} - local arch dest +do_build() { + ${_hadrian_cmd} ${makejobs} ${_hadrian_args} +} + +do_install() { + local arch targ if [ "$CROSS_BUILD" ]; then arch=${XBPS_CROSS_TRIPLET%%-*} + targ=ghc-${version}-${XBPS_CROSS_TRIPLET} else arch=${XBPS_TRIPLET%%-*} - fi - if [ "$XBPS_TARGET_LIBC" = "musl" ]; then - dest=ghc-${version}-${arch}-void-linux-musl.tar.xz - else - dest=ghc-${version}-${arch}-void-linux.tar.xz + targ=ghc-${version}-${arch}-unknown-linux fi if [ "$build_option_bindist" ]; then msg_normal "Creating binary distribution for ${XBPS_TARGET_MACHINE}...\n" - make ${makejobs} binary-dist + ${_hadrian_cmd} ${_hadrian_args} binary-dist mkdir -p ${XBPS_SRCDISTDIR}/distfiles - mv ghc-${version}-${arch}-unknown-linux.tar.xz ${dest} - install -m 0644 ${dest} ${XBPS_SRCDISTDIR}/distfiles + install -m 0644 _build/bindist/${targ}.tar.xz ${XBPS_SRCDISTDIR}/distfiles msg_normal "Installed in ${XBPS_SRCDISTDIR}/distfiles\n" exit 1 + else + DESTDIR=${DESTDIR} ${_hadrian_cmd} ${_hadrian_args} install fi } +post_install() { + vlicense LICENSE +} + ghc-doc_package() { - short_desc+=" -- documentation" + short_desc+=" - documentation" pkg_install() { vmove usr/share/doc } } + +ghc-devel_package() { + short_desc+=" - development files" + pkg_install() { + cd ${DESTDIR} + find usr/lib \( -type f -o -type l \) \( -name "*.p_*" -o -name "lib*_p.a" \) | while read f; do vmove "$f"; done + } +}