13 |
13 |
fi
|
14 |
14 |
fi
|
15 |
15 |
|
16 |
|
PYTHON_COMPAT=( python3_{9..11} )
|
|
16 |
PYTHON_COMPAT=( python3_{9..10} )
|
17 |
17 |
inherit python-any-r1
|
18 |
18 |
inherit autotools bash-completion-r1 flag-o-matic ghc-package
|
19 |
19 |
inherit multiprocessing pax-utils toolchain-funcs prefix
|
20 |
|
inherit check-reqs unpacker
|
|
20 |
inherit check-reqs llvm
|
21 |
21 |
DESCRIPTION="The Glasgow Haskell Compiler"
|
22 |
22 |
HOMEPAGE="https://www.haskell.org/ghc/"
|
23 |
23 |
|
... | ... | |
25 |
25 |
arch_binaries=""
|
26 |
26 |
|
27 |
27 |
BIN_PV=${PV}
|
28 |
|
[[ $PR != r0 ]] && BIN_REV=${PR}
|
29 |
28 |
|
30 |
29 |
# Differentiate glibc/musl
|
31 |
30 |
|
32 |
31 |
#glibc_binaries="$glibc_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
|
33 |
|
glibc_binaries+=" amd64? ( https://eidetic.codes/${PN}-bin-${PVR}-x86_64-pc-linux-gnu.gpkg.tar )"
|
|
32 |
glibc_binaries="$glibc_binaries amd64? ( https://eidetic.codes/ghc-bin-${PV}-x86_64-pc-linux-gnu-r1.tbz2 )"
|
34 |
33 |
#glibc_binaries="$glibc_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
|
35 |
|
#glibc_binaries="$glibc_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
|
|
34 |
glibc_binaries="$glibc_binaries arm64? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tar.gz )"
|
36 |
35 |
#glibc_binaries="$glibc_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
|
37 |
36 |
#glibc_binaries="$glibc_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
|
38 |
37 |
#glibc_binaries="$glibc_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
|
39 |
|
#glibc_binaries="$glibc_binaries ppc64? (
|
40 |
|
# big-endian? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64-unknown-linux-gnu.tar.gz )
|
41 |
|
# !big-endian? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tar.gz )
|
42 |
|
#)"
|
43 |
|
#glibc_binaries="$glibc_binaries riscv? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-riscv64-unknown-linux-gnu.tar.gz )"
|
|
38 |
glibc_binaries="$glibc_binaries ppc64? (
|
|
39 |
big-endian? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64-unknown-linux-gnu.tar.gz )
|
|
40 |
!big-endian? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tar.gz )
|
|
41 |
)"
|
|
42 |
glibc_binaries="$glibc_binaries riscv? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-riscv64-unknown-linux-gnu.tar.gz )"
|
44 |
43 |
#glibc_binaries="$glibc_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
|
45 |
|
glibc_binaries+=" x86? ( https://eidetic.codes/${PN}-bin-${PVR}-i686-pc-linux-gnu.gpkg.tar )"
|
|
44 |
glibc_binaries="$glibc_binaries x86? ( https://eidetic.codes/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
|
46 |
45 |
|
47 |
46 |
#musl_binaries="$musl_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
|
48 |
|
#musl_binaries="$musl_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-musl.tbz2 )"
|
|
47 |
#musl_binaries="$musl_binaries amd64? ( https://eidetic.codes/ghc-bin-${PV}-x86_64-pc-linux-musl.tbz2 )"
|
49 |
48 |
#musl_binaries="$musl_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-musl.tbz2 )"
|
50 |
49 |
#musl_binaries="$musl_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-musl.tbz2 )"
|
51 |
50 |
#musl_binaries="$musl_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
|
... | ... | |
54 |
53 |
#musl_binaries="$musl_binaries ppc64? ( !big-endian? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64le-unknown-linux-musl.tar.gz ) )"
|
55 |
54 |
#musl_binaries="$musl_binaries riscv? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-riscv64-unknown-linux-musl.tar.gz )"
|
56 |
55 |
#musl_binaries="$musl_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
|
57 |
|
#musl_binaries="$musl_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-musl.tbz2 )"
|
|
56 |
#musl_binaries="$musl_binaries x86? ( https://eidetic.codes/ghc-bin-${PV}-i686-pc-linux-musl.tbz2 )"
|
58 |
57 |
|
59 |
|
[[ -n $glibc_binaries ]] && arch_binaries+=" elibc_glibc? ( $glibc_binaries )"
|
60 |
|
[[ -n $musl_binaries ]] && arch_binaries+=" elibc_musl? ( $musl_binaries )"
|
|
58 |
[[ -n $glibc_binaries ]] && arch_binaries="$arch_binaries elibc_glibc? ( $glibc_binaries )"
|
|
59 |
[[ -n $musl_binaries ]] && arch_binaries="$arch_binaries elibc_musl? ( $musl_binaries )"
|
61 |
60 |
|
62 |
61 |
# various ports:
|
63 |
62 |
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
|
... | ... | |
68 |
67 |
glibc)
|
69 |
68 |
case "${ARCH}" in
|
70 |
69 |
#alpha) return 0 ;;
|
71 |
|
#arm64) return 0 ;;
|
|
70 |
arm64) return 0 ;;
|
72 |
71 |
#arm) return 0 ;;
|
73 |
72 |
amd64) return 0 ;;
|
74 |
73 |
#ia64) return 0 ;;
|
75 |
74 |
#ppc) return 0 ;;
|
76 |
|
#ppc64) return 0 ;;
|
77 |
|
#riscv) return 0 ;;
|
|
75 |
ppc64) return 0 ;;
|
|
76 |
riscv) return 0 ;;
|
78 |
77 |
#sparc) return 0 ;;
|
79 |
78 |
x86) return 0 ;;
|
80 |
79 |
*) return 1 ;;
|
... | ... | |
97 |
96 |
*) return 1 ;;
|
98 |
97 |
esac
|
99 |
98 |
;;
|
100 |
|
*) return 1 ;;
|
101 |
99 |
esac
|
102 |
100 |
}
|
103 |
101 |
|
... | ... | |
109 |
107 |
https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-src.tar.xz
|
110 |
108 |
test? ( https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
|
111 |
109 |
)"
|
|
110 |
SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-riscv64-llvm.patch.xz"
|
|
111 |
|
112 |
112 |
S="${WORKDIR}"/${GHC_P}
|
113 |
113 |
|
114 |
114 |
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
|
115 |
115 |
|
116 |
116 |
BUMP_LIBRARIES=(
|
117 |
117 |
# "hackage-name hackage-version"
|
118 |
|
"process 1.6.16.0"
|
119 |
118 |
)
|
120 |
119 |
|
121 |
120 |
LICENSE="BSD"
|
122 |
121 |
SLOT="0/${PV}"
|
123 |
|
KEYWORDS="~amd64 ~x86"
|
124 |
|
IUSE="big-endian +doc elfutils ghcbootstrap ghcmakebinary +gmp numa profile test"
|
|
122 |
KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
|
|
123 |
IUSE="big-endian +doc elfutils ghcbootstrap ghcmakebinary +gmp llvm numa profile test unregisterised"
|
125 |
124 |
IUSE+=" binary"
|
126 |
125 |
RESTRICT="!test? ( test )"
|
127 |
126 |
|
|
127 |
LLVM_MAX_SLOT="14"
|
128 |
128 |
RDEPEND="
|
129 |
129 |
>=dev-lang/perl-5.6.1
|
130 |
130 |
dev-libs/gmp:0=
|
131 |
131 |
sys-libs/ncurses:=[unicode(+)]
|
132 |
132 |
elfutils? ( dev-libs/elfutils )
|
133 |
|
!ghcmakebinary? ( dev-libs/libffi:=[-exec-static-trampoline] )
|
|
133 |
!ghcmakebinary? ( dev-libs/libffi:= )
|
134 |
134 |
numa? ( sys-process/numactl )
|
|
135 |
llvm? (
|
|
136 |
<sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=
|
|
137 |
|| (
|
|
138 |
sys-devel/llvm:14
|
|
139 |
)
|
|
140 |
)
|
135 |
141 |
"
|
136 |
142 |
|
137 |
143 |
# This set of dependencies is needed to run
|
... | ... | |
172 |
178 |
REQUIRED_USE="
|
173 |
179 |
?? ( ghcbootstrap binary )
|
174 |
180 |
?? ( profile binary )
|
|
181 |
?? ( llvm unregisterised )
|
175 |
182 |
"
|
176 |
183 |
|
177 |
184 |
# haskell libraries built with cabal in configure mode, #515354
|
... | ... | |
316 |
323 |
for flag in ${LDFLAGS}; do
|
317 |
324 |
append-ghc-cflags link ${flag}
|
318 |
325 |
done
|
319 |
|
|
320 |
|
# GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
|
321 |
|
# Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
|
322 |
|
# options to gcc.
|
323 |
|
if is_native; then
|
324 |
|
# prevent from failing to build unregisterised ghc:
|
325 |
|
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
|
326 |
|
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
|
327 |
|
fi
|
328 |
326 |
}
|
329 |
327 |
|
330 |
328 |
# substitutes string $1 to $2 in files $3 $4 ...
|
... | ... | |
409 |
407 |
"$@"
|
410 |
408 |
}
|
411 |
409 |
|
|
410 |
llvmize() {
|
|
411 |
[[ -z "${1}" ]] && return
|
|
412 |
( find "${1}" -type f \
|
|
413 |
| file -if- \
|
|
414 |
| grep "text/x-shellscript" \
|
|
415 |
| awk -F: '{print $1}' \
|
|
416 |
| xargs sed -i "s#^exec #PATH=\"$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin:\${PATH}\" exec #") || die
|
|
417 |
}
|
|
418 |
|
412 |
419 |
pkg_pretend() {
|
413 |
420 |
ghc-check-reqs check-reqs_pkg_pretend
|
414 |
421 |
}
|
... | ... | |
438 |
445 |
if needs_python; then
|
439 |
446 |
python-any-r1_pkg_setup
|
440 |
447 |
fi
|
|
448 |
|
|
449 |
use llvm && llvm_pkg_setup
|
441 |
450 |
}
|
442 |
451 |
|
443 |
452 |
src_unpack() {
|
... | ... | |
450 |
459 |
case ${CHOST} in
|
451 |
460 |
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
|
452 |
461 |
esac
|
453 |
|
unpacker ${ONLYA}
|
|
462 |
unpack ${ONLYA}
|
454 |
463 |
}
|
455 |
464 |
|
456 |
465 |
src_prepare() {
|
... | ... | |
461 |
470 |
|
462 |
471 |
ghc_setup_cflags
|
463 |
472 |
|
464 |
|
if ! use ghcbootstrap; then
|
465 |
|
# The switch to gpkg binaries means that they are unpacked in the wrong
|
466 |
|
# location. They are now unnpacked in the $orig_bindir and need to be
|
467 |
|
# moved so that usr/ is in $WORKDIR.
|
468 |
|
local orig_bindir="${WORKDIR}/${PN}-${BIN_PV}${BIN_REV:+-${BIN_REV}}"
|
469 |
|
mv -v "${orig_bindir}/image/usr" "${WORKDIR}" || die
|
470 |
|
|
471 |
|
if [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
|
472 |
|
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
|
473 |
|
# See bug #313635.
|
474 |
|
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
|
475 |
|
"${WORKDIR}/usr/bin/ghc-${BIN_PV}"
|
476 |
|
|
477 |
|
# allow hardened users use vanilla binary to bootstrap ghc
|
478 |
|
# ghci uses mmap with rwx protection at it implements dynamic
|
479 |
|
# linking on it's own (bug #299709)
|
480 |
|
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
|
481 |
|
fi
|
|
473 |
# ghc-9.0.2 release anomaly
|
|
474 |
# https://www.mail-archive.com/search?l=ghc-devs@haskell.org&q=subject:%22Re%5C%3A+%5C%5BHaskell%5C%5D+%5C%5BANNOUNCE%5C%5D+GHC+9.0.2+released%22&o=newest&f=1
|
|
475 |
# https://src.fedoraproject.org/rpms/ghc9.0/blob/rawhide/f/ghc9.0.spec#_327
|
|
476 |
rm -rf "libraries/containers/containers/dist-install" || die
|
|
477 |
|
|
478 |
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
|
|
479 |
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
|
|
480 |
# See bug #313635.
|
|
481 |
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
|
|
482 |
"${WORKDIR}/usr/bin/ghc-${BIN_PV}"
|
|
483 |
|
|
484 |
# allow hardened users use vanilla binary to bootstrap ghc
|
|
485 |
# ghci uses mmap with rwx protection at it implements dynamic
|
|
486 |
# linking on it's own (bug #299709)
|
|
487 |
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
|
|
488 |
fi
|
|
489 |
|
|
490 |
use llvm && ! use ghcbootstrap && llvmize "${WORKDIR}/usr/bin"
|
|
491 |
|
|
492 |
# binpkg may have been built with FEATURES=splitdebug
|
|
493 |
if [[ -d "${WORKDIR}/usr/lib/debug" ]] ; then
|
|
494 |
rm -rf "${WORKDIR}/usr/lib/debug" || die
|
482 |
495 |
fi
|
|
496 |
find "${WORKDIR}/usr/lib" -type d -empty -delete 2>/dev/null # do not die on failure here
|
|
497 |
|
|
498 |
# ffi headers don't get included in the binpkg for some reason
|
|
499 |
for f in "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/include/"{ffi.h,ffitarget.h}
|
|
500 |
do
|
|
501 |
mkdir -p "$(dirname "${f}")"
|
|
502 |
[[ -e "${f}" ]] || ln -sf "$($(tc-getPKG_CONFIG) --cflags-only-I libffi | sed "s/-I//g" | tr -d " ")/$(basename "${f}")" "${f}" || die
|
|
503 |
done
|
|
504 |
|
|
505 |
eapply "${FILESDIR}"/${PN}-9.0.2-sphinx-6.patch
|
483 |
506 |
|
484 |
507 |
if use binary; then
|
485 |
508 |
if use prefix; then
|
... | ... | |
549 |
572 |
|
550 |
573 |
cd "${S}" # otherwise eapply will break
|
551 |
574 |
|
552 |
|
eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
|
553 |
|
eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
|
554 |
|
eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
|
555 |
|
eapply "${FILESDIR}"/${PN}-8.8.1-revert-CPP.patch
|
|
575 |
eapply "${FILESDIR}"/${PN}-9.0.2-CHOST-prefix.patch
|
|
576 |
eapply "${FILESDIR}"/${PN}-9.0.2-darwin.patch
|
|
577 |
# Fixes panic when compiling some packages
|
|
578 |
# https://github.com/gentoo-haskell/gentoo-haskell/issues/1250#issuecomment-1044257595
|
|
579 |
# https://gitlab.haskell.org/ghc/ghc/-/issues/21097
|
|
580 |
eapply "${FILESDIR}/${PN}-9.0.2-modorigin-semigroup.patch"
|
|
581 |
# Needed for testing with python-3.10
|
|
582 |
use test && eapply "${FILESDIR}/${PN}-9.0.2-fix-tests-python310.patch"
|
556 |
583 |
eapply "${FILESDIR}"/${PN}-8.10.1-allow-cross-bootstrap.patch
|
557 |
|
eapply "${FILESDIR}"/${PN}-8.10.5-modorigin-verbose-conflict.patch
|
558 |
|
eapply "${FILESDIR}"/${PN}-8.10.6-aclocal.patch
|
559 |
|
eapply "${FILESDIR}"/${PN}-9.0.2-sphinx-6.patch
|
560 |
|
|
561 |
|
# a bunch of crosscompiler patches
|
562 |
|
# needs newer version:
|
563 |
|
#eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
|
|
584 |
eapply "${FILESDIR}"/${PN}-9.0.2-disable-unboxed-arrays.patch
|
|
585 |
eapply "${FILESDIR}"/${PN}-9.0.2-llvm-13.patch
|
|
586 |
eapply "${FILESDIR}"/${PN}-9.0.2-llvm-14.patch
|
|
587 |
eapply "${FILESDIR}"/latomic-subword
|
|
588 |
eapply "${WORKDIR}"/${P}-riscv64-llvm.patch
|
|
589 |
eapply "${FILESDIR}"/${PN}-9.0.2-fptools.patch # clang-16 workaround
|
564 |
590 |
|
565 |
591 |
# mingw32 target
|
566 |
592 |
pushd "${S}/libraries/Win32"
|
... | ... | |
639 |
665 |
export PATH="${WORKDIR}/usr/bin:${PATH}"
|
640 |
666 |
fi
|
641 |
667 |
|
642 |
|
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
|
|
668 |
echo "BIGNUM_BACKEND = $(usex gmp gmp native)" >> mk/build.mk
|
643 |
669 |
|
644 |
670 |
# don't strip anything. Very useful when stage2 SIGSEGVs on you
|
645 |
671 |
echo "STRIP_CMD = :" >> mk/build.mk
|
... | ... | |
708 |
734 |
econf ${econf_args[@]} \
|
709 |
735 |
--enable-bootstrap-with-devel-snapshot \
|
710 |
736 |
$(use_enable elfutils dwarf-unwind) \
|
711 |
|
$(use_enable numa)
|
|
737 |
$(use_enable numa) \
|
|
738 |
$(use_enable unregisterised)
|
712 |
739 |
|
713 |
740 |
if [[ ${PV} == *9999* ]]; then
|
714 |
741 |
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
|
... | ... | |
765 |
792 |
# '/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404': No such file or directory
|
766 |
793 |
emake -j1 install DESTDIR="${D}"
|
767 |
794 |
|
|
795 |
use llvm && llvmize "${ED}/usr/bin"
|
|
796 |
|
768 |
797 |
# Skip for cross-targets as they all share target location:
|
769 |
798 |
# /usr/share/doc/ghc-9999/
|
770 |
799 |
if ! is_crosscompile; then
|