Sync with portage [Mon Mar 15 00:02:43 MSK 2021].

akrasnyh 1907
Calculate Linux 3 years ago
parent 515506e34e
commit a07c50ca42

Binary file not shown.

Binary file not shown.

@ -1 +1 @@
DIST lastpass-binary-component-4.19.0.tar.bz2 1625255 BLAKE2B 714fb34708f9dda8dbacfce8e76adf004f1cc966d685c0efbaac7b25c45068bb5595e954e554092852d575f1fedc5f318d05b121bc2ce1aa4888e4bf374f7b96 SHA512 2535d72c5b545b364dd1e91503590cafa16d3de4f4745c4f1fa236135580e2af47094e364a7f0ebde5fcfd11282ab9329ef333866a985f02a873e092aabb9b22 DIST lastpass-binary-component-4.67.1.tar.bz2 1625199 BLAKE2B cd9333866516a0dc43b653106224e5ef1a228c340adac93a2541d4f337b6b865c5eed043cf914a552b390d23a471ff1f21f8439d15282b77fb69dcbd6ffa01c1 SHA512 8277082fcf4cb8ef0f67903f518eb1b55fd6525373f22be0ce7d62abedef76029ef46da7c0aa32d4df3bbc0053471232390ecd69ff0572a3836e08aefee98e48

@ -1,4 +1,4 @@
# Copyright 1999-2020 Gentoo Authors # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=7 EAPI=7

@ -1,2 +1,2 @@
DIST sudo-1.9.5p2.tar.gz 4012277 BLAKE2B 41913887463e4f775564af8d614fb5ed762200aa777dc789ec333842d4f432323474fc952a531fe929b33607cdfbcd18d7fe7470a15d67139deaf855841ed11f SHA512 f0fe914963c31a6f8ab6c86847ff6cdd125bd5a839b27f46dcae03963f4fc413b3d4cca54c1979feb825c8479b44c7df0642c07345c941eecf6f9f1e03ea0e27 DIST sudo-1.9.5p2.tar.gz 4012277 BLAKE2B 41913887463e4f775564af8d614fb5ed762200aa777dc789ec333842d4f432323474fc952a531fe929b33607cdfbcd18d7fe7470a15d67139deaf855841ed11f SHA512 f0fe914963c31a6f8ab6c86847ff6cdd125bd5a839b27f46dcae03963f4fc413b3d4cca54c1979feb825c8479b44c7df0642c07345c941eecf6f9f1e03ea0e27
DIST sudo-1.9.6rc1.tar.gz 4122708 BLAKE2B b6f3cee7c1b6d7c83ea83ffa38e5a27abc4add4b82c2f3481dcdef6e68bd768903341082caad77447d860da0864ab63fd1c054d2db0f55d161874f17dbd695cd SHA512 836ca8ec5b33ed59cb3192e7eacabb85afebf22b7706a917f0a4cfcb41996cbbfe709329edcbd5f55a672bd57dde73dd4eca50700b0f0bcafcc4fef969a55e38 DIST sudo-1.9.6.tar.gz 4118872 BLAKE2B fa3a3cb47540f6f926a292f81e4a18358e31fe11d0a63cb8560f26fc85a5e82830752f3352466a5dd67787f5e0760f035f8787bd2241034f351cb5905a98100d SHA512 16291bd7290284272efe675f8b94218540224217f03d96bbb7bcbe6c9d5b7453ff6b24fd28dcbce2fdee59cc8adb9798f4f13272bd25592abc17caa77236dfa3

Binary file not shown.

@ -8,7 +8,7 @@ inherit flag-o-matic
DESCRIPTION="Standard GNU compressor" DESCRIPTION="Standard GNU compressor"
HOMEPAGE="https://www.gnu.org/software/gzip/" HOMEPAGE="https://www.gnu.org/software/gzip/"
SRC_URI="mirror://gnu/gzip/${P}.tar.xz SRC_URI="mirror://gnu/gzip/${P}.tar.xz
mirror://gnu-alpha/gzip/${P}.tar.xz https://alpha.gnu.org/gnu/gzip/${P}.tar.xz
mirror://gentoo/${P}.tar.xz" mirror://gentoo/${P}.tar.xz"
LICENSE="GPL-3" LICENSE="GPL-3"

@ -8,7 +8,7 @@ inherit flag-o-matic
DESCRIPTION="Standard GNU compressor" DESCRIPTION="Standard GNU compressor"
HOMEPAGE="https://www.gnu.org/software/gzip/" HOMEPAGE="https://www.gnu.org/software/gzip/"
SRC_URI="mirror://gnu/gzip/${P}.tar.xz SRC_URI="mirror://gnu/gzip/${P}.tar.xz
mirror://gnu-alpha/gzip/${P}.tar.xz https://alpha.gnu.org/gnu/gzip/${P}.tar.xz
mirror://gentoo/${P}.tar.xz" mirror://gentoo/${P}.tar.xz"
LICENSE="GPL-3" LICENSE="GPL-3"

@ -8,7 +8,7 @@ inherit flag-o-matic
DESCRIPTION="Use this to make tarballs :)" DESCRIPTION="Use this to make tarballs :)"
HOMEPAGE="https://www.gnu.org/software/tar/" HOMEPAGE="https://www.gnu.org/software/tar/"
SRC_URI="mirror://gnu/tar/${P}.tar.bz2 SRC_URI="mirror://gnu/tar/${P}.tar.bz2
mirror://gnu-alpha/tar/${P}.tar.bz2" https://alpha.gnu.org/gnu/tar/${P}.tar.bz2"
LICENSE="GPL-3+" LICENSE="GPL-3+"
SLOT="0" SLOT="0"

@ -8,7 +8,7 @@ inherit flag-o-matic
DESCRIPTION="Use this to make tarballs :)" DESCRIPTION="Use this to make tarballs :)"
HOMEPAGE="https://www.gnu.org/software/tar/" HOMEPAGE="https://www.gnu.org/software/tar/"
SRC_URI="mirror://gnu/tar/${P}.tar.xz SRC_URI="mirror://gnu/tar/${P}.tar.xz
mirror://gnu-alpha/tar/${P}.tar.xz" https://alpha.gnu.org/gnu/tar/${P}.tar.xz"
LICENSE="GPL-3+" LICENSE="GPL-3+"
SLOT="0" SLOT="0"

@ -8,7 +8,7 @@ inherit flag-o-matic
DESCRIPTION="Use this to make tarballs :)" DESCRIPTION="Use this to make tarballs :)"
HOMEPAGE="https://www.gnu.org/software/tar/" HOMEPAGE="https://www.gnu.org/software/tar/"
SRC_URI="mirror://gnu/tar/${P}.tar.xz SRC_URI="mirror://gnu/tar/${P}.tar.xz
mirror://gnu-alpha/tar/${P}.tar.xz" https://alpha.gnu.org/gnu/tar/${P}.tar.xz"
LICENSE="GPL-3+" LICENSE="GPL-3+"
SLOT="0" SLOT="0"

Binary file not shown.

@ -1,5 +1,2 @@
DIST duply_1.11.3.tgz 44198 BLAKE2B 368c8a5d145068da00fccb970188bc64574365517211d3eca253c34f820dd520777f56ebc0dfddeca2fc910558e73bf6a2adac6287422b47d5a5751d43a74b86 SHA512 5817d4571c27288b227add04e84fa0066e278cdbc819a9332cb6fa2aaf6609e923abe9824ac704fed250b961300c57ca1de945af03370287f7cbf68876513457
DIST duply_2.0.1.tgz 44914 BLAKE2B 022a99e585a6231e85af84ae161988037fecf885a2a97d078e1a64b2176268ea6ef3c68e4843a967715ff362e8f24826cd800f0c1b32c4b187f5261d2b9cad67 SHA512 28f1670f2579956cb4d0d5727403e8b9f4afcdd8ea79e117536dfb89b3f3cf6a7bc7eb802bc4dcd39fc6a443a9f8fa3fe722f2b8336186517184940ce6fa73ec
DIST duply_2.0.2.tgz 45406 BLAKE2B 46299930a2e05c5d3759e7a90a6bab8b41b28bdab95c945f1bbb5977d78cf5b72090edfb10bd69b2539c65b7c3804d45eb6b400866c6337fc4acdc283f8003e0 SHA512 2f53d380445272a2354f6914c39373e93d27fdcc5c712d7041fc798547280cebff53882f93d0467d86fc044b8a3a73a6b2fe04a9eaadae55b58bc9c617bab48a
DIST duply_2.0.3.tgz 45542 BLAKE2B 101e19712546c71af16f5988f1d1a70139414b03fa6abcf9b82b8a656a9fd7385b4c9f524eb0e62e3af1b9d0b9a494e47505f2c829d39745c8b88ce56e6608a6 SHA512 c24dd57f75ab80795d67baf8a7ab79a5ae9608c7faea0ae8b711045371ef0cba49c855cfa0610f030c1c37734775b50052fd1e4162420cb3db624f984e4e8bc1
DIST duply_2.2.2.tgz 50848 BLAKE2B d24c88c57a1a1da83827fbda3ba73249bea96de3b9503b842357182e871ac519b609d6d05d5972cd9a268354fd4d9db87d57680d478714e5f19256b70f23fa42 SHA512 2c072f3812989d2d20f9698b5a59eebe5ca8d45eda25622b9e9903748c8fa18374f8d64e0897b7587f62a6a292b277302d15c6785c6b4dd96e127162a5dae358 DIST duply_2.2.2.tgz 50848 BLAKE2B d24c88c57a1a1da83827fbda3ba73249bea96de3b9503b842357182e871ac519b609d6d05d5972cd9a268354fd4d9db87d57680d478714e5f19256b70f23fa42 SHA512 2c072f3812989d2d20f9698b5a59eebe5ca8d45eda25622b9e9903748c8fa18374f8d64e0897b7587f62a6a292b277302d15c6785c6b4dd96e127162a5dae358
DIST duply_2.3.1.tgz 51531 BLAKE2B b351d57621cc24cdacf9c0b54c107e4b9caad5da31401534f8add0ae320e5d0534fff9f97fa685f76efcc90b9e6b3a18e87a1d11b90285410cdd3375aa8b5c56 SHA512 90f6172e196667c1bf35d4b0acd5759ccfa34a1b7cacdbcf502a67689b7698fca4e4a9ce419b42b70eb57fb784a7c789e2283a8ac366bade9aec25c393548ef8

@ -1,28 +0,0 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit readme.gentoo-r1
DESCRIPTION="A shell frontend for duplicity"
HOMEPAGE="http://duply.net"
SRC_URI="mirror://sourceforge/project/ftplicity/duply%20%28simple%20duplicity%29/1.11.x/${PN}_${PV}.tgz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND="app-text/txt2man"
RDEPEND="app-backup/duplicity"
S=${WORKDIR}/${PN}_${PV}
src_install() {
dobin ${PN}
./${PN} txt2man > ${PN}.1 || die
doman ${PN}.1
dodoc CHANGELOG.txt
readme.gentoo_create_doc
}

@ -1,28 +0,0 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit readme.gentoo-r1
DESCRIPTION="A shell frontend for duplicity"
HOMEPAGE="http://duply.net"
SRC_URI="mirror://sourceforge/project/ftplicity/duply%20%28simple%20duplicity%29/2.0.x/${PN}_${PV}.tgz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND="app-text/txt2man"
RDEPEND="app-backup/duplicity"
S=${WORKDIR}/${PN}_${PV}
src_install() {
dobin ${PN}
./${PN} txt2man > ${PN}.1 || die
doman ${PN}.1
dodoc CHANGELOG.txt
readme.gentoo_create_doc
}

@ -1,28 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit readme.gentoo-r1
DESCRIPTION="A shell frontend for duplicity"
HOMEPAGE="http://duply.net"
SRC_URI="mirror://sourceforge/project/ftplicity/duply%20%28simple%20duplicity%29/2.0.x/${PN}_${PV}.tgz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND="app-text/txt2man"
RDEPEND="app-backup/duplicity"
S=${WORKDIR}/${PN}_${PV}
src_install() {
dobin ${PN}
./${PN} txt2man > ${PN}.1 || die
doman ${PN}.1
dodoc CHANGELOG.txt
readme.gentoo_create_doc
}

@ -1,28 +1,24 @@
# Copyright 1999-2017 Gentoo Foundation # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=6 EAPI=7
inherit readme.gentoo-r1
DESCRIPTION="A shell frontend for duplicity" DESCRIPTION="A shell frontend for duplicity"
HOMEPAGE="http://duply.net" HOMEPAGE="https://duply.net"
SRC_URI="mirror://sourceforge/project/ftplicity/duply%20%28simple%20duplicity%29/2.0.x/${PN}_${PV}.tgz" SRC_URI="https://jztkft.dl.sourceforge.net/project/ftplicity/${PN}%20%28simple%20duplicity%29/2.3.x/${PN}_${PV}.tgz"
LICENSE="GPL-2" LICENSE="GPL-2"
SLOT="0" SLOT="0"
KEYWORDS="~amd64 ~x86" KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND="app-text/txt2man" BDEPEND="app-text/txt2man"
RDEPEND="app-backup/duplicity" RDEPEND="app-backup/duplicity"
S=${WORKDIR}/${PN}_${PV} S="${WORKDIR}/${PN}_${PV}"
src_install() { src_install() {
dobin ${PN} dobin ${PN}
./${PN} txt2man > ${PN}.1 || die ./${PN} txt2man > ${PN}.1 || die
doman ${PN}.1 doman ${PN}.1
dodoc CHANGELOG.txt dodoc CHANGELOG.txt
readme.gentoo_create_doc
} }

@ -1,8 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata> <pkgmetadata>
<!-- maintainer-needed --> <maintainer type="person">
<upstream> <email>marco@scardovi.com</email>
<remote-id type="sourceforge">ftplicity</remote-id> <name>Marco Scardovi</name>
</upstream> </maintainer>
<maintainer type="project">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<upstream>
<remote-id type="sourceforge">ftplicity</remote-id>
</upstream>
</pkgmetadata> </pkgmetadata>

Binary file not shown.

@ -1,2 +1 @@
DIST veracrypt-1.24_p7.tar.gz 25113248 BLAKE2B 8ead3325ce6fadf4ca8211ea45daaa82a655f29006f224235f44200839289d42fabe84da2e731fc6a169a7d157535c719b2cd9294524e68532c0065e41ed733c SHA512 d149736d4d6740a89bfce892f44757600c6411776b471a208a75b4573bbc6125535ef1b68c2f55903ff82f4d0fff13b8b07d3cf15c7a301c39158aefffc29e17
DIST veracrypt-1.24_p8.tar.gz 25116825 BLAKE2B fccab3e7de7637f6f3a7f448a9dcc6671198ea6155e8f6741844c5bd844819c639f968e4cc6e13c274c90f2ba8e540a020b98cb12617a109d5911ce8dd9cb991 SHA512 16139d055e2b2dda6c38ecf156cf5d15cd4788253fe0c85e42050eafd8afbd5c5908e590e53a7b5220767ebbb3b9e81d0049a910b322e42f1c29d2c131bd29d0 DIST veracrypt-1.24_p8.tar.gz 25116825 BLAKE2B fccab3e7de7637f6f3a7f448a9dcc6671198ea6155e8f6741844c5bd844819c639f968e4cc6e13c274c90f2ba8e540a020b98cb12617a109d5911ce8dd9cb991 SHA512 16139d055e2b2dda6c38ecf156cf5d15cd4788253fe0c85e42050eafd8afbd5c5908e590e53a7b5220767ebbb3b9e81d0049a910b322e42f1c29d2c131bd29d0

@ -1,101 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit desktop eapi7-ver linux-info pax-utils toolchain-funcs wxwidgets
MY_PV="$(ver_cut 1-2)-Update$(ver_cut 4)"
DESCRIPTION="Disk encryption with strong security based on TrueCrypt"
HOMEPAGE="https://www.veracrypt.fr/en/Home.html"
SRC_URI="https://github.com/${PN}/VeraCrypt/archive/VeraCrypt_${MY_PV}.tar.gz -> ${P}.tar.gz"
# The modules not linked against in Linux include (but not limited to):
# libzip, chacha-xmm, chacha256, chachaRng, rdrand, t1ha2
# Tested by actually removing the source files and performing a build
# For this reason, we don't have to worry about their licenses
LICENSE="Apache-2.0 BSD truecrypt-3.0"
SLOT="0"
KEYWORDS="amd64"
IUSE="+asm cpu_flags_x86_sse2 cpu_flags_x86_sse4_1 cpu_flags_x86_ssse3 doc X"
RESTRICT="bindist mirror"
WX_GTK_VER="3.0-gtk3"
RDEPEND="
sys-fs/lvm2
sys-fs/fuse:0
x11-libs/wxGTK:${WX_GTK_VER}[X?]
app-admin/sudo
dev-libs/pkcs11-helper
"
DEPEND="
${RDEPEND}
virtual/pkgconfig
asm? ( dev-lang/yasm )
"
S="${WORKDIR}/VeraCrypt-VeraCrypt_${MY_PV}/src"
pkg_setup() {
local CONFIG_CHECK="~BLK_DEV_DM ~CRYPTO ~CRYPTO_XTS ~DM_CRYPT ~FUSE_FS"
linux-info_pkg_setup
setup-wxwidgets
}
src_compile() {
local myemakeargs=(
NOSTRIP=1
NOTEST=1
VERBOSE=1
CC="$(tc-getCC)"
CXX="$(tc-getCXX)"
AR="$(tc-getAR)"
RANLIB="$(tc-getRANLIB)"
TC_EXTRA_CFLAGS="${CFLAGS}"
TC_EXTRA_CXXFLAGS="${CXXFLAGS}"
TC_EXTRA_LFLAGS="${LDFLAGS}"
WX_CONFIG="${WX_CONFIG}"
$(usex X "" "NOGUI=1")
$(usex asm "" "NOASM=1")
$(usex cpu_flags_x86_sse2 "" "NOSSE2=1")
$(usex cpu_flags_x86_sse4_1 "SSE41=1" "")
$(usex cpu_flags_x86_ssse3 "SSSE3=1" "")
)
emake "${myemakeargs[@]}"
}
src_test() {
"${S}/Main/veracrypt" --text --test || die "tests failed"
}
src_install() {
local DOCS=( Readme.txt )
local HTML_DOCS=( )
dobin Main/veracrypt
if use doc; then
DOCS+=( "${S}"/../doc/EFI-DCS )
docompress -x "/usr/share/doc/${PF}/EFI-DCS"
HTML_DOCS+=( "${S}"/../doc/html/. )
fi
einstalldocs
newinitd "${FILESDIR}/${PN}.init" ${PN}
if use X; then
local s
for s in 16 48 128 256; do
newicon -s ${s} Resources/Icons/VeraCrypt-${s}x${s}.xpm veracrypt.xpm
done
make_desktop_entry ${PN} "VeraCrypt" ${PN} "Utility;Security"
fi
pax-mark -m "${D%/}/usr/bin/veracrypt"
}
pkg_postinst() {
ewarn "VeraCrypt has a very restrictive license. Please be explicitly aware"
ewarn "of the limitations on redistribution of binaries or modified source."
}

@ -1 +1,2 @@
DIST yubikey-manager-3.1.1.tar.gz 116632 BLAKE2B 252c419280143fa6f44daf3de8ec27bbdc3218e4552e39799e1daca5b46939c4042ae1d43abeab110fe1abaf2e87d94c270442ee6fce05e26927add5b34e9f66 SHA512 8229d5442ddf89fe90abb0153aa005cb0d149a84634b994dc283f7cbac2f72d4b913c238c277c6aa07f431aed8905008aeb11e594e730be71c9ca88150a6ef68 DIST yubikey-manager-3.1.2.tar.gz 116728 BLAKE2B 35b592a26bbe1c2a1c81ddbc5fd5de2693b01dbadd04dd317baa14e5f9c5556ff8622bc36e31983947b4eed272be16d8ae1d55c6e30fe5532c20605c784411c5 SHA512 e7ad46536fae0476ae7ea4d7115ba9ddb0fe158fcd1e1d548524860b2033996f5487f9c948df85586d5b7ea690b51ad8d5b43261a56aa8820940226e0b18acaa
DIST yubikey-manager-4.0.0.tar.gz 137438 BLAKE2B df50113ed46c531032785ceb95ee130a2440f88677b088f70095545528cbceff55db483bc299654beb8d78b3cea94a9c8507751a090a8488cc609680167ec8d7 SHA512 f1684122a9ee8d57fa3644ecf140e39973c822dfcb7cc1d6578a2ef9b09ff9b0078e6e4ab3f0eb6522a08703d095027f9f24bc8ca6fff8b6874f7a9b5e99f1b2

@ -22,7 +22,7 @@ RDEPEND="
dev-python/click[${PYTHON_USEDEP}] dev-python/click[${PYTHON_USEDEP}]
dev-python/cryptography[${PYTHON_USEDEP}] dev-python/cryptography[${PYTHON_USEDEP}]
>=dev-python/fido2-0.7.0[${PYTHON_USEDEP}] >=dev-python/fido2-0.7.0[${PYTHON_USEDEP}]
<dev-python/fido2-0.8.0[${PYTHON_USEDEP}] <dev-python/fido2-0.9.0[${PYTHON_USEDEP}]
dev-python/pyopenssl[${PYTHON_USEDEP}] dev-python/pyopenssl[${PYTHON_USEDEP}]
dev-python/pyscard[${PYTHON_USEDEP}] dev-python/pyscard[${PYTHON_USEDEP}]
dev-python/pyusb[${PYTHON_USEDEP}] dev-python/pyusb[${PYTHON_USEDEP}]

@ -0,0 +1,50 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{7,8,9} )
DISTUTILS_USE_SETUPTOOLS=pyproject.toml
inherit readme.gentoo-r1 distutils-r1
DESCRIPTION="Python library and command line tool for configuring a YubiKey"
HOMEPAGE="https://developers.yubico.com/yubikey-manager/"
# Per https://github.com/Yubico/yubikey-manager/issues/217, Yubico is
# the official source for tarballs, not Github
SRC_URI="https://developers.yubico.com/${PN}/Releases/${P}.tar.gz"
LICENSE="BSD-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
RESTRICT="test" # Tests require non-existing package makefun
RDEPEND="
dev-python/click[${PYTHON_USEDEP}]
dev-python/cryptography[${PYTHON_USEDEP}]
dev-python/fido2:0/0.9[${PYTHON_USEDEP}]
dev-python/pyopenssl[${PYTHON_USEDEP}]
dev-python/pyscard[${PYTHON_USEDEP}]
"
BDEPEND="
dev-python/setuptools[${PYTHON_USEDEP}]
"
python_install_all() {
local DOC_CONTENTS
distutils-r1_python_install_all
DOC_CONTENTS="
The 'openpgp' command may require the package 'app-crypt/ccid'
to be installed on the system. Furthermore, make sure that pcscd
daemon is running and has correct access permissions to USB
devices.
"
readme.gentoo_create_doc
doman "${S}"/man/ykman.1
}
pkg_postinst() {
readme.gentoo_print_elog
}

Binary file not shown.

@ -29,7 +29,7 @@ else
SRC_URI="https://dev.gentoo.org/~ulm/distfiles/${P}.tar.xz" SRC_URI="https://dev.gentoo.org/~ulm/distfiles/${P}.tar.xz"
S="${WORKDIR}/emacs" S="${WORKDIR}/emacs"
elif [[ ${PV//[0-9]} != "." ]]; then elif [[ ${PV//[0-9]} != "." ]]; then
SRC_URI="mirror://gnu-alpha/emacs/pretest/${PN}-${PV/_/-}.tar.xz" SRC_URI="https://alpha.gnu.org/gnu/emacs/pretest/${PN}-${PV/_/-}.tar.xz"
fi fi
SLOT="${PV%%.*}" SLOT="${PV%%.*}"
[[ ${PV} == *.*.* ]] && SLOT+="-vcs" [[ ${PV} == *.*.* ]] && SLOT+="-vcs"

@ -29,7 +29,7 @@ else
SRC_URI="https://dev.gentoo.org/~ulm/distfiles/${P}.tar.xz" SRC_URI="https://dev.gentoo.org/~ulm/distfiles/${P}.tar.xz"
S="${WORKDIR}/emacs" S="${WORKDIR}/emacs"
elif [[ ${PV//[0-9]} != "." ]]; then elif [[ ${PV//[0-9]} != "." ]]; then
SRC_URI="mirror://gnu-alpha/emacs/pretest/${PN}-${PV/_/-}.tar.xz" SRC_URI="https://alpha.gnu.org/gnu/emacs/pretest/${PN}-${PV/_/-}.tar.xz"
fi fi
SLOT="${PV%%.*}" SLOT="${PV%%.*}"
[[ ${PV} == *.*.* ]] && SLOT+="-vcs" [[ ${PV} == *.*.* ]] && SLOT+="-vcs"

@ -29,7 +29,7 @@ else
SRC_URI="https://dev.gentoo.org/~ulm/distfiles/${P}.tar.xz" SRC_URI="https://dev.gentoo.org/~ulm/distfiles/${P}.tar.xz"
S="${WORKDIR}/emacs" S="${WORKDIR}/emacs"
elif [[ ${PV//[0-9]} != "." ]]; then elif [[ ${PV//[0-9]} != "." ]]; then
SRC_URI="mirror://gnu-alpha/emacs/pretest/${PN}-${PV/_/-}.tar.xz" SRC_URI="https://alpha.gnu.org/gnu/emacs/pretest/${PN}-${PV/_/-}.tar.xz"
fi fi
SLOT="${PV%%.*}" SLOT="${PV%%.*}"
[[ ${PV} == *.*.* ]] && SLOT+="-vcs" [[ ${PV} == *.*.* ]] && SLOT+="-vcs"

@ -29,7 +29,7 @@ else
SRC_URI="https://dev.gentoo.org/~ulm/distfiles/${P}.tar.xz" SRC_URI="https://dev.gentoo.org/~ulm/distfiles/${P}.tar.xz"
S="${WORKDIR}/emacs" S="${WORKDIR}/emacs"
elif [[ ${PV//[0-9]} != "." ]]; then elif [[ ${PV//[0-9]} != "." ]]; then
SRC_URI="mirror://gnu-alpha/emacs/pretest/${PN}-${PV/_/-}.tar.xz" SRC_URI="https://alpha.gnu.org/gnu/emacs/pretest/${PN}-${PV/_/-}.tar.xz"
fi fi
SLOT="${PV%%.*}" SLOT="${PV%%.*}"
[[ ${PV} == *.*.* ]] && SLOT+="-vcs" [[ ${PV} == *.*.* ]] && SLOT+="-vcs"

@ -15,7 +15,7 @@ if [[ ${PV} == 9999 ]]; then
EGIT_REPO_URI="https://github.com/neovim/neovim.git" EGIT_REPO_URI="https://github.com/neovim/neovim.git"
else else
SRC_URI="https://github.com/neovim/neovim/archive/v${PV}.tar.gz -> ${P}.tar.gz" SRC_URI="https://github.com/neovim/neovim/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="amd64 ~arm ~arm64 x86" KEYWORDS="amd64 ~arm ~arm64 x86 ~x64-macos"
fi fi
LICENSE="Apache-2.0 vim" LICENSE="Apache-2.0 vim"
@ -49,7 +49,9 @@ DEPEND="${LUA_DEPS}
dev-libs/libuv:0= dev-libs/libuv:0=
>=dev-libs/libvterm-0.1.2 >=dev-libs/libvterm-0.1.2
dev-libs/msgpack:0= dev-libs/msgpack:0=
net-libs/libnsl !kernel_Darwin? (
net-libs/libnsl
)
tui? ( tui? (
dev-libs/libtermkey dev-libs/libtermkey
>=dev-libs/unibilium-2.0.0:0= >=dev-libs/unibilium-2.0.0:0=

Binary file not shown.

@ -1,12 +0,0 @@
diff --git a/Makefile b/Makefile
index 04a0d450..e0013a59 100644
--- a/Makefile
+++ b/Makefile
@@ -803,6 +802,7 @@
$(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
endif
ifdef CONFIG_TRACE_SYSTEMTAP
+ mkdir -p $(DESTDIR)$(bindir)
$(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir)
endif
ifneq ($(BLOBS),)

@ -1,16 +0,0 @@
diff --git i/configure w/configure
index a72a5def57..546d757603 100755
--- i/configure
+++ w/configure
@@ -6093,10 +6093,6 @@ write_c_skeleton
if test "$gcov" = "yes" ; then
QEMU_CFLAGS="-fprofile-arcs -ftest-coverage -g $QEMU_CFLAGS"
QEMU_LDFLAGS="-fprofile-arcs -ftest-coverage $QEMU_LDFLAGS"
-elif test "$fortify_source" = "yes" ; then
- CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
-elif test "$debug" = "no"; then
- CFLAGS="-O2 $CFLAGS"
fi
if test "$have_asan" = "yes"; then

@ -1,62 +0,0 @@
https://bugs.gentoo.org/735146
From 4fd46e6cdd976f4aecdc3fbbad728e00a7bc4ee0 Mon Sep 17 00:00:00 2001
From: Rafael Kitover <rkitover@gmail.com>
Date: Thu, 13 Aug 2020 20:19:24 +0000
Subject: [PATCH] configure: Require pixman for vhost-user-gpu.
Use the test from Makefile to check if vhost-user-gpu is being built,
and if so require pixman.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
---
configure | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
--- a/configure
+++ b/configure
@@ -4062,20 +4062,6 @@ if test "$modules" = yes; then
fi
fi
-##########################################
-# pixman support probe
-
-if test "$softmmu" = "no"; then
- pixman_cflags=
- pixman_libs=
-elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
- pixman_cflags=$($pkg_config --cflags pixman-1)
- pixman_libs=$($pkg_config --libs pixman-1)
-else
- error_exit "pixman >= 0.21.8 not present." \
- "Please install the pixman devel package."
-fi
-
##########################################
# libmpathpersist probe
@@ -4491,6 +4477,20 @@ if test "$opengl" = "yes" && test "$have_x11" = "yes"; then
done
fi
+##########################################
+# pixman support probe
+
+if test "$softmmu" = "no" && ! test "${linux} ${virglrenderer} ${gbm} ${want_tools}" = "yes yes yes yes"; then
+ pixman_cflags=
+ pixman_libs=
+elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
+ pixman_cflags=$($pkg_config --cflags pixman-1)
+ pixman_libs=$($pkg_config --libs pixman-1)
+else
+ error_exit "pixman >= 0.21.8 not present." \
+ "Please install the pixman devel package."
+fi
+
##########################################
# libxml2 probe
if test "$libxml2" != "no" ; then
--
2.28.0

@ -1,82 +0,0 @@
From 202d69a715a4b1824dcd7ec1683d027ed2bae6d3 Mon Sep 17 00:00:00 2001
Message-Id: <202d69a715a4b1824dcd7ec1683d027ed2bae6d3.1606202550.git.mprivozn@redhat.com>
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Mon, 24 Aug 2020 13:00:57 +0200
Subject: [PATCH] usb-host: workaround libusb bug
libusb_get_device_speed() does not work for
libusb_wrap_sys_device() devices in v1.0.23.
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1871090
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200824110057.32089-1-kraxel@redhat.com
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
hw/usb/host-libusb.c | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index c474551d84..08604f787f 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -39,6 +39,11 @@
#endif
#include <libusb.h>
+#ifdef CONFIG_LINUX
+#include <sys/ioctl.h>
+#include <linux/usbdevice_fs.h>
+#endif
+
#include "qapi/error.h"
#include "migration/vmstate.h"
#include "monitor/monitor.h"
@@ -885,6 +890,7 @@ static void usb_host_ep_update(USBHostDevice *s)
static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
{
USBDevice *udev = USB_DEVICE(s);
+ int libusb_speed;
int bus_num = 0;
int addr = 0;
int rc;
@@ -935,7 +941,36 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
usb_ep_init(udev);
usb_host_ep_update(s);
- udev->speed = speed_map[libusb_get_device_speed(dev)];
+ libusb_speed = libusb_get_device_speed(dev);
+#ifdef CONFIG_LINUX
+ if (hostfd && libusb_speed == 0) {
+ /*
+ * Workaround libusb bug: libusb_get_device_speed() does not
+ * work for libusb_wrap_sys_device() devices in v1.0.23.
+ *
+ * Speeds are defined in linux/usb/ch9.h, file not included
+ * due to name conflicts.
+ */
+ int rc = ioctl(hostfd, USBDEVFS_GET_SPEED, NULL);
+ switch (rc) {
+ case 1: /* low */
+ libusb_speed = LIBUSB_SPEED_LOW;
+ break;
+ case 2: /* full */
+ libusb_speed = LIBUSB_SPEED_FULL;
+ break;
+ case 3: /* high */
+ case 4: /* wireless */
+ libusb_speed = LIBUSB_SPEED_HIGH;
+ break;
+ case 5: /* super */
+ case 6: /* super plus */
+ libusb_speed = LIBUSB_SPEED_SUPER;
+ break;
+ }
+ }
+#endif
+ udev->speed = speed_map[libusb_speed];
usb_host_speed_compat(s);
if (s->ddesc.iProduct) {
--
2.26.2

@ -1,90 +0,0 @@
https://bugs.gentoo.org/743649
From b946434f2659a182afc17e155be6791ebfb302eb Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Tue, 25 Aug 2020 07:36:36 +0200
Subject: [PATCH] usb: fix setup_len init (CVE-2020-14364)
Store calculated setup_len in a local variable, verify it, and only
write it to the struct (USBDevice->setup_len) in case it passed the
sanity checks.
This prevents other code (do_token_{in,out} functions specifically)
from working with invalid USBDevice->setup_len values and overrunning
the USBDevice->setup_buf[] buffer.
Fixes: CVE-2020-14364
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Message-id: 20200825053636.29648-1-kraxel@redhat.com
---
hw/usb/core.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/hw/usb/core.c b/hw/usb/core.c
index 5abd128b6b..5234dcc73f 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -129,6 +129,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
static void do_token_setup(USBDevice *s, USBPacket *p)
{
int request, value, index;
+ unsigned int setup_len;
if (p->iov.size != 8) {
p->status = USB_RET_STALL;
@@ -138,14 +139,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p)
usb_packet_copy(p, s->setup_buf, p->iov.size);
s->setup_index = 0;
p->actual_length = 0;
- s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
- if (s->setup_len > sizeof(s->data_buf)) {
+ setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+ if (setup_len > sizeof(s->data_buf)) {
fprintf(stderr,
"usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
- s->setup_len, sizeof(s->data_buf));
+ setup_len, sizeof(s->data_buf));
p->status = USB_RET_STALL;
return;
}
+ s->setup_len = setup_len;
request = (s->setup_buf[0] << 8) | s->setup_buf[1];
value = (s->setup_buf[3] << 8) | s->setup_buf[2];
@@ -259,26 +261,28 @@ static void do_token_out(USBDevice *s, USBPacket *p)
static void do_parameter(USBDevice *s, USBPacket *p)
{
int i, request, value, index;
+ unsigned int setup_len;
for (i = 0; i < 8; i++) {
s->setup_buf[i] = p->parameter >> (i*8);
}
s->setup_state = SETUP_STATE_PARAM;
- s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
s->setup_index = 0;
request = (s->setup_buf[0] << 8) | s->setup_buf[1];
value = (s->setup_buf[3] << 8) | s->setup_buf[2];
index = (s->setup_buf[5] << 8) | s->setup_buf[4];
- if (s->setup_len > sizeof(s->data_buf)) {
+ setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+ if (setup_len > sizeof(s->data_buf)) {
fprintf(stderr,
"usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
- s->setup_len, sizeof(s->data_buf));
+ setup_len, sizeof(s->data_buf));
p->status = USB_RET_STALL;
return;
}
+ s->setup_len = setup_len;
if (p->pid == USB_TOKEN_OUT) {
usb_packet_copy(p, s->data_buf, s->setup_len);
--
2.28.0

@ -1,4 +1,4 @@
# Copyright 1999-2020 Gentoo Authors # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=7 EAPI=7
@ -12,7 +12,7 @@ MY_PV=${PV/_/-}
XEN_EXTFILES_URL="http://xenbits.xensource.com/xen-extfiles" XEN_EXTFILES_URL="http://xenbits.xensource.com/xen-extfiles"
LIBPCI_URL=ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci LIBPCI_URL=ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci
GRUB_URL=mirror://gnu-alpha/grub GRUB_URL=https://alpha.gnu.org/gnu/grub
UPSTREAM_VER= UPSTREAM_VER=
[[ -n ${UPSTREAM_VER} ]] && \ [[ -n ${UPSTREAM_VER} ]] && \

@ -1,4 +1,4 @@
# Copyright 1999-2020 Gentoo Authors # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=7 EAPI=7
@ -12,7 +12,7 @@ MY_PV=${PV/_/-}
XEN_EXTFILES_URL="http://xenbits.xensource.com/xen-extfiles" XEN_EXTFILES_URL="http://xenbits.xensource.com/xen-extfiles"
LIBPCI_URL=ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci LIBPCI_URL=ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci
GRUB_URL=mirror://gnu-alpha/grub GRUB_URL=https://alpha.gnu.org/gnu/grub
UPSTREAM_VER= UPSTREAM_VER=
[[ -n ${UPSTREAM_VER} ]] && \ [[ -n ${UPSTREAM_VER} ]] && \

Binary file not shown.

@ -0,0 +1,52 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="7"
inherit eutils bash-completion-r1 systemd
DESCRIPTION="Security and system auditing tool"
HOMEPAGE="https://cisofy.com/lynis/"
SRC_URI="https://cisofy.com/files/${P}.tar.gz"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND=""
RDEPEND="app-shells/bash"
S="${WORKDIR}/${PN}"
src_install() {
doman lynis.8
dodoc FAQ README
newdoc CHANGELOG.md CHANGELOG
# Remove the old one during the next stabilize progress
exeinto /etc/cron.daily
newexe "${FILESDIR}"/lynis.cron-new lynis
dobashcomp extras/bash_completion.d/lynis
# stricter default perms - bug 507436
diropts -m0700
insopts -m0600
insinto /usr/share/${PN}
doins -r db/ include/ plugins/
dosbin lynis
insinto /etc/${PN}
doins default.prf
systemd_dounit "${S}/extras/systemd/${PN}.service"
systemd_dounit "${S}/extras/systemd/${PN}.timer"
}
pkg_postinst() {
einfo
einfo "A cron script has been installed to ${ROOT}/etc/cron.daily/lynis."
einfo
}

Binary file not shown.

@ -1 +1 @@
DIST prometheus-2.15.2.linux-amd64.tar.gz 59204993 BLAKE2B 700d61063cddea02ca4445257b11b782c3b6fc84ed3d48f8d196c5602819f0d44b218d15b870281293bf0661929b02930b937e66fec34918b81cd3d010a6fa21 SHA512 a3b95fe6101d5587329d84adb18c0c261babe5a909e62ab1a39f42df28c058d311b0b2ea9ecbdad9227789ed83c0fae4a12776348999cda3a70cdc457f6d3611 DIST prometheus-2.25.0.linux-amd64.tar.gz 66280932 BLAKE2B 3528c9a2c3275d93152281c0083dc224e5a296636ec22628b6b43bc07f64a7c95cf96fb5f9c212c8101b441d9cba40c629d9fab9de3bcca2e18e2ade06ebb3bc SHA512 0dcbdc18fcc99a4c7cee3ce1435812b651b6cea373df4fbc7263c986c2c6c22de1a686ca44eb104ef602e2a1261957a4e0a64d3ba7b24ae4e9b587b852e5ab24

@ -0,0 +1,22 @@
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=prometheus
Group=prometheus
ExecStart=/usr/bin/prometheus \
--web.enable-lifecycle \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path="/var/lib/prometheus/data" \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries \
--web.listen-address=0.0.0.0:9090 \
--web.enable-admin-api
Restart=always
[Install]
WantedBy=multi-user.target

@ -1,8 +1,10 @@
# Copyright 2020 Gentoo Authors # Copyright 2020-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=7 EAPI=7
inherit systemd
DESCRIPTION="prometheus monitoring system and time series database" DESCRIPTION="prometheus monitoring system and time series database"
HOMEPAGE="https://prometheus.io" HOMEPAGE="https://prometheus.io"
MY_PN=${PN%%-bin} MY_PN=${PN%%-bin}
@ -11,7 +13,7 @@ SRC_URI="https://github.com/prometheus/prometheus/releases/download/v${PV}/${MY_
LICENSE="Apache-2.0" LICENSE="Apache-2.0"
SLOT="0" SLOT="0"
KEYWORDS="~amd64" KEYWORDS="-* ~amd64"
QA_PREBUILT=".*" QA_PREBUILT=".*"
RESTRICT="strip" RESTRICT="strip"
@ -24,7 +26,7 @@ RDEPEND="${DEPEND}"
S="${WORKDIR}/${MY_P}.linux-amd64" S="${WORKDIR}/${MY_P}.linux-amd64"
src_install() { src_install() {
dobin prometheus promtool tsdb dobin prometheus promtool
insinto /usr/share/prometheus insinto /usr/share/prometheus
doins -r console_libraries consoles doins -r console_libraries consoles
insinto /etc/prometheus insinto /etc/prometheus
@ -32,6 +34,7 @@ src_install() {
dosym ../../usr/share/prometheus/console_libraries /etc/prometheus/console_libraries dosym ../../usr/share/prometheus/console_libraries /etc/prometheus/console_libraries
dosym ../../usr/share/prometheus/consoles /etc/prometheus/consoles dosym ../../usr/share/prometheus/consoles /etc/prometheus/consoles
systemd_dounit "${FILESDIR}"/prometheus.service
newinitd "${FILESDIR}"/prometheus.initd prometheus newinitd "${FILESDIR}"/prometheus.initd prometheus
newconfd "${FILESDIR}"/prometheus.confd prometheus newconfd "${FILESDIR}"/prometheus.confd prometheus
keepdir /var/log/prometheus /var/lib/prometheus keepdir /var/log/prometheus /var/lib/prometheus

File diff suppressed because it is too large Load Diff

@ -0,0 +1,22 @@
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=prometheus
Group=prometheus
ExecStart=/usr/bin/prometheus \
--web.enable-lifecycle \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path="/var/lib/prometheus/data" \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries \
--web.listen-address=0.0.0.0:9090 \
--web.enable-admin-api
Restart=always
[Install]
WantedBy=multi-user.target

@ -1,8 +1,10 @@
# Copyright 1999-2020 Gentoo Authors # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=7 EAPI=7
inherit go-module
inherit go-module systemd
MY_PV=v${PV/_rc/-rc.} MY_PV=v${PV/_rc/-rc.}
GIT_COMMIT=e83ef207b GIT_COMMIT=e83ef207b
@ -44,6 +46,7 @@ src_install() {
dosym ../../usr/share/prometheus/console_libraries /etc/prometheus/console_libraries dosym ../../usr/share/prometheus/console_libraries /etc/prometheus/console_libraries
dosym ../../usr/share/prometheus/consoles /etc/prometheus/consoles dosym ../../usr/share/prometheus/consoles /etc/prometheus/consoles
systemd_dounit "${FILESDIR}"/prometheus.service
newinitd "${FILESDIR}"/prometheus.initd prometheus newinitd "${FILESDIR}"/prometheus.initd prometheus
newconfd "${FILESDIR}"/prometheus.confd prometheus newconfd "${FILESDIR}"/prometheus.confd prometheus
keepdir /var/log/prometheus /var/lib/prometheus keepdir /var/log/prometheus /var/lib/prometheus

File diff suppressed because it is too large Load Diff

Binary file not shown.

@ -1,26 +0,0 @@
http://midnight-commander.org/ticket/4149
--- a/misc/mc.lib
+++ b/misc/mc.lib
@@ -116,6 +116,9 @@ alt-shift-left=\\e[1\;4D
alt-shift-up=\\e[1\;4A
alt-shift-down=\\e[1\;4B
+[terminal:alacritty]
+copy=xterm
+
[terminal:gnome]
copy=xterm
@@ -137,6 +140,12 @@ copy=xterm
[terminal:screen-256color]
copy=xterm
+[terminal:tmux]
+copy=xterm
+
+[terminal:tmux-256color]
+copy=xterm
+
[terminal:ibmpc3]
f11=\\e[Y
f12=\\e[Z

Binary file not shown.

@ -10,7 +10,7 @@ MY_P="${P/_/-}"
DESCRIPTION="A spell checker replacement for ispell" DESCRIPTION="A spell checker replacement for ispell"
HOMEPAGE="http://aspell.net/" HOMEPAGE="http://aspell.net/"
if [[ "${PV}" = *_rc* ]] ; then if [[ "${PV}" = *_rc* ]] ; then
SRC_URI="mirror://gnu-alpha/aspell/${MY_P}.tar.gz" SRC_URI="https://alpha.gnu.org/gnu/aspell/${MY_P}.tar.gz"
else else
SRC_URI="mirror://gnu/aspell/${MY_P}.tar.gz" SRC_URI="mirror://gnu/aspell/${MY_P}.tar.gz"
fi fi

@ -8,7 +8,7 @@ inherit desktop
DESCRIPTION="Viewer for PostScript and PDF documents using Ghostscript" DESCRIPTION="Viewer for PostScript and PDF documents using Ghostscript"
HOMEPAGE="https://www.gnu.org/software/gv/" HOMEPAGE="https://www.gnu.org/software/gv/"
# Change 'gnu-alpha' to 'gnu' for final release, like 3.7.4 # Change 'gnu-alpha' to 'gnu' for final release, like 3.7.4
SRC_URI="mirror://gnu-alpha/gv/${P}.tar.gz" SRC_URI="https://alpha.gnu.org/gnu/gv/${P}.tar.gz"
LICENSE="GPL-3" LICENSE="GPL-3"
SLOT="0" SLOT="0"

Binary file not shown.

@ -1,9 +1 @@
DIST Cabal-1.18.1.2.tar.gz 323545 BLAKE2B d9e88f8f512b6bf23f8c57b6719fcf560b24aa2b20a0be3aeaba455dbea79c7320cfec495f31524a098b2d0298fe04cdd29c65f8c527066fcac82ba1f592e761 SHA512 a91abbdb86bcb7a47e871e9b9a2cb4720b41f2cf6998416cc557460ff821e9b711cf8c346bf16c7b07c180815cb901f7b27e5cda3701f3ace554613ceb27e3c6
DIST Cabal-1.18.1.3.tar.gz 705715 BLAKE2B 46d6c446e9410d7bd3e3f2e68e2e950e180f8fde4332ba3c4657add30dd721d7e2887b830e9c2954d3ce8e521e42d7db90d87150804589ad5fbea5c08b6b3fca SHA512 3c6f2d3be36384140007ca1146edcca5461bf0e93cde8d2b32bd9d69f74df51975bfbc91ec7cce92d9c78929f91f9e7e8b595488bc1c328dbed313a6fcd76708
DIST Cabal-1.18.1.5.tar.gz 706722 BLAKE2B ff1b301882d39c0388f6ecd39ad73cadebdc9096b0e185fcf1299897e536be23714ba9126033d98b60558272fc28e9d72f638ee94d9f769e61d00c2d2bd1a092 SHA512 a5bb21bcb0a95f22572a1d6d4338415bf00eab9b77c2fb4775c81f7554d282fea9160646687bd903197cb5d429f0fcd28b30b577a8915ec92740a91fa13c68ef
DIST Cabal-1.20.0.2.tar.gz 717941 BLAKE2B 38aa5742a1f0137b3f81af6543d7810b98f15b6aeb6e83ea169aacab0bcb1d14629df885cc9c02bb64567069e475497cf2ac716731bf84ee89bdf177404cc5e0 SHA512 6dfe30ebe5859ccd934f76fc32bd4757d89e3bcb02a528bebaa0a63f22c0494eb4a941b2fed2e004671875586fed113860e82413bed99f70be565f4f343ac3d3
DIST Cabal-1.22.8.0.tar.gz 405552 BLAKE2B 9484ba4b485f6119a7b9e27565ac26ea403b407711a8dcfcee127e03f3cce6a0e96165126a996b39a8f29e97e65eff4f5ec308fb3f53c53cb795cb8ba1ab0daf SHA512 3666e8a66751ea8ae93109c1e33c2909c00c65ddcd77458c41303481e06ebd7230215e12c133cc2fca47ba352c61411ff72ca0994b6d45b5987156bce2fbcdf3
DIST Cabal-1.24.2.0.tar.gz 441440 BLAKE2B b4ce800ab35c0771b9da1947b459bae7cf6236724b6073bff3eb51732b08b71f65596f9f3fb7a09eacea4a1ee88d9bd6350298919f095fb2479770f98539faf5 SHA512 707015930d6bd463290c59ef043a5acea79f22d43920ac249d2391c0b8960a10261a83c8aa1a326b6e95311edb048c9edbdc211dc1b79aee86884061af6c8b36
DIST Cabal-2.0.0.2.tar.gz 1551128 BLAKE2B bc053a31ddd966577b1c4d5b80bd778fe0b5aadef08d3eee1f8613ab2dd9bc3a0371ad1687033a4489bfced3b46926b0cbdea20d53ada4ed1ab615c7e080de39 SHA512 0eac73132dbee80cce8bf6ce95d531526c983e90dde3348edf6ee583e7fe352393dc6806eb7f35cd38729d979dd418267f1884ec49b4c9e7d858d9b17dff900f
DIST Cabal-2.4.0.1.tar.gz 4801392 BLAKE2B 489096b7297e217866006f02e7ef41fe362d6495f81ebbb3b3149341bf9ff18d93d102fe836259471ed9ec1c6c591f5564f81a623a7e4106b9e8a4388646d73f SHA512 4b2a1187e1ec011052ab77ef4bc700608eaab3e921554dd9d75bfca058c487a5651ab6cfe2734ee6cc9687d504a008b4912db182166f0f2f52d23fc08230e48c
DIST Cabal-3.0.1.0.tar.gz 758808 BLAKE2B 9a0cf7b055be4d6fa55c4dd44037263df54eff059cd22970383ffa1470317cdaeac8d81a521f8c48cf595fc22e64da031d508f6d2b58f32a613160b3e0cfcd67 SHA512 29a5ae9bad0398ab86c64cba9fb1ae3094d67013151a91c8c25b0e95b08d8fd683d1e85b064f7faf166966f855b261d2f131b727c82476a8514119a8922a6b06 DIST Cabal-3.0.1.0.tar.gz 758808 BLAKE2B 9a0cf7b055be4d6fa55c4dd44037263df54eff059cd22970383ffa1470317cdaeac8d81a521f8c48cf595fc22e64da031d508f6d2b58f32a613160b3e0cfcd67 SHA512 29a5ae9bad0398ab86c64cba9fb1ae3094d67013151a91c8c25b0e95b08d8fd683d1e85b064f7faf166966f855b261d2f131b727c82476a8514119a8922a6b06

@ -1,53 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=5
CABAL_FEATURES="bootstrap lib profile test-suite"
inherit haskell-cabal versionator
MY_PN=Cabal
MY_P=${MY_PN}-${PV}
DESCRIPTION="A framework for packaging Haskell software"
HOMEPAGE="https://www.haskell.org/cabal/"
SRC_URI="https://hackage.haskell.org/package/${MY_P}/${MY_P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-solaris"
IUSE=""
RDEPEND=">=dev-lang/ghc-6.12.1:="
DEPEND="${RDEPEND}
test? ( dev-haskell/extensible-exceptions
dev-haskell/hunit
>=dev-haskell/quickcheck-2.1.0.1
dev-haskell/regex-posix
dev-haskell/test-framework
dev-haskell/test-framework-hunit
>=dev-haskell/test-framework-quickcheck2-0.2.12 )
"
S="${WORKDIR}/${MY_PN}-${PV}"
src_prepare() {
if [[ -n ${LIVE_EBUILD} ]]; then
CABAL_FILE=${MY_PN}.cabal cabal_chdeps 'version: 1.17.0' "version: ${PV}"
fi
}
src_configure() {
cabal-is-dummy-lib && return
einfo "Bootstrapping Cabal..."
$(ghc-getghc) ${HCFLAGS} -i -i. -i"${WORKDIR}/${FP_P}" -cpp --make Setup.hs \
-o setup || die "compiling Setup.hs failed"
cabal-configure
}
src_compile() {
cabal-is-dummy-lib && return
cabal-build
}

@ -1,60 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# ebuild generated by hackport 0.3.6.9999
CABAL_FEATURES="lib profile test-suite"
CABAL_FEATURES+=" bootstrap" # does not beed cabal to build itself
inherit haskell-cabal
MY_PN="Cabal"
MY_P="${MY_PN}-${PV}"
DESCRIPTION="A framework for packaging Haskell software"
HOMEPAGE="https://www.haskell.org/cabal/"
SRC_URI="https://hackage.haskell.org/package/${MY_P}/${MY_P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-solaris"
IUSE=""
RDEPEND=">=dev-lang/ghc-6.12.1:="
DEPEND="${RDEPEND}
test? ( dev-haskell/extensible-exceptions
dev-haskell/hunit
>=dev-haskell/quickcheck-2.1.0.1
dev-haskell/regex-posix
dev-haskell/test-framework
dev-haskell/test-framework-hunit
>=dev-haskell/test-framework-quickcheck2-0.2.12 )
"
S="${WORKDIR}/${MY_PN}-${PV}"
CABAL_CORE_LIB_GHC_PV="7.8.2014* 7.8.0.2014* 7.8.1 7.8.2 7.8.3 7.8.3.20141119"
src_prepare() {
default
if [[ -n ${LIVE_EBUILD} ]]; then
CABAL_FILE=${MY_PN}.cabal cabal_chdeps 'version: 1.17.0' "version: ${PV}"
fi
}
src_configure() {
cabal-is-dummy-lib && return
einfo "Bootstrapping Cabal..."
$(ghc-getghc) ${HCFLAGS} -i -i. -i"${WORKDIR}/${FP_P}" -cpp --make Setup.hs \
-o setup || die "compiling Setup.hs failed"
cabal-configure
}
src_compile() {
cabal-is-dummy-lib && return
cabal-build
}

@ -1,62 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# ebuild generated by hackport 0.3.6.9999
CABAL_FEATURES="lib profile test-suite"
CABAL_FEATURES+=" bootstrap" # does not beed cabal to build itself
inherit haskell-cabal
MY_PN="Cabal"
MY_P="${MY_PN}-${PV}"
DESCRIPTION="A framework for packaging Haskell software"
HOMEPAGE="https://www.haskell.org/cabal/"
SRC_URI="https://hackage.haskell.org/package/${MY_P}/${MY_P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-solaris"
IUSE=""
RESTRICT=test # circular depend: cabal[test]->quickcheck[test]->cabal
RDEPEND=">=dev-lang/ghc-6.12.1:="
DEPEND="${RDEPEND}
test? ( dev-haskell/extensible-exceptions
dev-haskell/hunit
>=dev-haskell/quickcheck-2.1.0.1
dev-haskell/regex-posix
dev-haskell/test-framework
dev-haskell/test-framework-hunit
>=dev-haskell/test-framework-quickcheck2-0.2.12 )
"
S="${WORKDIR}/${MY_PN}-${PV}"
CABAL_CORE_LIB_GHC_PV="7.8.4"
src_prepare() {
default
if [[ -n ${LIVE_EBUILD} ]]; then
CABAL_FILE=${MY_PN}.cabal cabal_chdeps 'version: 1.17.0' "version: ${PV}"
fi
}
src_configure() {
cabal-is-dummy-lib && return
einfo "Bootstrapping Cabal..."
$(ghc-getghc) ${HCFLAGS} -i -i. -i"${WORKDIR}/${FP_P}" -cpp --make Setup.hs \
-o setup || die "compiling Setup.hs failed"
cabal-configure
}
src_compile() {
cabal-is-dummy-lib && return
cabal-build
}

@ -1,63 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# ebuild generated by hackport 0.4.9999
CABAL_FEATURES="lib profile test-suite"
CABAL_FEATURES+=" bootstrap" # does not beed cabal to build itself
inherit haskell-cabal
MY_PN="Cabal"
MY_P="${MY_PN}-${PV}"
DESCRIPTION="A framework for packaging Haskell software"
HOMEPAGE="https://www.haskell.org/cabal/"
SRC_URI="https://hackage.haskell.org/package/${MY_P}/${MY_P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-solaris"
IUSE=""
RDEPEND=">=dev-lang/ghc-7.4.1:=
"
DEPEND="${RDEPEND}
test? ( dev-haskell/extensible-exceptions
dev-haskell/hunit
>=dev-haskell/quickcheck-2.1.0.1:2 <dev-haskell/quickcheck-2.8:2
dev-haskell/regex-posix
dev-haskell/test-framework
dev-haskell/test-framework-hunit
>=dev-haskell/test-framework-quickcheck2-0.2.12 )
"
S="${WORKDIR}/${MY_PN}-${PV}"
src_prepare() {
default
if [[ -n ${LIVE_EBUILD} ]]; then
CABAL_FILE=${MY_PN}.cabal cabal_chdeps 'version: 1.17.0' "version: ${PV}"
fi
cabal_chdeps \
'QuickCheck < 2.7' 'QuickCheck < 2.8' \
'QuickCheck >= 2.1.0.1 && < 2.7' 'QuickCheck >= 2.1.0.1 && < 2.8'
}
src_configure() {
cabal-is-dummy-lib && return
einfo "Bootstrapping Cabal..."
$(ghc-getghc) ${HCFLAGS} -i -i. -i"${WORKDIR}/${FP_P}" -cpp --make Setup.hs \
-o setup || die "compiling Setup.hs failed"
cabal-configure
}
src_compile() {
cabal-is-dummy-lib && return
cabal-build
}

@ -1,60 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# ebuild generated by hackport 0.4.5.9999
CABAL_FEATURES="lib profile test-suite"
CABAL_FEATURES+=" bootstrap" # does not need cabal to build itself
inherit haskell-cabal
MY_PN="Cabal"
MY_P="${MY_PN}-${PV}"
DESCRIPTION="A framework for packaging Haskell software"
HOMEPAGE="https://www.haskell.org/cabal/"
SRC_URI="https://hackage.haskell.org/package/${MY_P}/${MY_P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-solaris"
IUSE=""
RESTRICT=test
RDEPEND=">=dev-lang/ghc-7.8.1:="
DEPEND="${RDEPEND}
test? ( dev-haskell/extensible-exceptions
dev-haskell/hunit
>=dev-haskell/quickcheck-2.1.0.1:2 <dev-haskell/quickcheck-2.9:2
dev-haskell/regex-posix
dev-haskell/test-framework
dev-haskell/test-framework-hunit
>=dev-haskell/test-framework-quickcheck2-0.2.12 )
"
S="${WORKDIR}/${MY_PN}-${PV}"
src_prepare() {
default
if [[ -n ${LIVE_EBUILD} ]]; then
CABAL_FILE=${MY_PN}.cabal cabal_chdeps 'version: 1.17.0' "version: ${PV}"
fi
}
src_configure() {
cabal-is-dummy-lib && return
einfo "Bootstrapping Cabal..."
$(ghc-getghc) ${HCFLAGS} -i -i. -i"${WORKDIR}/${FP_P}" -cpp --make Setup.hs \
-o setup || die "compiling Setup.hs failed"
cabal-configure
}
src_compile() {
cabal-is-dummy-lib && return
cabal-build
}

@ -1,37 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
# ebuild generated by hackport 0.5.9999
#hackport: flags: -bundled-binary-generic
CABAL_FEATURES="lib profile test-suite"
CABAL_FEATURES+=" nocabaldep" # in case installed Cabal is broken
inherit haskell-cabal
MY_PN="Cabal"
MY_P="${MY_PN}-${PV}"
DESCRIPTION="A framework for packaging Haskell software"
HOMEPAGE="https://www.haskell.org/cabal/"
SRC_URI="https://hackage.haskell.org/package/${MY_P}/${MY_P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-solaris"
IUSE=""
RESTRICT=test # circular dependencies
RDEPEND=">=dev-lang/ghc-7.8.1:="
DEPEND="${RDEPEND}"
S="${WORKDIR}/${MY_P}"
CABAL_CORE_LIB_GHC_PV="PM:8.0.2_rc2 PM:8.0.2"
src_configure() {
haskell-cabal_src_configure \
--flag=-bundled-binary-generic
}

@ -1,40 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
# ebuild generated by hackport 0.5.3.9999
#hackport: flags: -parsec-struct-diff
CABAL_FEATURES="lib profile test-suite"
CABAL_FEATURES+=" nocabaldep" # in case installed Cabal is broken
inherit haskell-cabal
MY_PN="Cabal"
MY_P="${MY_PN}-${PV}"
DESCRIPTION="A framework for packaging Haskell software"
HOMEPAGE="https://www.haskell.org/cabal/"
SRC_URI="https://hackage.haskell.org/package/${MY_P}/${MY_P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
#not keyworded yet: many packages are broken
#KEYWORDS="~amd64 ~ia64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-solaris"
IUSE=""
RESTRICT=test # circular dependencies
RDEPEND=">=dev-lang/ghc-7.8.1:="
DEPEND="${RDEPEND}"
CABAL_CORE_LIB_GHC_PV="PM:8.2.1"
PATCHES=("${FILESDIR}"/${P}-no-bootstrap.patch)
S="${WORKDIR}/${MY_P}"
src_configure() {
haskell-cabal_src_configure \
--flag=-parsec-struct-diff
}

@ -1,44 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# ebuild generated by hackport 0.5.6.9999
#hackport: flags: -bundled-binary-generic
CABAL_FEATURES="lib profile" # Drop test-suite: circular depend
CABAL_FEATURES+=" nocabaldep" # in case installed Cabal is broken
inherit haskell-cabal
MY_PN="Cabal"
MY_P="${MY_PN}-${PV}"
DESCRIPTION="A framework for packaging Haskell software"
HOMEPAGE="https://www.haskell.org/cabal/"
SRC_URI="https://hackage.haskell.org/package/${MY_P}/${MY_P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
# keep in sync with ghc-8.6
#KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE=""
RESTRICT=test # circular deps: cabal -> quickcheck -> cabal
RDEPEND=">=dev-haskell/mtl-2.1:=[profile?] <dev-haskell/mtl-2.3:=[profile?]
>=dev-haskell/parsec-3.1.13.0:=[profile?] <dev-haskell/parsec-3.2:=[profile?]
>=dev-haskell/text-1.2.3.0:=[profile?] <dev-haskell/text-1.3:=[profile?]
>=dev-lang/ghc-7.8.2:=
"
DEPEND="${RDEPEND}"
S="${WORKDIR}/${MY_P}"
PATCHES=("${FILESDIR}"/${PN}-2.0.0.2-no-bootstrap.patch)
CABAL_CORE_LIB_GHC_PV="PM:8.6.1 PM:8.6.2 PM:8.6.3 PM:8.6.4 PM:8.6.5"
src_configure() {
haskell-cabal_src_configure \
--flag=-bundled-binary-generic
}

@ -1,3 +1 @@
DIST haddock-api-2.16.1.tar.gz 125372 BLAKE2B dbc0678cd38bad8549375468ddda27061e17cb74927e1a1c3c286cb25e8cd098a8f17333d199897bcd7ee56553b4d68b206a6935c44b0a5056810921fc6a3b45 SHA512 01450602d238651a8711141d51f5246536a96b69efee29942296fdfc249929f5f33df24ee676b56d0ba82269cb6557dd3a4e8fabbd1b809e506867b5f285bb17
DIST haddock-api-2.17.3.tar.gz 145142 BLAKE2B 1ca87c180baed23ec5df5d5cbfedc7e3823c344655b2d13f2bcbce0c774874223269b06a88f45365511f6789f8068086c04460faaf4eec7354a20bc18680ce26 SHA512 00057618d970fc7786913eec0b408baabbf1aff4b705c105f6d6347ae9c46af1b2ea7bed420edfaec38c835dee08593c9ae53ab9a30153239e687de6f5301840
DIST haddock-api-2.23.1.tar.gz 200096 BLAKE2B 0635881e198c1df3690f07185da7cc49f8eb92283d99c581756c86fb9f293b28608ac3eea9090abcc3afa12c646e584939df9b8c38b4844e9c462824426019f5 SHA512 fb7826102476a3f292da336f8f16c7a647df7c4432bed905815509fff0df164255c0856cc17663bb42479114ed9a418e6bcd214fb8594b245d401c9e091ac4ef DIST haddock-api-2.23.1.tar.gz 200096 BLAKE2B 0635881e198c1df3690f07185da7cc49f8eb92283d99c581756c86fb9f293b28608ac3eea9090abcc3afa12c646e584939df9b8c38b4844e9c462824426019f5 SHA512 fb7826102476a3f292da336f8f16c7a647df7c4432bed905815509fff0df164255c0856cc17663bb42479114ed9a418e6bcd214fb8594b245d401c9e091ac4ef

@ -1,28 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# ebuild generated by hackport 0.4.5.9999
CABAL_FEATURES="lib profile haddock hoogle hscolour"
inherit haskell-cabal
DESCRIPTION="A documentation-generation tool for Haskell libraries"
HOMEPAGE="https://www.haskell.org/haddock/"
SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE=""
RDEPEND=">=dev-haskell/cabal-1.10:=[profile?]
dev-haskell/ghc-paths:=[profile?]
>=dev-haskell/haddock-library-1.2:=[profile?] <dev-haskell/haddock-library-1.3:=[profile?]
>=dev-haskell/xhtml-3000.2:=[profile?] <dev-haskell/xhtml-3000.3:=[profile?]
>=dev-lang/ghc-7.10:= <dev-lang/ghc-7.12:=
"
DEPEND="${RDEPEND}
>=dev-haskell/cabal-1.10
"

@ -1,34 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
# ebuild generated by hackport 0.5.9999
CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
inherit haskell-cabal
DESCRIPTION="A documentation-generation tool for Haskell libraries"
HOMEPAGE="https://www.haskell.org/haddock/"
SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
# keep in sync with ghc-8.0.1
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE=""
RDEPEND=">=dev-haskell/cabal-1.10:=[profile?]
dev-haskell/ghc-paths:=[profile?]
>=dev-haskell/haddock-library-1.4:=[profile?] <dev-haskell/haddock-library-1.5:=[profile?]
dev-haskell/transformers:=[profile?]
>=dev-haskell/xhtml-3000.2:=[profile?] <dev-haskell/xhtml-3000.3:=[profile?]
>=dev-lang/ghc-8.0:= <dev-lang/ghc-8.2:=
"
DEPEND="${RDEPEND}
>=dev-haskell/cabal-1.24.0.0
test? ( dev-haskell/hspec
>=dev-haskell/quickcheck-2 <dev-haskell/quickcheck-3 )
"
PATCHES=("${FILESDIR}"/${P}-ghc-8.0.2_rc1.patch)

@ -1,4 +1 @@
DIST haddock-library-1.1.1.tar.gz 35641 BLAKE2B 1754ce1088c34629f8523a80c9ee142471b8e7f53f5a77e89265211588cc80719e7fec49e35142b8288b4632a0548def65f9f2966d6838d79e75ec1574588336 SHA512 5f1a592af66a054482fc06ca8d974db0ebd4e42b383ec6b3fd7d44d155bd89c567013af1266e697b76a96b4d39486bc22eac7eb4b1d6842ec0f842533ac8dffb
DIST haddock-library-1.2.1.tar.gz 38606 BLAKE2B 1896a098a4858796feb9ded26914a7cfc9f6478f3993485a9c61be1a3b1aee1e32accafadaa5b1e030d17f78555b1f4c731b76c09bb83c7a7cb8132c8e25e792 SHA512 7ac9dfc648e6e59e1dbaafc7fdf26acb378997506c353dedadf89a729223cdb518edd59642e81758fd898cda163258e5e4150fc84369c3e011e59acd827a037a
DIST haddock-library-1.4.2.tar.gz 38701 BLAKE2B 56c0f1c46100fcf8afa88ce8c44f989da9561109bf74473d5ef65962cc057cf7a54f87786171ad2f57895000e610663f1b2711f231adc7d85442e9028bd9729b SHA512 0ea02f4ac898e6d4349f3c8d3997d66c35866350bfd661b6030a0b59c609eaae3647c8898bb5142afb0235b2eb785059356f6eb2031e6e93615d1d4e3c4cce82
DIST haddock-library-1.8.0.tar.gz 30918 BLAKE2B a8bcf9e08f6596375186930cf4a98ae547c40d85eb0bd00b7aaf8212c3738e32cd51cea044206f3746d10d228b1e8b8a2ccdb28ae7c7957006f518d090a6ceed SHA512 f84672b67dd4b18402efb8b40eb0e2cb912ecf894cfdedf61b0ada87392e63609cf1101d4fc793686cc4af354665661bf4dc902313bb466efee683a7c64bbe2b DIST haddock-library-1.8.0.tar.gz 30918 BLAKE2B a8bcf9e08f6596375186930cf4a98ae547c40d85eb0bd00b7aaf8212c3738e32cd51cea044206f3746d10d228b1e8b8a2ccdb28ae7c7957006f518d090a6ceed SHA512 f84672b67dd4b18402efb8b40eb0e2cb912ecf894cfdedf61b0ada87392e63609cf1101d4fc793686cc4af354665661bf4dc902313bb466efee683a7c64bbe2b

@ -1,27 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# ebuild generated by hackport 0.4.4.9999
CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
inherit haskell-cabal
DESCRIPTION="Library exposing some functionality of Haddock"
HOMEPAGE="https://www.haskell.org/haddock/"
SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86"
IUSE=""
RDEPEND=">=dev-lang/ghc-7.4.1:=
"
DEPEND="${RDEPEND}
>=dev-haskell/cabal-1.10
test? ( dev-haskell/base-compat
dev-haskell/hspec
>=dev-haskell/quickcheck-2 <dev-haskell/quickcheck-3 )
"

@ -1,30 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# ebuild generated by hackport 0.4.5.9999
CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
inherit haskell-cabal
DESCRIPTION="Library exposing some functionality of Haddock"
HOMEPAGE="https://www.haskell.org/haddock/"
SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE=""
RESTRICT=test # on ghc-7.6 Prelude collides with base-compat
RDEPEND="dev-haskell/transformers:=[profile?]
>=dev-lang/ghc-7.4.1:=
"
DEPEND="${RDEPEND}
>=dev-haskell/cabal-1.10
test? ( dev-haskell/base-compat
dev-haskell/hspec
>=dev-haskell/quickcheck-2 <dev-haskell/quickcheck-3 )
"

@ -1,29 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
# ebuild generated by hackport 0.5.9999
CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
inherit haskell-cabal
DESCRIPTION="Library exposing some functionality of Haddock"
HOMEPAGE="https://www.haskell.org/haddock/"
SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
# keep in sync with ghc-8.0.1, might not be required but needs porting revdeps
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE=""
RDEPEND="dev-haskell/transformers:=[profile?]
>=dev-lang/ghc-7.4.1:=
"
DEPEND="${RDEPEND}
>=dev-haskell/cabal-1.10
test? ( dev-haskell/base-compat
dev-haskell/hspec
>=dev-haskell/quickcheck-2 <dev-haskell/quickcheck-3 )
"

@ -1,4 +1 @@
DIST haddock-2.14.3.0.7.8.3.tar.gz 230282 BLAKE2B cb5336c72e0fa3036bf7ceaa202ff35e1d104fcb05c4317f16e78c0517b27529c1fab28e2ee4f2e14cbf2db592ff88a6b01d1840193c9a69233230fec1ffc423 SHA512 62ae4a29c877c3b9742828fcda2f1f045357f41b4a2c495a4791a42d412d41b3d206cdcb73e2d1bd4e95c40371dae865f4eaa37031cda6c1bada5dfed963c2be
DIST haddock-2.16.1.tar.gz 216323 BLAKE2B feddc77d8072dfafb4b06486f57db89a0136ed53644efb0336a26e6c3f31789cf57e302e7bbfbfb9af036a00cbf801c47398347bd664333f0a35debdf794ada3 SHA512 709af410f8746819c8c067f3549d79ba0ecaa312fb6b19acf670a9a3e4c94e94b8e546493e08293eceeb488bc0891a8ebe033a58411c4af935b445cd7f3014b8
DIST haddock-2.17.2.tar.gz 245690 BLAKE2B dc6f646a5972add1a5ac0e2a2a4119df5f8f0604984f0fa3f828e72bca96f8ec98b09ce65de6bb94a2714c64680a79ae3dd49f60a27cbf5483cb71f239180c87 SHA512 f8f06abd3b231fae36b900d54a70107dcd6718bab7726ad7bd8392c9053700b96672cf9efa0854033a5c1473dcdf00c390f253bc244ff5f4d25e70dd76c8ea1d
DIST haddock-2.23.1.tar.gz 302698 BLAKE2B 1dae0019ddc08c537aec2f0fa71f5bd1570db4061d22bf53f05aa0e211c3280d09c6a6481f704c34895e0bf70fd2b5ac95644dab23b05cc2b6fec59c845f86c5 SHA512 e69b3b5f2dcadeccc33696ee8d0646387860b98d86c08d4c07d829e3eabc4159adac0a11d408850ef54face5fa835ab8217d1057b14d8de8d758efbfc7a700db DIST haddock-2.23.1.tar.gz 302698 BLAKE2B 1dae0019ddc08c537aec2f0fa71f5bd1570db4061d22bf53f05aa0e211c3280d09c6a6481f704c34895e0bf70fd2b5ac95644dab23b05cc2b6fec59c845f86c5 SHA512 e69b3b5f2dcadeccc33696ee8d0646387860b98d86c08d4c07d829e3eabc4159adac0a11d408850ef54face5fa835ab8217d1057b14d8de8d758efbfc7a700db

@ -1,69 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# ebuild generated by hackport 0.3.6.9999
CABAL_FEATURES="bin lib profile haddock hoogle hscolour test-suite"
CABAL_FEATURES+=" nocabaldep"
inherit haskell-cabal pax-utils
DESCRIPTION="A documentation-generation tool for Haskell libraries"
HOMEPAGE="https://www.haskell.org/haddock/"
#SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
SRC_URI="http://code.haskell.org/~slyfox/snapshots/${P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86"
IUSE=""
RESTRICT=test # many test depends are not keyworded yet
RDEPEND="dev-haskell/ghc-paths:=[profile?]
>=dev-haskell/xhtml-3000.2:=[profile?] <dev-haskell/xhtml-3000.3:=[profile?]
>=dev-lang/ghc-7.8.3:= <dev-lang/ghc-7.9:=
"
DEPEND="${RDEPEND}
"
src_prepare() {
default
if [[ ! -e "${S}/html" ]]; then
ln -s resources/html "${S}/html" || die "Could not create symbolic link ${S}/html"
fi
}
src_configure() {
# create a fake haddock executable. it'll set the right version to cabal
# configure, but will eventually get overwritten in src_compile by
# the real executable.
local exe="${S}/dist/build/haddock/haddock"
mkdir -p $(dirname "${exe}")
echo -e "#!/bin/sh\necho Haddock version ${PV}" > "${exe}"
chmod +x "${exe}"
# we use 'nocabaldep' to use ghc's bundled Cabal
# as external one is likely to break our haddock
# (known to work on 1.16.0 and breaks on 1.16.0.1!)
haskell-cabal_src_configure \
--ghc-options=-rtsopts \
--with-haddock="${exe}" \
--constraint="Cabal == $(cabal-version)"
}
src_compile() {
# when building the (recursive..) haddock docs, change the datadir to the
# current directory, as we're using haddock inplace even if it's built to be
# installed into the system first.
haddock_datadir="${S}" haskell-cabal_src_compile
}
src_install() {
cabal_src_install
# haddock uses GHC-api to process TH source.
# TH requires GHCi which needs mmap('rwx') (bug #299709)
pax-mark -m "${D}/usr/bin/${PN}"
}

@ -1,71 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# ebuild generated by hackport 0.4.4.9999
CABAL_FEATURES="bin test-suite"
CABAL_FEATURES+=" nocabaldep"
inherit haskell-cabal pax-utils
DESCRIPTION="A documentation-generation tool for Haskell libraries"
HOMEPAGE="https://www.haskell.org/haddock/"
SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE=""
RESTRICT=test # tests are outdated
RDEPEND=""
DEPEND="${RDEPEND}
>=dev-haskell/cabal-1.10
>=dev-lang/ghc-7.4.1
~dev-haskell/haddock-api-2.16.1
"
src_prepare() {
default
if [[ ! -e "${S}/html" ]]; then
ln -s resources/html "${S}/html" || die "Could not create symbolic link ${S}/html"
fi
}
src_configure() {
# create a fake haddock executable. it'll set the right version to cabal
# configure, but will eventually get overwritten in src_compile by
# the real executable.
local exe="${S}/dist/build/haddock/haddock"
mkdir -p $(dirname "${exe}")
echo -e "#!/bin/sh\necho Haddock version ${PV}" > "${exe}"
chmod +x "${exe}"
# we use 'nocabaldep' to use ghc's bundled Cabal
# as external one is likely to break our haddock
# (known to work on 1.16.0 and breaks on 1.16.0.1!)
haskell-cabal_src_configure \
--flags=-in-ghc-tree \
--ghc-options=-rtsopts \
--with-haddock="${exe}" \
--constraint="Cabal == $(cabal-version)"
}
src_compile() {
# when building the (recursive..) haddock docs, change the datadir to the
# current directory, as we're using haddock inplace even if it's built to be
# installed into the system first.
haddock_datadir="${S}" haskell-cabal_src_compile
pax-mark -m "${S}/dist/build/haddock"
}
src_install() {
cabal_src_install
# haddock uses GHC-api to process TH source.
# TH requires GHCi which needs mmap('rwx') (bug #299709)
pax-mark -m "${D}/usr/bin/${PN}"
}

@ -1,34 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
# ebuild generated by hackport 0.5.9999
#hackport: flags: -in-ghc-tree
CABAL_FEATURES="bin test-suite"
inherit haskell-cabal
DESCRIPTION="A documentation-generation tool for Haskell libraries"
HOMEPAGE="https://www.haskell.org/haddock/"
SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
LICENSE="BSD"
SLOT="0"
#keep in sync with ghc-8.0.1
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE=""
RESTRICT=test # there is no haddock-test on hackage yet
RDEPEND=">=dev-haskell/haddock-api-2.17:= <dev-haskell/haddock-api-2.18:=
>=dev-lang/ghc-7.4.1:=
"
DEPEND="${RDEPEND}
>=dev-haskell/cabal-1.10
"
src_configure() {
haskell-cabal_src_configure \
--flag=-in-ghc-tree
}

Binary file not shown.

@ -1,5 +1,5 @@
--- src/org/jmock/expectation/AssertMo.java.orig 2015-08-28 10:15:13.490000000 +0000 --- a/src/org/jmock/expectation/AssertMo.java.orig 2015-08-28 10:15:13.490000000 +0000
+++ src/org/jmock/expectation/AssertMo.java 2015-08-28 10:15:22.206000000 +0000 +++ b/src/org/jmock/expectation/AssertMo.java 2015-08-28 10:15:22.206000000 +0000
@@ -73,15 +73,15 @@ @@ -73,15 +73,15 @@
assertTrue("Should not have verified", threwException); assertTrue("Should not have verified", threwException);
} }

@ -8,8 +8,8 @@ JAVA_PKG_IUSE="doc source"
inherit java-pkg-2 java-pkg-simple inherit java-pkg-2 java-pkg-simple
DESCRIPTION="Library for testing Java code using mock objects" DESCRIPTION="Library for testing Java code using mock objects"
SRC_URI="http://www.${PN}.org/downloads/${P}-jars.zip" SRC_URI="http://${PN}.org/downloads/${P}-jars.zip"
HOMEPAGE="http://www.jmock.org/" HOMEPAGE="http://jmock.org/"
LICENSE="BSD" LICENSE="BSD"
SLOT="1.0" SLOT="1.0"

@ -0,0 +1,48 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
JAVA_PKG_IUSE="doc source"
inherit java-pkg-2 java-pkg-simple
DESCRIPTION="Library for testing Java code using mock objects"
HOMEPAGE="http://jmock.org/"
SRC_URI="http://jmock.org/downloads/${P}-jars.zip"
LICENSE="BSD"
SLOT="1.0"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
CDEPEND="dev-java/junit:0"
RDEPEND=">=virtual/jre-1.8:*
${CDEPEND}"
DEPEND="app-arch/unzip
>=virtual/jdk-1.8:*
${CDEPEND}"
S="${WORKDIR}/${P}"
JAVA_SRC_DIR="src"
JAVA_GENTOO_CLASSPATH="junit"
PATCHES=(
# This patch isn't changing the behaviour if jmock per se.
# Only the formatting is altered.
"${FILESDIR}"/${P}-AbstractMo.patch
)
src_unpack() {
unpack ${A}
unzip "${P}"/jmock-core-"${PV}".jar -d src || die
mv src "${P}" || die
}
src_prepare() {
default
find -name "*.class" -delete || die
rm *.jar || die
}

@ -0,0 +1,43 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
JAVA_PKG_IUSE="doc source"
inherit java-pkg-2 java-pkg-simple
DESCRIPTION="Library for testing Java code using mock objects"
HOMEPAGE="http://jmock.org"
SRC_URI="http://jmock.org/downloads/${P}-jars.zip"
LICENSE="BSD"
SLOT="2"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
CDEPEND="dev-java/hamcrest-core:1.3
dev-java/hamcrest-library:1.3
dev-java/junit:4"
RDEPEND=">=virtual/jre-1.8:*
${CDEPEND}"
DEPEND="app-arch/unzip
>=virtual/jdk-1.8:*
${CDEPEND}"
JAVA_GENTOO_CLASSPATH="hamcrest-core-1.3,hamcrest-library-1.3,junit-4"
S="${WORKDIR}/${P}"
src_unpack() {
unpack ${A}
cd "${S}" || die
unzip ${P}.jar -d src || die
rm *.jar || die
}
src_prepare() {
default
find -name "*.class" -delete || die
}

@ -1,4 +1,4 @@
# Copyright 1999-2020 Gentoo Authors # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=5 EAPI=5
@ -8,8 +8,8 @@ JAVA_PKG_IUSE="doc source"
inherit java-pkg-2 java-pkg-simple inherit java-pkg-2 java-pkg-simple
DESCRIPTION="Library for testing Java code using mock objects" DESCRIPTION="Library for testing Java code using mock objects"
SRC_URI="http://www.jmock.org/downloads/${P}-jars.zip" SRC_URI="http://jmock.org/downloads/${P}-jars.zip"
HOMEPAGE="http://www.jmock.org" HOMEPAGE="http://jmock.org"
LICENSE="BSD" LICENSE="BSD"
SLOT="2" SLOT="2"

@ -19,16 +19,16 @@ SLOT="4"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x64-solaris ~x86-solaris" KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
IUSE="examples" IUSE="examples"
DEPEND=" CDEPEND="
dev-java/hamcrest-core:1.3 dev-java/hamcrest-core:1.3
dev-java/hamcrest-library:1.3 dev-java/hamcrest-library:1.3
" "
RDEPEND="${DEPEND} RDEPEND="
>=virtual/jre-1.8 >=virtual/jre-1.8:*
" ${CDEPEND}"
BDEPEND="${DEPEND} DEPEND="
>=virtual/jdk-1.8 >=virtual/jdk-1.8:*
" ${CDEPEND}"
S="${WORKDIR}/${MY_P}" S="${WORKDIR}/${MY_P}"
JAVA_SRC_DIR="src/main/java" JAVA_SRC_DIR="src/main/java"

Binary file not shown.

@ -1,89 +1,12 @@
DIST binary-0.7.6.1.tar.gz 47086 BLAKE2B 7d81b9c254902d5ff2bafbef4c31a6f6f0396202d8585690c1ae3b63ae6ed157db7221d65a62e393ee8f6725ffd5d80e51030c0351e954b06004fcb70e5867cd SHA512 655daa93a52b845a85d440810452933d7bc3398ad1b51e1e955b2d19a0a32679325a0d1751ad50d252531e493528262e14dab32af4b9a515855fe7f64e0730b2
DIST ghc-7.10.3-src.tar.bz2 13281867 BLAKE2B 51b0a94cc63269926fd5d04c0fb0871266c45b3168187b891127db71980d180668fb8ef7adc51a7a3df947ecc93b4d4a06965ccf9ef53eb74ed063c54adfebde SHA512 97a8282d8a75399c78d85d6faab7ac253a993dc69f1840358572f1878b8fd1a527c28801e5823c8200b5690e268e4a0c00941945ada13790852c75a83b612c17
DIST ghc-7.8.4-ia64-CLOSUREs-regenerated.patch.gz 13268 BLAKE2B 35af21163e3a46ee340e29eb88daf617eeb094f02da7fdcb80e947c1d26234232b12d9eb2c38c02c3207c047573521fef3ac5e7b87609e66f0c57072fef1038e SHA512 a655713e06324b56f0041edf70837487e296d28e6f3ee35fe116b9938765aaf3469d25e92645e0940655ed3607dff27d3826fe0f995c84e81b51bfc956816e7d
DIST ghc-7.8.4-src.tar.bz2 10600755 BLAKE2B 6cf27f663178513b25032b648cf36b016e01361966725dbfc219079961e8eb9b1ab3531427c7012dc599e8e102dc87ed6dd43b31e7bd4e231e2d989936eb2c66 SHA512 079a53891d8ebd8d9b88da96170e60981608a619f8282e4b7948f35244e99bd87277649ac7fcebc227a61a4d21960db8d5e5b9e92f2c69c82d8d68d7fd0a41d3
DIST ghc-8.0.2-src.tar.xz 10687760 BLAKE2B 3b2a487c115680342ce308ff1a42d2b6fa6fb1f31e2670b27a305b4d44160056611b77273c9d47f2e37a1ef01b1aba59c36e76b65c83142a5f09812bf3b1ea02 SHA512 58ea3853cd93b556ecdc4abd0be079b2621171b8491f59004ea4e036a4cba4470aaafe6591b942e0a50a64bdc47540e01fe6900212a1ef7087850112d9bfc5ef
DIST ghc-8.10.1-src.tar.xz 19781652 BLAKE2B 61ff73d3a895cfa0c836e25a684d7a31cf099dcc33d1f308eaf56aa4b2a75b8f38cf963197c11dad9d027270845af20e00a7d81e5417b0fb8b4a98ddbadd53d8 SHA512 e6bb5c326f8354f0892324586c164c6e04168215d8bfeccb594173a838a535e37bac38db6fbdb01fb37150099c12842c53be5e912dfb6a6feeae3c75d4ae24d0
DIST ghc-8.10.1-testsuite.tar.xz 2091988 BLAKE2B 88796f0fb6ea2bdd749161c84ec88768f3bf87063d2224a083db24f69282e615227626fe3c7b41d4abec10883e22042abed6a231582bab4ea530feffd683ed0b SHA512 35147f98301c5bfb6c939e108de48b2a1133adc1028aaa720ce49d60faa06a4b486a9eded658295e3f203731b4dd53475b57e8213491c45b05959430030be269
DIST ghc-8.10.2-src.tar.xz 21880680 BLAKE2B 0c1b67c1576cfd1067d11838301f96041cabf66b94cfd546cfe6bef57babe940fc3814918ff9327e59fe73a8e230fa1d62d7816d7c6cae274dd8c53de6e81736 SHA512 6c3f1311feab3665419a301b17fcb09d303ec822f8eb8c4021edfacff00d9b52e71895bed0e58f11d8f7970415bd8c6f95ffde1294afe795e15607199b20cefc
DIST ghc-8.10.2-testsuite.tar.xz 2101788 BLAKE2B 0d4528223471dfd68cadcda47931d53508c9eafa415716ca5990ea519eb89bfa2bdd444280057be33467382dd3d178887262d54ef633aa8ce88ea91eb9d58ece SHA512 043faaf2f0dc34a868c481b284b94afd78aa1ec1a4056d1f3c97ca3f7dadb3e9cff0517a4cfb378fe5187389db7c9027763bf066328e7dcfd264b737f6d09e41
DIST ghc-8.10.3-src.tar.xz 19872356 BLAKE2B 043f41a21becc826b3cd13ee81b138cf2edfa18484f98361dc85b12f784df85571522347d5fafe40a19ea8ddf12390cd766db8fc21cf4971e797bc61404304cc SHA512 6f3248e728d3677dfddf2f02609167c67a194750418f2a5e34ed68f1135960761c5a5768255bfc8b2ef5640395609424878375184d2dde8e2d69021a3baf9ec8
DIST ghc-8.10.3-testsuite.tar.xz 2261376 BLAKE2B cd03d569c30637d531d9a13fa926a28f854a37d48ef0d4e2fde684664ae000f3c941b5113ccafd42fec019428bafb5344b1ddf8f84a71b21bca8831ed4784907 SHA512 4c9d20a27ed71eb7c73bd86c1049ea5adcc8a0b12040386b7d0dddb46b3cf704c52a3392e19ae4ff1c76b8868665c599391d47e47dba516fcadf8abbc30e28df
DIST ghc-8.10.4-src.tar.xz 19818108 BLAKE2B 069dd8436c373ccf73c20d8b577243792ffdd3a031e869edd612fe1e273126e60803326542695012dbe62e57654ada18af9342bbe1a741b2bebb41cdb0d86035 SHA512 9bb078cb72535a352243b83b671c871392564efd09e478549f27ae58fc6f46e337a0782f5500d26d5704ad96eace22e77bb36031a1fe9b7e175f265b0b9c028b DIST ghc-8.10.4-src.tar.xz 19818108 BLAKE2B 069dd8436c373ccf73c20d8b577243792ffdd3a031e869edd612fe1e273126e60803326542695012dbe62e57654ada18af9342bbe1a741b2bebb41cdb0d86035 SHA512 9bb078cb72535a352243b83b671c871392564efd09e478549f27ae58fc6f46e337a0782f5500d26d5704ad96eace22e77bb36031a1fe9b7e175f265b0b9c028b
DIST ghc-8.10.4-testsuite.tar.xz 2236932 BLAKE2B 17d0520ad5c6daa0cc60530279ae7e617e4d79328b9f436abbe75e72f0803d9a997fb9e1ae61425326b070f45794a488d8507957fec9a6ed49eea86d30a1e579 SHA512 1bf129c8d872e3ceff7c19929605adc5d68daab9ded9aa2e5109b0de162089631472c66f04993adf8481291f8128bf804fe64a9d344c81e257f1b962ba5e382c DIST ghc-8.10.4-testsuite.tar.xz 2236932 BLAKE2B 17d0520ad5c6daa0cc60530279ae7e617e4d79328b9f436abbe75e72f0803d9a997fb9e1ae61425326b070f45794a488d8507957fec9a6ed49eea86d30a1e579 SHA512 1bf129c8d872e3ceff7c19929605adc5d68daab9ded9aa2e5109b0de162089631472c66f04993adf8481291f8128bf804fe64a9d344c81e257f1b962ba5e382c
DIST ghc-8.2.1-src.tar.xz 10736016 BLAKE2B 60993cfc9569e83b0c383591ef30a7280e0138fbb7bd696ad62d87e68dcbccf31c0b8ba211b6647922b8595c7aec2c783648f12c67da53e0766b71c7d7c923fc SHA512 d9aa2aa7f9414db8f4e51d6c275694b46df515e68331a1a2b6018256333a2c63ebd877b75ee90407ecce5be672ec9afc6bebd62aadbf8ae06b94f1760d1736be
DIST ghc-8.2.2-src.tar.xz 10753272 BLAKE2B 6fd792390d3df20f84836466705c3f3c931ba2d594dcbe2b808ea0ae284460000b443df8aae74903eabf05ff9064d68a303086cf888ea68222eb1c60959c8f21 SHA512 6549416f470b599973d409fa45f59c25b07e6a94798cef1a19ad432547dc225338cf4dbc4a4793114b4a417798a3b59b122b92b020251074405c5302b7ffe799
DIST ghc-8.4.1-src.tar.xz 11301528 BLAKE2B 6dcf467d04cace856b68315c85b80f19b517dcbc8ae6e2a08c60afa141c9e0261e012738452c9ca208f9fc40c48bd1a0817e5e0fe9f4737383cd7b44ca65c8d9 SHA512 f8ae11f498bf2911fb92635534c6906c96f1fbe5072c7b7447bd3f69e408026b674564515af02a8aaddc57ee6905ce78d10005b12478a39c220580aaec13a9f7
DIST ghc-8.4.2-src.tar.xz 11313140 BLAKE2B d6fe90f3c68b137c6029bf08918a51ff43c210ba0485aca8d77541cd455f6f9c94287cd011ecd710a8e5a14a27e8a27c04c517417c5748966afd63a5ba6ed19e SHA512 aeb17c986c597762381d9887679eb0eec194c2938a92b5a33e66b4c80002ead02d672b4aa968e1061ab5652b74e46a3c9f9e3d58d5be4a0ae47aa8aed288cf1f
DIST ghc-8.4.3-src.tar.xz 11315068 BLAKE2B cfb858051aff0c4fb3cdbbe96627cacc82665a6bfc4f863b0353eb3d93d358f7ed4efd7b131280763786f397aabc5c4825f60c3890649303fc97187f2b996d21 SHA512 c6cea84264f32ae888f9931f834a1d721889242f656d14262e787ec54a1793d1862ce76daacaf1006c12b8af12919501afce1dc02571373e24830e4d51803414
DIST ghc-8.6.4-src.tar.xz 19029904 BLAKE2B 80676923866417cbf674c3cfadc2ecf9a673e9dcefb4561be7125c83edad38990ea9427c302aeeb9ef04b2c3eeea4fa9fabc72d89c742c6714163ea280802122 SHA512 9237e45b26852cc8a6d64c80da2b28c910349bbbed60f6575035f39bcb064a5ce80ec73cd85e2298e4abefead378e19b7d7ec3ffeea09e362f20eb0b09b36798
DIST ghc-8.6.4-testsuite.tar.xz 1906656 BLAKE2B b0e55b415c885479c3573fe86436338971e685edc95e106043f36e92e1ee6a7e86add9e86a35c8bd685916f18a7bcf08d4a7b845da41dd855132b131ccbc4a37 SHA512 b1bbe1759ec528914cbfa6b3789c596e46b6266568972b9f5d1cf13e31b7206400b65536e7acea698161e46b8ca11285b3282ebd9336d23b68d34feb4f0bf314
DIST ghc-8.6.5-src.tar.xz 19092168 BLAKE2B 2ac0926b186c43fd179170a0690492129e9ffb6651608875db7167113becf324dcf99a82f56e578c67051f813007c0ffa32ca5b12588f0d370330c8274a2d74d SHA512 c08a7480200cb99e1ffbe4ce7669f552b1054054966f7e7efcbc5f98af8032e1249fa391c4fc4c7d62cc8e0be5d17fa05845177f3cea3dbcf86e6c92d40fc0f9
DIST ghc-8.6.5-testsuite.tar.xz 1910060 BLAKE2B 71136207e3eccb4ec6756661ffa64c0a82475704c071cd8f060855a9f40d7d1fc4be2da7ff265df38fb918b8ee2ce21a54ee4b224aacaa3026ad1ddb1e1e4ab2 SHA512 980f3934bb18876cc80b80a0eb64a9ca1dfaa7f4d8b0761f5d733a6583053e38b231445388b992b26ec1ad5f569b6385dbe60f96381794f5577964979c253e16
DIST ghc-8.8.1-src.tar.xz 28634672 BLAKE2B 3a012db5d9798efddf806542a88cd9fef1d0972f7f025d377c247961cf8d8071fcf390aa130ac11f1a5556fb572499b9288a8698c49bbd594f0bb5fec4130a2f SHA512 7268b012c3a6c34e7eac05c7d6959de6005651d33e870860bbfe589295502e8794a76580130b8f4da2f88032b68116dbbdbc4c1e900e0c862aaa9891fa788bef
DIST ghc-8.8.1-testsuite.tar.xz 1959220 BLAKE2B 8606a6439f7d5b4c837b2325c4ef5705dbcea17c4b59daf7aafd0de68e55179bb2c03ce7a4f376398b185b6dbfb361d18592756558461ee43722d2142370d815 SHA512 e13b651c60deb86522efbfe8aa42679cc81a413475f70580d9ef28dbb711617c523951441a30fb46f3be9418c4c0bb4dbc522b04aaa51313afd2d39027696c30
DIST ghc-8.8.2-src.tar.xz 19365816 BLAKE2B 85dbd2a4696755f43c28ec578d5ecfe706b27ba7f640f66b464b7aa7b959ca5f02b8b51d130299c30d024c46b9ce6a115606bde46be400fb8ee221ff18177d65 SHA512 11eec0bc03254ea848a5c86bc3e2da317801a1227dd91406a157e11cb675891d77d61177b740b6df88bd823063f6cb2af5a928a7540e25392d9d0769ea121069
DIST ghc-8.8.2-testsuite.tar.xz 1976924 BLAKE2B cec6c5dab1782332aca6364f995cffc1e9f3506649c3410b6eaa220e665b66f033dfad8ab6cae7677e15a6a1bd51237ed491b7fd04a19fa1d4f9cd8904617c64 SHA512 0fc41a0b3cb5f172442863c8a3b1cf549f2f660a070965e6083baa2c90c27b6a7c17550625105799010f4329dc189f4e392c86991844a9704a3e3a72a6d4e2f5
DIST ghc-8.8.3-src.tar.xz 19343672 BLAKE2B 4b33b4a386926f0ee625c7c18a3997f02bf664b8f553d7cdfb231553bf9510f44f72c0b46911539f6209f28ecab52ee520e61e2c9e750cc217b170b3596ffca0 SHA512 7db0d820a288e56bd32935cc03584295900605f6e7cac6fe6adcb3ec6c24d8d2cebf7a8efa421f2d2fa192602d7f24dfad1ddeeba252455e4cb8baa9889dcaa9
DIST ghc-8.8.3-testsuite.tar.xz 1965236 BLAKE2B 9cd10769336513284d8e0fbca1c3fce9e298ec67eb63eb10d41087fccba0f6281f1509aee684778fd23710ffe65843c43b4042e6692940af67766056c4503273 SHA512 4ebf3eabcd7591762dfcf45716b06293fb14c00b51307f7788c90dcf4e01f67e6bbb7a887b74d8d30272919486441ac236b42a54c4874aac69d90391b76f81c9
DIST ghc-8.8.4-src.tar.xz 19395252 BLAKE2B 6fa898b9552398a724f0452f5cc88ba073264a5645288c73507258959efec40ce5a56a0eaafdabe58f15c5a9210b2c9da5954411dff5c81c52e061569d6a350a SHA512 efd23bd819f7429486696a3a929a040471db7ea8a2d1f1d832e4cf0825b9e1e0c5e6ecad0ab8376f58b74e9c28c1d2f773bd126596d6d853c9e57d57e5ceb090 DIST ghc-8.8.4-src.tar.xz 19395252 BLAKE2B 6fa898b9552398a724f0452f5cc88ba073264a5645288c73507258959efec40ce5a56a0eaafdabe58f15c5a9210b2c9da5954411dff5c81c52e061569d6a350a SHA512 efd23bd819f7429486696a3a929a040471db7ea8a2d1f1d832e4cf0825b9e1e0c5e6ecad0ab8376f58b74e9c28c1d2f773bd126596d6d853c9e57d57e5ceb090
DIST ghc-8.8.4-testsuite.tar.xz 1965820 BLAKE2B 3b715700561788b8abdc986961d533b91399461d57a1686ededb4ccc36881503cdc3fc126b9a7b204a728c24b9a9ca97320142348644367aca9b47c87a5b3b51 SHA512 79d8fb0ba8de0fb48c938bd54c8c3278f1895d8ce5c700ce8cf6b3fc550073bb757208e85d4f9818400ebecca96f51d9248b8bbdac9eb2995671756164d08c16 DIST ghc-8.8.4-testsuite.tar.xz 1965820 BLAKE2B 3b715700561788b8abdc986961d533b91399461d57a1686ededb4ccc36881503cdc3fc126b9a7b204a728c24b9a9ca97320142348644367aca9b47c87a5b3b51 SHA512 79d8fb0ba8de0fb48c938bd54c8c3278f1895d8ce5c700ce8cf6b3fc550073bb757208e85d4f9818400ebecca96f51d9248b8bbdac9eb2995671756164d08c16
DIST ghc-9.0.1-src.tar.xz 20782336 BLAKE2B 53eaf903081d705d641459fbc1e6fa7387a6039f9cd466b4708bda86e81252a84d80878d6eb956ec2e1e5b721a313e68eeb796f8345244ca62f536a7a3f0c6df SHA512 bee7950a5118be8d8cefe0db5070139a5a93ca21c5bc6f8bf453429831f0c44f5e0fb5ee569865d6b8b92749044ee4123be06920928ac7a1ec9cffa9404a3e53 DIST ghc-9.0.1-src.tar.xz 20782336 BLAKE2B 53eaf903081d705d641459fbc1e6fa7387a6039f9cd466b4708bda86e81252a84d80878d6eb956ec2e1e5b721a313e68eeb796f8345244ca62f536a7a3f0c6df SHA512 bee7950a5118be8d8cefe0db5070139a5a93ca21c5bc6f8bf453429831f0c44f5e0fb5ee569865d6b8b92749044ee4123be06920928ac7a1ec9cffa9404a3e53
DIST ghc-9.0.1-testsuite.tar.xz 2322432 BLAKE2B 350df763c607dd89ba58ad6e856d815556159a9f088dc0b069de48ae87c1e874a45fad51159e65a3c9a9beed68602eeb2a2728dbce86277bd287455f46f6c53a SHA512 13fbe0f0ab5e2426820d0fb37f0a75e1198ef2a660398508806e8ef094fd23647ca3d386815a2118168d12253d8df3273043678dbb37cf3924c689dd0fd1932e DIST ghc-9.0.1-testsuite.tar.xz 2322432 BLAKE2B 350df763c607dd89ba58ad6e856d815556159a9f088dc0b069de48ae87c1e874a45fad51159e65a3c9a9beed68602eeb2a2728dbce86277bd287455f46f6c53a SHA512 13fbe0f0ab5e2426820d0fb37f0a75e1198ef2a660398508806e8ef094fd23647ca3d386815a2118168d12253d8df3273043678dbb37cf3924c689dd0fd1932e
DIST ghc-bin-7.10.3-alpha.tbz2 183558856 BLAKE2B 2bb02aafa49c6a91bec016e8bec2d07257d602e53c9df55792ec6fbbf8e2e46de1d5f3f72c0ccf74d6bd7f7987f53412063ccb02ae85455fce11fa928cbf5291 SHA512 08709fe9b4036ab41715c9a637a2a160104e3ab9e0ed9efaaf73428e3cfe19619e50c42b72c60bbbd27be2b9c2ea68f63d72c1a27d4519756e7c0d909f724230
DIST ghc-bin-7.10.3-amd64.tbz2 112040431 BLAKE2B 3e59b70ca309a1cd704266c54a7983f9a58362bf700ced89c5649c780c664c650ec091e14026a7b84e339d2ebff39eba1772eebcd9fb4b99b9c99d179453d5cc SHA512 e1554b3944edbe8e16537de5a29132dc6a22d780d9a700cdc9b76387b94191164398d6f2242bf8199527802572e2bb02545569d4f0930a0ee0dbfdeb25978558
DIST ghc-bin-7.10.3-ia64.tbz2 238680956 BLAKE2B 08593718d376051edfb0c86131e54dafc5c15056757fbeef90c653a7d217e49ff34ffaf7cd4083144c9277e73a290b822a0f889aaf806341375708e4b92654b2 SHA512 3694011aec8a6dc37889418b318993cb82f9b46a5175dd837713f396c8f59a19a920e0b0669fe3b4ec37d5bd8837c115264c0a8fc97c5a4ce06a3bdd52fcfce5
DIST ghc-bin-7.10.3-ppc.tbz2 125832171 BLAKE2B cbf9c87200062606fddc6fa705666aeabceef954dad17166e24e181d210d7d86aad684e9af5ca05abcc89c947bea295dec3223735a6a915b680667ad32d850a5 SHA512 4eb111e3686656a83515f59d4ace8bc28806dcabfcee5201ce29aee38b8efcefaaf70c50bee55202c2d2abbfbf231a6b41df8b13199332c53055adb1754a3191
DIST ghc-bin-7.10.3-ppc64.tbz2 142469712 BLAKE2B 05e6ca2498180399dd8a1a209843dd1229a1668d7504c424b9182fff00f78ec9aa2848d562f293dd388dc983851e0e28d481b12f0ae860b5c3a36eb616c3f1cf SHA512 eb59d3abc8b10010311d59df9473c5ea649eb0dd7f9ad41a1929a540a0ef8c20abaccd68254f8abab037fb1fc94d824f474e18e4316b8f2a7a954d0645a2a2a4
DIST ghc-bin-7.10.3-sparc.tbz2 163105069 BLAKE2B 4a535472bf9ed83164f4da8280215a156b973a3a1f93a742a46050a112b7073d0a5f252686ee2ebde97140748cf3f164f33f1ba9df0b11fe2b35a86a7211b3a5 SHA512 d467a42487378d7dee311eb33aa1c151f5c16a6e7a4ab5bd8177df229f474adf19da3e1ca1064943a40abafcab6852b0589dd34413da82b33a03ede1ac17bf5d
DIST ghc-bin-7.10.3-x86.tbz2 113877175 BLAKE2B 2f3064174f82f3ad6fda615d1f47f30b11f9dbd4a4b721673e5db49013a11ba80e850a0f392460651408fd3b31f8e677f1488fe2c94160881ab34740846b0390 SHA512 75096fe9106d975c15e646b0a559c544621fd02791f491bce54926efabf0e55b97150069ddfa7a9f02cc30bb6975d3d3121a82207a9f67b8dda5ebfe17ec4744
DIST ghc-bin-7.8.4-alpha.tbz2 210691009 BLAKE2B 7a59cd1dbbe76fcf37ec7d1b2e81a76bd35f268c10614890cc8a39dcd846f6e5fb524ce1851036c315a9e5fe219d3abbb78d55f3e93f4ab5ad1dbf6c946146b7 SHA512 f08230de82f0c4112da9d0b48227ca74d5d0b4a84046d746b023557b7aeeb9678f5ac037fe89a863178df4b9036e5c5c63182d14dfbb42c772011de883e3966f
DIST ghc-bin-7.8.4-amd64.tbz2 100573133 BLAKE2B da6bfb26eac8ef6c996ed10a56da9c535fb5fff4c69474de2cd979fe185876059f9e87940d24db8c52a0f04e81cf312982da75d04f3b96e7a11f2f134b512058 SHA512 e4416d6dae3c644f74bafb3aecf1a123f985427aba32d0e0c43143a137d64a9220fc5947cd9bde8a3bc44555ae71184fc06a3f7df7976aadd065ad5681b90954
DIST ghc-bin-7.8.4-ia64.tbz2 222789275 BLAKE2B 2e0fc3ea11885b739156dcfbb4d52ded6492bf992ea18be2f91302d82e541a4de52e4bbe215f4d0cdbe54b32aa59e142ad10ae2fb20e8f0dfea22368a88620dd SHA512 2d8b89e399cbe9bfeae29cf3ceea736bfaa65ea21483fa2ee95d9814e122fcfbb67ce22ad8175493fab088e9a9d0139610c67e9d5c8b4f797b5e14846df32b6e
DIST ghc-bin-7.8.4-ppc.tbz2 112803496 BLAKE2B fa60eda8b87dca0e23cbb971bc1f361f280735846cbe628e632981dc86baba0e877112e5c03d09fbb7f256cc078f8bf3248007c013208dab41c5205a82fab494 SHA512 9581f55a088e53edcc969960e45c9ad7227d71198ce2d241a4a066a138450a879287e55e7d2210e86143670539711387e36c7f60660c4422dc1b4122278fe4a0
DIST ghc-bin-7.8.4-ppc64.tbz2 129284515 BLAKE2B 2e9a1e70830930dda7dcbd696ef3c27e7b64d571042cc0fc26bed42d13b9707ffeb337ffab38e2e04a7dabc56d8305fd77df508928d61fd0c653945afac8984d SHA512 53974e15c26cf6b62d8f838607abd209ec57cf0f45fcc48b90ad62736f5e4e7ff263dcd326ae03d8d5557a22eb9730e5eb8ae4eda55e52dd3d973bc73c84935e
DIST ghc-bin-7.8.4-sparc.tbz2 147340595 BLAKE2B 8e39d6b144f4fce5196ad758f89887476e0482e8b98a012874d293d5e57756659cb9acb897476593a28f98f5c859548efa2e130f3806bfa2bb9e74795078a506 SHA512 ee5f0b2f1cf2693a0f2be9df71ef61b52bc2327225d40b8be955c1584b9901ffc6aaab63c1e46bf9bb352633b605c98378f8fd3e6cd71aef1c089007e4110217
DIST ghc-bin-7.8.4-x86.tbz2 102312459 BLAKE2B 256cca9b2353af30dd7c239db0e21781d9d8aa352e38b3dd678b1429be6251e81f8955ac6ee0f766cc55f4de71c68acd98bc7b9434c3ea4b056d446ca59adc97 SHA512 cabc5bd6d8760ce4120e7053f6c1dffca7d161ba454b6201087760096c037c932e3ff8c82e53346c8278855bf0cff1c2f5fb8046242ca4d8307355b060a9556e
DIST ghc-bin-8.0.2-alpha.tbz2 234361847 BLAKE2B 8e3439f3bbae1d3f6ab71f69669ea065f5f36c9cb4b334f06161cc1b9507aae56297d5eeb8a9cf72916aa012fab0b444a179a0336f00d5f17a8d402d5807c6f8 SHA512 c8b588feeab85f7b8fd60e2e8bf755d46790d4882d2ecf6b2c8b8e02c62a11b7e6453bf0cfbc646bfbf24310fdc775337f3957ba5783675a271b68f0af2e9070
DIST ghc-bin-8.0.2-arm64.tbz2 191332951 BLAKE2B 305c4d618a6221e1322a5665544883624de4646e0186c6eab56d0b32877645f0b2bad8381848914751fbd2e11598727c46ab136de74c57207b75ecc6cce9572a SHA512 b9cabfda8fc6e851ba99f53274c1a63c5a6a365311a9203f1247ecf90ab843dd94960ad44c4e67032f4690f07d67bfd8bdfbe59f857d6c63344430539e2082fc
DIST ghc-bin-8.0.2-i686-pc-linux-gnu.tbz2 133679542 BLAKE2B c50597857b53a2bf9d8047c048f86aa1782f74d5d9816d44b7bad7302181b407257ad0b52a03b4ad4936de3a15010b0ff5ca877b9578af6d3e7684dda2284718 SHA512 7f33e0b20a21fe076db142a58a81f68ab8f230ac9ce0167aba31aa0843bce20a9cf4065acc1c0ee2aaa01ea2ad4a8234388b0cf3ef886dccf25d7072602b430b
DIST ghc-bin-8.0.2-ia64-unknown-linux-gnu.tbz2 256581880 BLAKE2B 7a9b41fccf3a097a19e169dcd8f553d38ffb96ebce3a3f0df15af79de77f6e33835a955fb7cc2c373f7bb6bfd3508a45ecf19f8b3e74bb058d2d6cdb6576bc6b SHA512 5d14521cc4f2a8fae1e5f43fce70cb976e4412df468c3bc611c99f57806816c349f4186c8a064c579858a82cc070e5942dd7b0c2d57b88d507215acddcbfcfc1
DIST ghc-bin-8.0.2-ppc.tbz2 144760090 BLAKE2B 32410f3563f7f2555350806db460d2083c7248c57223c9c681d0b4913df942f023c7c1f5fda145179a524ee7ef105a9b8309ba87c20dc393a9f49151579b6767 SHA512 bc6bf8998064ffc1692c3bb83c44d1787760a3f4a1e6b79dedaefda5fe32b9052049a60f0ddd3c0b0bd24a722fb35e310e0189b3511721ff89d4d02b3d7c14bb
DIST ghc-bin-8.0.2-ppc64.tbz2 117432068 BLAKE2B cae202f0d6e825127d543996b2fe7ae02578c47325674cbf22fddc53b1c4c9413f45c60d76ec3d07860cb8d0aae1ec792e4141822cc5c08ef9013308c5d29bf5 SHA512 0eaff0557b68649a15bbeb2019f46fa9e9e7b8a916aa210ab56888090a5b887d20d818e7987177bc6a8e7fde503de560026e6bb55fe39679b8b1ee13c6b7c4f9
DIST ghc-bin-8.0.2-x86_64-pc-linux-gnu.tbz2 130852973 BLAKE2B 24d2032bbfc664d924800c1a317334e2342c8ec1e529178f9d1bb99bb4772a9cc100603bf70111b8cfafa715c1cccc643f115c77cf6adcdfb17d1f1735ee6682 SHA512 c36e0e2600fc7c284562a323d396a03062cb6e8fa63c353e672be61e76d2ec5c7698485e3a370a57cf512db9e5ba6a68338fff2ab404d9fe67b1a468ed72638f
DIST ghc-bin-8.10.1-i686-pc-linux-gnu.tbz2 123398571 BLAKE2B 3650f9dbaaa5af684abad589953bcef5b1684a91a4cc2695d0ef735536057bb031231fe3d73dd74bc38a199f0890ef91764b551e5e158c120affc0d7bc3175b7 SHA512 52cc172de08ef30d6e89384e86eda1b8bbdef2bbff526041eb47d85d77b70ab49314ac7f33f18b40864c16fa546256f1b4c7964e65aa5d3cfbb7f9cbec505dc9
DIST ghc-bin-8.10.1-x86_64-pc-linux-gnu.tbz2 122227601 BLAKE2B 84340866c70044eb1444a70b0cbed6814808037b697db28f567d2b14bb791cbe7d9bf2a327cc47ae85ce3c4970ba039854b4a6df44eb85cdc18040c5a4d15f4f SHA512 81df9de95aec47d60ad8d699756ad323eb525c3a16536fac8c6717e1754272061bd8d7d70cd38f5c509a2fc323305333e4f898c9b6dc27645521bb29ee218bdb
DIST ghc-bin-8.10.2-i686-pc-linux-gnu.tbz2 123683156 BLAKE2B a486076ea6e67f124c850e037be0e63a873181c3fd746f437861f7367a968e0df6723afc934c966432274a55936c0fe48a9a43a48199840b37636843da4caccc SHA512 29cc1703bbdbfcbef8aa2a5a563b83b0663970f5902a1fc70230515a128ef47e27a3a6df2b47a01009c3976b4936cf8e64e5da4dfdda0c1bcf73ab7ea5ac0b6d
DIST ghc-bin-8.10.2-x86_64-pc-linux-gnu.tbz2 122818630 BLAKE2B 030a68e2aca0eb0a273e0d48a3e180d92b219b2d1826d1d58fa133d0a6cae1316b3ccceadb55a4fa5870f87c3df85df2998e7611b93dbc1fea592437748b2daf SHA512 23bf47ee45fae54a843de9e6991b67fccb79c14ad8d08eff9f38a68a3530496c8ce4bc8cae8a731bb690ddd6cd0bf36d6d5bf37eb68ddae8ce646a0bf3916d8f
DIST ghc-bin-8.10.3-i686-pc-linux-gnu.tbz2 123802832 BLAKE2B a770dd43bee7a1d60fec2eb9aaa7de715eed01c19d9514e04678801827879977a5c91f5e191d026ca83aa5e5fc5f518593053b2e78b27b08df64b39058dbaec3 SHA512 f810432a56ddcd773e6118f038cdacd2f5e3a508d87bfa468ee861aef0cfc434ec5766a8a74360d8cec6cb9c664928290901c025496100e7c8465408635227f5
DIST ghc-bin-8.10.3-x86_64-pc-linux-gnu.tbz2 122993247 BLAKE2B e3395ebc7e87b4ae8f66dbbd9441c214c4d9535e55bfb14f78ebb92d30b1e100efc4893b3cdc65564d47bd53a21cb30106572b3fce13be022946171112c3218e SHA512 2ea4295bcaf6e3fd0db54ba67465e979cd85d3370c6c49f2381478ae9824ad89df53d7d93ccf06bdff5f4849f14306c9f50c13e6f6ba45f79e5b8c13ad63ae4f
DIST ghc-bin-8.10.4-i686-pc-linux-gnu.tbz2 123831294 BLAKE2B 1ca4c1b5c34c948011049a73d409c741db89658d10e311cffbe464c631c3733278fc7dede6ad27474832295ded2c26fd4d6419c760505255e29f7cb232a670a4 SHA512 1f87cf63651f7c0e5f7f55d1f4d7d7c48b0a911cc6673a899d4b92190d765b359f9c7d73c329969c1b76f1af102b7e2c18a80382c81d5dade9ac7dd57de4ef65 DIST ghc-bin-8.10.4-i686-pc-linux-gnu.tbz2 123831294 BLAKE2B 1ca4c1b5c34c948011049a73d409c741db89658d10e311cffbe464c631c3733278fc7dede6ad27474832295ded2c26fd4d6419c760505255e29f7cb232a670a4 SHA512 1f87cf63651f7c0e5f7f55d1f4d7d7c48b0a911cc6673a899d4b92190d765b359f9c7d73c329969c1b76f1af102b7e2c18a80382c81d5dade9ac7dd57de4ef65
DIST ghc-bin-8.10.4-x86_64-pc-linux-gnu.tbz2 122558873 BLAKE2B 9f07c7bdc3beccfa629d28b2524ccd2f4688a5c0036a45408f5ace2d530a2a0e42f95b3cda5037ebb365317999e1ae776c6f9d21692867abfe85e33f2892b1be SHA512 68bd70f94961547746a696aa2839e156c95858fda0c7ec5b2ecf802070724ab7102b0aa86bcbf93432170d521cce4af10f46b851b470e5dc49dfa5b07380f46d DIST ghc-bin-8.10.4-x86_64-pc-linux-gnu.tbz2 122558873 BLAKE2B 9f07c7bdc3beccfa629d28b2524ccd2f4688a5c0036a45408f5ace2d530a2a0e42f95b3cda5037ebb365317999e1ae776c6f9d21692867abfe85e33f2892b1be SHA512 68bd70f94961547746a696aa2839e156c95858fda0c7ec5b2ecf802070724ab7102b0aa86bcbf93432170d521cce4af10f46b851b470e5dc49dfa5b07380f46d
DIST ghc-bin-8.2.1-i686-pc-linux-gnu.tbz2 96157437 BLAKE2B 2b9608845db8cea78db07209fa054b3b05085d5c3ac07cbe3de02a93c87fb0cff12b1820f08757221c59c8a0a9e7a5563c44266b181525d916825e5cf5bac34c SHA512 e891e76557fa61853e28829b8bedc4a6abb92954f90cc1ebcf22a13cc137556bbe9262e7398b7e1aedbabeb997916b008bf1561a52f16a569f3d58ea9404f41e
DIST ghc-bin-8.2.1-x86_64-pc-linux-gnu.tbz2 97490496 BLAKE2B 3666ea70cb8b3645db071040d2069fe244042c11954b34e5d92aaa90132d2316c0ee8c176cd4e674772bea3b99df150404f62bd8745c046cdaf102ecf0a0fa54 SHA512 52630a185d0eab56bce0469a612a54109895bfee041ec362ced59a9b35ba3b9c185e86bc7dbf0a5939081d3626baa19fbb3306e36d1857530248a7b9bfc100bb
DIST ghc-bin-8.2.2-i686-pc-linux-gnu.tbz2 96638908 BLAKE2B b470f838e77330969f162196b0f1035fa764f5d123687fbf67c14323280bfe55216af0e16f8b79c62f290905d96abc8bfafee650f8d27c81608853e78329b2c9 SHA512 15b1525890477539878385efc15ce5f1cf2f126cc785c42923be958cabe3298cebe73526a2370cf4c630124160a7ca0f0f9062aebbf035dce807a0374eaddd14
DIST ghc-bin-8.2.2-x86_64-pc-linux-gnu.tbz2 97696152 BLAKE2B b481cfea186220ee402f9f215dd48b002288766b643f3d8352579735347136c6349d242a9a56728d88ce80f72367dc9fdb6e40c47a0331910dadbb9a4998e17b SHA512 531df6505e8987fb5c5cc0aac59adc6aa153a4757b96936d3f09f27f3614589ff41c227568b780114b2e87c6c8656f2c88683cce86925628d12723f14b893eff
DIST ghc-bin-8.4.1-i686-pc-linux-gnu.tbz2 116995839 BLAKE2B f94f2206d603d57f7fa64bdf63bcd2528019284fbf6641273ea1d8c62324e2f0b26b2cfa50c6ef96e12beba550bcedd17aa824e7cf9a27c794e962526326e105 SHA512 8167ea80fa627a1b55d28363513ac79985229326019288e7334cc87c3017d39781f4d129081d62da112420152a41d23d2dffb0c13721b80cca72d2a21fbd2c0a
DIST ghc-bin-8.4.1-x86_64-pc-linux-gnu.tbz2 117369638 BLAKE2B 583db924a50a3d7d261d2f392a74e0ff487ee662af055ac292ff1943534fb305d6c9f6f0045ba4bdd5afa268d75beb50f64b4760e49cddabe1f56776a5f4769f SHA512 801f4ecd538c7a035a0f573f301769984814fa3ce4cf5b09a914ba012bebe0583b6695a6a93f92c7e6e2b7d58caf812a1214b5b778d7b7835d7eab988ad69ba0
DIST ghc-bin-8.4.2-i686-pc-linux-gnu.tbz2 117083472 BLAKE2B 7dac18523ed693efb0ec42b31bf7b910e6bb8289cdc13eb309bdb30230fc87fbb060baf41eb4f18af2bb265b42e6aca535ceb70cf0fe09046b0e4650f11bb37c SHA512 f9799bdf7a2a66d1db34b828860203872d7398bab2d667e8982c9ee89301654c3f7f54705b639df2d7adebcfb7a05e071b83d994f5e52a72f604b62098be51cd
DIST ghc-bin-8.4.2-x86_64-pc-linux-gnu.tbz2 117604406 BLAKE2B 644ef535497eb73a2d1ceaab7ff96228e8d4021c09bc061a3f397dc27b3b86bd6d5300736e478671cee0a160bfaa5aa4611f06012285079b40973f468b59664a SHA512 7bf4bcdce954319422b8b8f09e56294012fac145662ba3de1c7765ed86ae9f8b61dcf6dd8febcf85d60db8d1a26edcaf4e89c3644ffa24c7b5b5c41a14105936
DIST ghc-bin-8.4.3-i686-pc-linux-gnu.tbz2 117028296 BLAKE2B 0c99a2f6fe4af4a1342d948cbda53b178fe9709673e0d09bc3b6a4e0f3ec4e4b8f77830829f149993f51e490692de39024900fb188116816e41441153eac3622 SHA512 13147ae0d6b941b3bc2f0239071a2f6f854a39cb6a381f0e2fda7069ac29bb2c64fb3ccc6191e7527b5f27fe616bd62f2e487b5d50679789927b401f02c62ad7
DIST ghc-bin-8.4.3-x86_64-pc-linux-gnu.tbz2 117537996 BLAKE2B 2be0102fcc0f1fef5aae194620a43c1c90538215d4eec2550419634ed9c5bbfb17391d57519c20ab53987a36b42488ac43ff968690a4f65b96c52c3485589d10 SHA512 5f26810ec1f0a483f03ef01f56130eba0287b49b912efba03158336ce521000b611192cf021b72c1a0d902532cc4c9470ca1b3233ccba7c7e7c2ac490c6099fa
DIST ghc-bin-8.6.4-i686-pc-linux-gnu.tbz2 121639881 BLAKE2B 51d223b654ff23bbdd594801f4ec92b016a58b952ba98007abb56c1c4b184a672e51eb9847b42160febcc4ada0f28f18325cc27f8a025dd9fcf656e3bab73918 SHA512 6b58b080c5fb18ea7b76632b4b48726af61b52d8829f57a2ddd55e6bc109c1fe1a133d2a0ca974a168ffee0013a6dfdc4922577bad01c50a42dad8b9db70e061
DIST ghc-bin-8.6.4-x86_64-pc-linux-gnu.tbz2 121695747 BLAKE2B 39c745f5f9946bbae622e09bbdabdde4d62eec472fe14e693f37cba6b93ff66e4e56f66df8f0f073686339d252dce71f79f4c2aaef620c3dffbc26a67b1119c3 SHA512 c60bac50e7879bda1d6dcc7c1f12fdac915b18c3ebbfcfad575b2b01fcb57a487496ce7935f7ee4ae934162209ab66370fbcc8a4f021628e5f9a2aa7ef95e119
DIST ghc-bin-8.6.5-i686-pc-linux-gnu.tbz2 121938050 BLAKE2B 17b6d15af21390e28a025505da76d39a2f8656f74c88a81fc75e7c8e799e54171c0d964d8a977c01576603a781c139b5363ea79eeaa2252622913d2a08a79f0e SHA512 9eb33b4670ee15f53c988885a119f3ef7be896ddcb318019628cdd04e21ec0c61876e08466d9d10d6cb1e16d89cd318e0ba42f0f0ae512f48590fe87483739cd
DIST ghc-bin-8.6.5-powerpc64le-unknown-linux-gnu.tbz2 173549697 BLAKE2B 296bf4e0745f56dfefc3ffc96b4e492ddbfd8bcbbc28a8bc9b3172c616d0e7da1081834384ab69e387808331b607104f015632d59963a87f4e257f290ff286c3 SHA512 81261614a7939adb0ffad3657cd33588ff729bb1e3a7dd228cf869afc1f21b74cb4dce6369a4c4cdc9f45f8d8ae64f25d71cd0f2dc34f36d3022afc149538a78
DIST ghc-bin-8.6.5-x86_64-pc-linux-gnu.tbz2 121728723 BLAKE2B 6620b2a116b5696dd2d776350a43251c093e117338a4407ae8c41ae27763a4614d7e761b2684b90aa9317dafe7cb67481a6bc141c812d335d5231724ae3db2a7 SHA512 69681eab137f6713339f8912d0d92f6af865630053bcd7a32cb8a31e01628e969951db976533196794fe39e0e57f0fcd8778d9fc9fed4f4231e965b9a603dd8e
DIST ghc-bin-8.8.1-i686-pc-linux-gnu.tbz2 120789855 BLAKE2B 386f37696d956078fad5cad50cbf5b9d9d7765615a1d9cc91a376fb5394648afe8ca956e24ef210f2ff0e51f339b63b16a50f6dc35f30babf019aa57de50b27b SHA512 193c29889693befba863d3c5a26d38d8182bb7e1932b61115dc0a21b6582f818b05db144a9fae5aee06af2044ea59f884825cf1081b62a1c67feb3041d184d3a
DIST ghc-bin-8.8.1-powerpc64le-unknown-linux-gnu.tbz2 173653088 BLAKE2B 6c29777b596b35fee8e3a17f965e6a21dc40dc2387988f55d4ca5fef0ea9677b558ed210054216a6578b93fbf844df9e407770df184f707f8203f846f4929d2d SHA512 d338b8912c1632410c43a0df75ce69f961924a7c51049a3ac27c22f7c6cfc07388815813713d594fc38b721127df80b65f72b1b0cc6fbf0e10fa15970b8b6f46
DIST ghc-bin-8.8.1-x86_64-pc-linux-gnu.tbz2 119317594 BLAKE2B 98f0fb262ac485dcfd6a8a67304912ffad2bf2634111fcc3b60346697a836867006bbacaab1e1be0cd5be34b4595d12bec13af644c451c10f7e3843ebaf5922f SHA512 e6acb11755db18fd86a346de642b8579a6b48b303c19795949757f5e351ad3b8892906e989dc57a7fd4471d0efe30fc8175df5bac741d7faecfe42a855a67980
DIST ghc-bin-8.8.2-i686-pc-linux-gnu.tbz2 120289601 BLAKE2B df65bc6aa4ee22c979b9d8eda29f51188c96700d61fb4cf141ebad8a55e26b6cd959fce3ec0b8d780b68e7baf15a1ce7654dc4ef084aa4671fe05f00f9c4e9aa SHA512 da059f3fea00e14df346143e714da6484ae51d362d9e237607817791e02ec81e29e1ff7f9929fac44044f63196b395287c42f5829884c34391289179b4f6e204
DIST ghc-bin-8.8.2-x86_64-pc-linux-gnu.tbz2 118957404 BLAKE2B cddedbb0fe8d38e9821bd8f51f5177d35922b25bf4fc8a537e921443560f141cdef44e54a0b4ef2dde07dbe33d9c1cba2e67ba80db4313f67e9bac089d967f56 SHA512 b0b801dd6abe9f5e6217e18568e2911dbfea11b1b45ff526950e87c73a34bcd597afc5105fcff2dc46bb13cf95e63db90c0d24ca9babf174b397a53001e8e0ac
DIST ghc-bin-8.8.3-i686-pc-linux-gnu.tbz2 120243899 BLAKE2B 7f932523a71dcfd4cdd468bf67f470a942c314888c0093c21c211d54b3e158f45f051f027c78644a651047d81e809e1422bbaa5043e8559c6a4622ac0472f7e4 SHA512 12bf08b85652fd061849b9adb528d7a5c6fe9c2260cf02b92fab470fff16c3121bcb4e0f7044d05f252012083d622a1a490fa7f7c949142a3b5d03ccf0dd3ebc
DIST ghc-bin-8.8.3-x86_64-pc-linux-gnu.tbz2 118988294 BLAKE2B 4e5aa3844934ae2726bf9c8690acd5a887f10cd49386ffadbc536f9309d33b3894b49507964eaf0d8a052747eb33aeabbe4d2cd22493297c295cf9414fcb766c SHA512 dd656157fe744c1df1c8ed34d1129ec358b26f3042c6da68e704e0f6a45d8114789000479e28a06dc16961afb283b3c666b427025590498a3d2da9b741b435c7
DIST ghc-bin-8.8.4-i686-pc-linux-gnu.tbz2 120336081 BLAKE2B 55dfbb90d5e55c2af5e93c69249828a85cd9171c164b80dfdaf86512972b2c6854c8e4f07426af4ab52a5fb1a85d96a58c2cf003fb02372c55428001cfaea491 SHA512 ad3b83344349976d3253934195b2dc6299648391572b13735943c5ea2239c031c19b0cafd86c16cfb0c061e73bc72e9248f9c1731494a9a15fbe188f02913c12 DIST ghc-bin-8.8.4-i686-pc-linux-gnu.tbz2 120336081 BLAKE2B 55dfbb90d5e55c2af5e93c69249828a85cd9171c164b80dfdaf86512972b2c6854c8e4f07426af4ab52a5fb1a85d96a58c2cf003fb02372c55428001cfaea491 SHA512 ad3b83344349976d3253934195b2dc6299648391572b13735943c5ea2239c031c19b0cafd86c16cfb0c061e73bc72e9248f9c1731494a9a15fbe188f02913c12
DIST ghc-bin-8.8.4-x86_64-pc-linux-gnu.tbz2 118897883 BLAKE2B a180b2dd1a3bc222044ece809ad700aee29d0c3e75b57ee9af3ca33c9c0f59dbf36f68202f746d99f80915cb717a9c41fc12db507f1cb469981732703a06b9cc SHA512 9d4be02dbd9704c93ef18feb92ea30bd5d590df31f288bf1b364818424c5019ca9ada26eec88418199f90ae8f4459d0a9352104e3f3186bbdc241891eb1b66c4 DIST ghc-bin-8.8.4-x86_64-pc-linux-gnu.tbz2 118897883 BLAKE2B a180b2dd1a3bc222044ece809ad700aee29d0c3e75b57ee9af3ca33c9c0f59dbf36f68202f746d99f80915cb717a9c41fc12db507f1cb469981732703a06b9cc SHA512 9d4be02dbd9704c93ef18feb92ea30bd5d590df31f288bf1b364818424c5019ca9ada26eec88418199f90ae8f4459d0a9352104e3f3186bbdc241891eb1b66c4
DIST ghc-bin-9.0.1-i686-pc-linux-gnu.tbz2 122955511 BLAKE2B b870f46cc78fcc1d715aafe7108951582cfd12495b4e9d804d4b66562c66a6a2b2d9513031aedc8f3630a0cdbb3257943304b05732301a084f89487452f2f2d9 SHA512 aafd4233c40f93b71e6ac1acc8a75e30d49b826e4bce6d9832836966fd5f6c4898963bd4c2f34577f4199c1d9a3f537ac1e7d87eab11e9fb5e849573580ed3fb DIST ghc-bin-9.0.1-i686-pc-linux-gnu.tbz2 122955511 BLAKE2B b870f46cc78fcc1d715aafe7108951582cfd12495b4e9d804d4b66562c66a6a2b2d9513031aedc8f3630a0cdbb3257943304b05732301a084f89487452f2f2d9 SHA512 aafd4233c40f93b71e6ac1acc8a75e30d49b826e4bce6d9832836966fd5f6c4898963bd4c2f34577f4199c1d9a3f537ac1e7d87eab11e9fb5e849573580ed3fb
DIST ghc-bin-9.0.1-x86_64-pc-linux-gnu.tbz2 121542968 BLAKE2B 837870e68138f8d97dc8b2aae90090cf02416628602ca4ba4417ac92b49155f10028b05ac465665b8872b32372a5cee075616983f2eacdebb0188bd2ce6a93d2 SHA512 0e8c6d2e6f32fac95588f7323a4e02dddfc9ec2476a82b97bf5a106d3810f7e638fda7124c53b5bbc563fce70f4436553c282d8ea2f1f5fdf4fcccfb15a2b079 DIST ghc-bin-9.0.1-x86_64-pc-linux-gnu.tbz2 121542968 BLAKE2B 837870e68138f8d97dc8b2aae90090cf02416628602ca4ba4417ac92b49155f10028b05ac465665b8872b32372a5cee075616983f2eacdebb0188bd2ce6a93d2 SHA512 0e8c6d2e6f32fac95588f7323a4e02dddfc9ec2476a82b97bf5a106d3810f7e638fda7124c53b5bbc563fce70f4436553c282d8ea2f1f5fdf4fcccfb15a2b079
DIST hoopl-3.10.2.0.tar.gz 241940 BLAKE2B 0ed7bf80486767c81415f99da8780a525401c388dea0b3f380bbecceae9cc7f66d8b5d0d7b31f8cb41796309b7a93adb113485efd14882f8af321989ce900a9b SHA512 083baa8a5eb53247aff8d5b9b2144e0f63adb9400934297bbd80bfcec607dd90a34def4301045a60472ef10b0fb90ab84692fc08f786e7f806c28afdab1ef66a
DIST transformers-0.4.3.0.tar.gz 28632 BLAKE2B 92cabcb654bb11854a3bffbb1262f5cd62eda1aff447157086a61ebc451ebf2fddec53b6a2cc058174f24f0f0e32df671d3717e30a542c8dc90cb87e327d990c SHA512 c3ec0893ebba4fbd6087c3202e919552c4a9bff3350b5c0589e7ebb18751a515d98b8cac15b0a3252906ea72b5a0eb09b7fe88c8da88b09d6ce4fbf0f50b2780

@ -1,674 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=5
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
#
# 'CTARGET' definition and 'is_crosscompile' are taken from 'toolchain.eclass'
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib pax-utils toolchain-funcs versionator prefix
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
# sorted!
arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-arm.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PVR}-amd64.tbz2 )"
arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64.tbz2 )"
arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PVR}-x86.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
alpha) return 0 ;;
#arm)
# ewarn "ARM binary is built on armv5tel-eabi toolchain. Use with caution."
# return 0
#;;
amd64) return 0 ;;
ia64) return 0 ;;
ppc) return 0 ;;
ppc64) return 0 ;;
sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=7.10.2.20151030 # uncomment only for -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? ( https://downloads.haskell.org/~ghc/${PV/_rc/-rc}/${GHC_P}-src.tar.bz2 )"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
"binary 0.7.6.1"
"hoopl 3.10.2.0"
"transformers 0.4.3.0"
)
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="doc ghcbootstrap ghcmakebinary +gmp"
IUSE+=" binary"
IUSE+=" elibc_glibc" # system stuff
RDEPEND="
>=dev-lang/perl-5.6.1
>=dev-libs/gmp-5:=
sys-libs/ncurses:0=[unicode]
!ghcmakebinary? ( dev-libs/libffi:= )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses-compat:5
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
PDEPEND="!ghcbootstrap? ( =app-admin/haskell-updater-1.2* )"
REQUIRED_USE="?? ( ghcbootstrap binary )"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
if is_crosscompile; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
# are not built with fPIC, bug #606666
gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
tc-is-gcc && version_is_at_least 6.3 $(gcc-version) && if ! use ghcbootstrap; then
# gcc-6.3 has support for -no-pie upstream, but spelling differs from
# gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
# hardened users try '-pie' in USE=ghcbootstrap mode.
append-ghc-cflags compile link -no-pie
fi
gcc-specs-ssp && append-ghc-cflags persistent compile -fno-stack-protector
# prevent from failind building unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
# fix the similar issue as ppc64 TOC on ia64. ia64 has limited size of small data
# currently ghc fails to build haddock
# https://osdir.com/ml/gnu.binutils.bugs/2004-10/msg00050.html
use ia64 && append-ghc-cflags persistent compile -G0
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${GHC_PV}-orig"
cp "${WORKDIR}/usr/bin/$(cross)ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/$(cross)ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/$(cross)ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/$(cross)ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/$(cross)hsc2hs" \
"${WORKDIR}/usr/bin/$(cross)runghc-${GHC_PV}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/$(cross)ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/$(cross)ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/$(cross)ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/$(cross)hsc2hs" \
"${WORKDIR}/usr/bin/$(cross)runghc-${GHC_PV}" \
"${WORKDIR}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
pkg_setup() {
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.bz2 ;;
esac
unpack ${ONLYA}
if [[ -d "${S}"/libraries/dph ]]; then
# Sometimes dph libs get accidentally shipped with ghc
# but they are not installed unless user requests it.
# We never install them.
elog "Removing 'libraries/dph'"
rm -rf "${S}"/libraries/dph
fi
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/$(cross)ghc-${GHC_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/$(cross)${GHC_P}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# much arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise epatch will break
epatch "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
epatch "${FILESDIR}"/${PN}-7.8.2-cgen-constify.patch
epatch "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
epatch "${FILESDIR}"/${PN}-7.10.1-rc3-ghc-7.10-bootstrap.patch
epatch "${FILESDIR}"/${PN}-7.10.3-relnotes.patch
epatch "${FILESDIR}"/${PN}-7.10.3-hardfloat.patch
# Since ${S}/packages does not include base, etc. add them to gen_contents_index
sed -e 's@\(for REPO in .*\)@\1 base integer-gmp integer-gmp2 integer-simple template-haskell@' \
-i libraries/gen_contents_index || die
if use prefix; then
# Make configure find docbook-xsl-stylesheets from Prefix
sed -e '/^FP_DIR_DOCBOOK_XSL/s:\[.*\]:['"${EPREFIX}"'/usr/share/sgml/docbook/xsl-stylesheets/]:' \
-i utils/haddock/doc/configure.ac || die
fi
bump_libs
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
if use doc; then
echo "BUILD_DOCBOOK_HTML = YES" >> mk/build.mk
else
echo "BUILD_DOCBOOK_HTML = NO" >> mk/build.mk
fi
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
if use gmp; then
echo "INTEGER_LIBRARY=integer-gmp2" >> mk/build.mk
else
echo "INTEGER_LIBRARY=integer-simple" >> mk/build.mk
fi
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds 'gcc' it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
is_crosscompile || econf_args+=(--with-gcc=${CHOST}-gcc)
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
else
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
elog "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# 1. build compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 3. and then all the rest
emake all
fi # ! use binary
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
emake -j1 install DESTDIR="${D}"
dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if [[ ! -f "${S}/VERSION" ]]; then
echo "${GHC_PV}" > "${S}/VERSION" \
|| die "Could not create file ${S}/VERSION"
fi
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,600 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=5
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
#
# 'CTARGET' definition and 'is_crosscompile' are taken from 'toolchain.eclass'
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib pax-utils toolchain-funcs versionator
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
# sorted!
arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-arm.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-amd64.tbz2 )"
arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64.tbz2 )"
arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
alpha) return 0 ;;
#arm)
# ewarn "ARM binary is built on armv5tel-eabi toolchain. Use with caution."
# return 0
#;;
amd64) return 0 ;;
ia64) return 0 ;;
ppc) return 0 ;;
ppc64) return 0 ;;
sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=7.8.3.20141119 # uncomment only for -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? ( https://downloads.haskell.org/~ghc/${PV/_rc/-rc}/${GHC_P}-src.tar.bz2 )"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-ia64-CLOSUREs-regenerated.patch.gz"
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="doc ghcbootstrap ghcmakebinary +gmp"
IUSE+=" binary"
IUSE+=" elibc_glibc" # system stuff
RDEPEND="
>=dev-lang/perl-5.6.1
>=dev-libs/gmp-5:=
sys-libs/ncurses:0=[unicode]
!ghcmakebinary? ( dev-libs/libffi:= )
"
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
sys-libs/ncurses-compat:5
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_DEPENDS} )"
DEPEND="${RDEPEND}
ghcbootstrap? (
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
>=dev-libs/libxslt-1.1.2 ) )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
PDEPEND="!ghcbootstrap? ( =app-admin/haskell-updater-1.2* )"
REQUIRED_USE="?? ( ghcbootstrap binary )"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
ghc_setup_cflags() {
if is_crosscompile; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# hardened-gcc needs to be disabled, because the mangler doesn't accept
# its output.
gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
gcc-specs-ssp && append-ghc-cflags persistent compile -fno-stack-protector
# prevent from failind building unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
# fix the similar issue as ppc64 TOC on ia64. ia64 has limited size of small data
# currently ghc fails to build haddock
# https://osdir.com/ml/gnu.binutils.bugs/2004-10/msg00050.html
use ia64 && append-ghc-cflags persistent compile -G0
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${GHC_PV}-orig"
cp "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
"${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
pkg_setup() {
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.bz2 ;;
esac
unpack ${ONLYA}
if [[ -d "${S}"/libraries/dph ]]; then
# Sometimes dph libs get accidentally shipped with ghc
# but they are not installed unless user requests it.
# We never install them.
elog "Removing 'libraries/dph'"
rm -rf "${S}"/libraries/dph
fi
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# much arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise epatch will break
epatch "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
epatch "${FILESDIR}"/${PN}-7.8.1_rc1-libbfd.patch
epatch "${FILESDIR}"/${PN}-7.8.2-cgen-constify.patch
epatch "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
# bug 518734
epatch "${FILESDIR}"/${PN}-7.6.3-preserve-inplace-xattr.patch
# fix threaded runtime on ia64
epatch "${FILESDIR}"/${PN}-7.8.4-ia64-CLOSUREs.patch
epatch "${WORKDIR}"/${PN}-7.8.4-ia64-CLOSUREs-regenerated.patch
# upstream backports
epatch "${FILESDIR}"/${PN}-7.8.3-linker-warn.patch
epatch "${FILESDIR}"/${PN}-7.8.3-pic-sparc.patch
epatch "${FILESDIR}"/${PN}-7.8.3-ppc32-fPIC.patch
epatch "${FILESDIR}"/${PN}-7.8.4-gold.patch
if use prefix; then
# Make configure find docbook-xsl-stylesheets from Prefix
sed -e '/^FP_DIR_DOCBOOK_XSL/s:\[.*\]:['"${EPREFIX}"'/usr/share/sgml/docbook/xsl-stylesheets/]:' \
-i utils/haddock/doc/configure.ac || die
fi
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
if use ghcbootstrap && use doc; then
echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
echo "BUILD_DOCBOOK_HTML = YES" >> mk/build.mk
echo "HADDOCK_DOCS = YES" >> mk/build.mk
else
echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
echo "BUILD_DOCBOOK_HTML = NO" >> mk/build.mk
echo "HADDOCK_DOCS = NO" >> mk/build.mk
fi
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
if use gmp; then
echo "INTEGER_LIBRARY=integer-gmp" >> mk/build.mk
else
echo "INTEGER_LIBRARY=integer-simple" >> mk/build.mk
fi
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds 'gcc' it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
is_crosscompile || econf_args+=(--with-gcc=${CHOST}-gcc)
if ! use ghcmakebinary; then
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
GHC_TPF="$(grep 'S\[\"TargetPlatformFull\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
fi # ! use binary
}
src_compile() {
if ! use binary; then
# 1. build compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 3. and then all the rest
emake all
fi # ! use binary
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
# Remove the docs if not requested
if ! use doc; then
rm -rf "${ED}/usr/share/doc/${P}/*/" \
"${ED}/usr/share/doc/${P}/*.html" \
|| die "could not remove docs (P vs PF revision mismatch?)"
fi
else
# We only build docs if we were bootstrapping, otherwise
# we copy them out of the unpacked binary .tbz2
if use doc && ! use ghcbootstrap; then
mkdir -p "${ED}/usr/share/doc"
mv "${WORKDIR}/usr/share/doc/${P}" "${ED}/usr/share/doc" \
|| die "failed to copy docs"
else
dodoc "${S}/distrib/README" "${S}/ANNOUNCE" "${S}/LICENSE" "${S}/VERSION"
fi
emake -j1 install DESTDIR="${D}"
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/haddock
if [[ ! -f "${S}/VERSION" ]]; then
echo "${GHC_PV}" > "${S}/VERSION" \
|| die "Could not create file ${S}/VERSION"
fi
newbashcomp "${FILESDIR}/ghc-bash-completion" ghc-pkg
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater --upgrade'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
# Be very careful here... Call order when upgrading is (according to PMS):
# * src_install for new package
# * pkg_preinst for new package
# * pkg_postinst for new package
# * pkg_prerm for the package being replaced
# * pkg_postrm for the package being replaced
# so you'll actually be touching the new packages files, not the one you
# uninstall, due to that or installation directory ${GHC_P} will be the same for
# both packages.
# Call order for reinstalling is (according to PMS):
# * src_install
# * pkg_preinst
# * pkg_prerm for the package being replaced
# * pkg_postrm for the package being replaced
# * pkg_postinst
# Overwrite the modified package.cache with a copy of the
# original one, so that it will be removed during uninstall.
PKGCACHE="${EROOT}/usr/$(get_libdir)/${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,672 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=5
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
#
# 'CTARGET' definition and 'is_crosscompile' are taken from 'toolchain.eclass'
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib pax-utils toolchain-funcs versionator prefix
inherit check-reqs
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
# sorted!
arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-arm.tbz2 )"
arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-arm64.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-unknown-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
alpha) return 0 ;;
arm64) return 0 ;;
#arm)
# ewarn "ARM binary is built on armv5tel-eabi toolchain. Use with caution."
# return 0
#;;
amd64) return 0 ;;
ia64) return 0 ;;
ppc) return 0 ;;
ppc64) return 0 ;;
#sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=8.0.1.20161213 # uncomment only for -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? ( https://downloads.haskell.org/~ghc/${PV/_rc/-rc}/${GHC_P}-src.tar.xz )"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
)
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="doc ghcbootstrap ghcmakebinary +gmp +profile"
IUSE+=" binary"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
sys-libs/ncurses:0=[unicode]
!ghcmakebinary? ( dev-libs/libffi:= )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses:0/6
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-python/sphinx
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
REQUIRED_USE="?? ( ghcbootstrap binary )"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
if is_crosscompile; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
# are not built with fPIC, bug #606666
gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
tc-is-gcc && version_is_at_least 6.3 $(gcc-version) && if ! use ghcbootstrap; then
# gcc-6.3 has support for -no-pie upstream, but spelling differs from
# gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
# hardened users try '-pie' in USE=ghcbootstrap mode.
append-ghc-cflags compile link -no-pie
fi
# prevent from failind building unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${GHC_PV}-orig"
cp "${WORKDIR}/usr/bin/$(cross)ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
bin_libpath=${bin_ghc_prefix}/$(get_libdir)
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/$(cross)ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/$(cross)ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/$(cross)ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/$(cross)hsc2hs" \
"${WORKDIR}/usr/bin/$(cross)runghc-${GHC_PV}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/$(cross)ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/$(cross)ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/$(cross)ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/$(cross)hsc2hs" \
"${WORKDIR}/usr/bin/$(cross)runghc-${GHC_PV}" \
"${WORKDIR}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
ghc-check-reqs() {
# These are pessimistic values (slightly bigger than worst-case)
# Worst case is UNREG USE=profile ia64. See bug #611866 for some
# numbers on various arches.
CHECKREQS_DISK_BUILD=8G
CHECKREQS_DISK_USR=2G
# USE=binary roughly takes
use binary && CHECKREQS_DISK_BUILD=4G
"$@"
}
pkg_pretend() {
ghc-check-reqs check-reqs_pkg_pretend
}
pkg_setup() {
ghc-check-reqs check-reqs_pkg_setup
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
esac
unpack ${ONLYA}
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/$(cross)ghc-${GHC_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/$(cross)${GHC_P}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# much arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise epatch will break
epatch "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
epatch "${FILESDIR}"/${PN}-8.0.1_rc1-cgen-constify.patch
epatch "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
epatch "${FILESDIR}"/${PN}-8.0.2-no-relax-everywhere.patch
epatch "${FILESDIR}"/${PN}-8.0.1-limit-jN.patch
epatch "${FILESDIR}"/${PN}-8.0.1-ww-args-limit.patch
epatch "${FILESDIR}"/${PN}-8.0.1-par-g0-on-A32.patch
epatch "${FILESDIR}"/${PN}-8.0.2_rc2-old-sphinx.patch
epatch "${FILESDIR}"/${PN}-8.0.2-libffi-alpha.patch
epatch "${FILESDIR}"/${PN}-8.0.2-O2-unreg.patch
epatch "${FILESDIR}"/${PN}-8.0.2-binutils-2.30.patch
bump_libs
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# Speed up initial Cabal bootstrap
echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds 'gcc' it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
is_crosscompile || econf_args+=(--with-gcc=${CHOST}-gcc)
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
else
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
elog "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# 1. build/pax-mark compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 2. build/pax-mark haddock using ghc-stage2
emake utils/haddock/dist/build/tmp/haddock
pax-mark -m utils/haddock/dist/build/tmp/haddock
# 3. and then all the rest
emake all
fi # ! use binary
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
emake -j1 install DESTDIR="${D}"
dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if [[ ! -f "${S}/VERSION" ]]; then
echo "${GHC_PV}" > "${S}/VERSION" \
|| die "Could not create file ${S}/VERSION"
fi
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,797 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib multiprocessing pax-utils toolchain-funcs prefix
inherit check-reqs
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
BIN_PV=${PV}
# sorted!
#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( !big-endian? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tbz2 ) )"
#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
#alpha) return 0 ;;
#arm64) return 0 ;;
#arm) return 0 ;;
amd64) return 0 ;;
#ia64) return 0 ;;
#ppc) return 0 ;;
#ppc64)
# use big-endian && return 0
# return 0
# ;;
#sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=8.10.0.20200123 # uncomment only for -alpha, -beta, -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? (
https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-src.tar.xz
test? ( https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
)"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
)
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS=""
IUSE="big-endian doc elfutils ghcbootstrap ghcmakebinary +gmp numa profile test"
IUSE+=" binary"
RESTRICT="!test? ( test )"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
sys-libs/ncurses:0=[unicode]
elfutils? ( dev-libs/elfutils )
!ghcmakebinary? ( dev-libs/libffi:= )
numa? ( sys-process/numactl )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses:0/6
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-python/sphinx
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
# we build binaries without profiling support
REQUIRED_USE="
?? ( ghcbootstrap binary )
?? ( profile binary )
"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
is_native() {
[[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
}
if ! is_crosscompile; then
PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
fi
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
# TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
if ! is_native; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
# Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
# options to gcc.
if is_native; then
# prevent from failing to build unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
fi
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1 ghc_v=${BIN_PV}
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${ghc_v}-orig"
cp "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/haddock-ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/hp2ps" \
"${WORKDIR}/usr/bin/hpc" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
ghc-check-reqs() {
# These are pessimistic values (slightly bigger than worst-case)
# Worst case is UNREG USE=profile ia64. See bug #611866 for some
# numbers on various arches.
CHECKREQS_DISK_BUILD=8G
CHECKREQS_DISK_USR=2G
# USE=binary roughly takes
use binary && CHECKREQS_DISK_BUILD=4G
"$@"
}
pkg_pretend() {
ghc-check-reqs check-reqs_pkg_pretend
}
pkg_setup() {
ghc-check-reqs check-reqs_pkg_setup
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
esac
unpack ${ONLYA}
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/ghc-${BIN_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
eapply_user
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# many arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise eapply will break
eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
eapply "${FILESDIR}"/${PN}-8.8.1-revert-CPP.patch
eapply "${FILESDIR}"/${PN}-8.10.1-no-relax-everywhere.patch
eapply "${FILESDIR}"/${PN}-8.10.1-allow-cross-bootstrap.patch
# a bunch of crosscompiler patches
# needs newer version:
#eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
# mingw32 target
pushd "${S}/libraries/Win32"
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
popd
bump_libs
eapply_user
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# Speed up initial Cabal bootstrap
echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# not used outside of ghc's test
if [[ -n ${GHC_BUILD_DPH} ]]; then
echo "BUILD_DPH = YES" >> mk/build.mk
else
echo "BUILD_DPH = NO" >> mk/build.mk
fi
# Any non-native build has to skip as it needs
# target haddock binary to be runnabine.
if ! is_native; then
# disable docs generation as it requires running stage2
echo "HADDOCK_DOCS=NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
fi
if is_crosscompile; then
# Install ghc-stage1 crosscompiler instead of
# ghc-stage2 cross-built compiler.
echo "Stage1Only=YES" >> mk/build.mk
fi
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds toolchain it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
# User can use EXTRA_ECONF=CC=... to override this default.
econf_args+=(
AR=${CTARGET}-ar
CC=${CTARGET}-gcc
# these should be inferred by GHC but ghc defaults
# to using bundled tools on windows.
Windres=${CTARGET}-windres
DllWrap=${CTARGET}-dllwrap
# we set the linker explicitly below
--disable-ld-override
)
case ${CTARGET} in
arm*)
# ld.bfd-2.28 does not work for ghc. Force ld.gold
# instead. This should be removed once gentoo gets
# a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
econf_args+=(LD=${CTARGET}-ld.gold)
;;
sparc*)
# ld.gold-2.28 does not work for ghc. Force ld.bfd
# instead. This should be removed once gentoo gets
# a fix for missing --no-relax support bug:
# https://sourceware.org/ml/binutils/2017-07/msg00183.html
econf_args+=(LD=${CTARGET}-ld.bfd)
;;
*)
econf_args+=(LD=${CTARGET}-ld)
esac
if [[ ${CBUILD} != ${CHOST} ]]; then
# GHC bug: ghc claims not to support cross-building.
# It does, but does not distinct --host= value
# for stage1 and stage2 compiler.
econf_args+=(--host=${CBUILD})
fi
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
elif is_native; then
# using ${GTARGET}'s libffi is not supported yet:
# GHC embeds full path for ffi includes without /usr/${CTARGET} account.
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
einfo "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} \
--enable-bootstrap-with-devel-snapshot \
$(use_enable elfutils dwarf-unwind) \
$(use_enable numa)
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# Stage1Only crosscompiler does not build stage2
if ! is_crosscompile; then
# 1. build/pax-mark compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 2. build/pax-mark haddock using ghc-stage2
if is_native; then
# non-native build does not build haddock
# due to HADDOCK_DOCS=NO, but it could.
emake utils/haddock/dist/build/tmp/haddock
pax-mark -m utils/haddock/dist/build/tmp/haddock
fi
fi
# 3. and then all the rest
emake all
fi # ! use binary
}
src_test() {
# TODO: deal with:
# - sandbox (pollutes environment)
# - extra packages (to extend testsuite coverage)
# bits are taken from 'validate'
local make_test_target='test' # can be fulltest
# not 'emake' as testsuite uses '$MAKE' without jobserver available
make $make_test_target stage=2 THREADS=$(makeopts_jobs)
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
[[ -f VERSION ]] || emake VERSION
# -j1 due to a rare race in install script:
# make --no-print-directory -f ghc.mk phase=final install
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
# -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
# "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
# /usr/bin/install: cannot create regular file \
# '/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
emake -j1 install DESTDIR="${D}"
# Skip for cross-targets as they all share target location:
# /usr/share/doc/ghc-9999/
if ! is_crosscompile; then
dodoc "distrib/README" "LICENSE" "VERSION"
fi
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
if is_crosscompile; then
# When we build a cross-compiler the layout is the following:
# usr/lib/${CTARGET}-ghc-${VER}/ contains target libraries
# but
# usr/lib/${CTARGET}-ghc-${VER}/bin/ directory
# containst host binaries (modulo bugs).
# Portage's stripping mechanism does not skip stripping
# foreign binaries. This frequently causes binaries to be
# broken.
#
# Thus below we disable stripping of target libraries and allow
# stripping hosts executables.
dostrip -x "/usr/$(get_libdir)/$(cross)${GHC_P}"
dostrip "/usr/$(get_libdir)/$(cross)${GHC_P}/bin"
fi
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,797 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib multiprocessing pax-utils toolchain-funcs prefix
inherit check-reqs
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
BIN_PV=${PV}
# sorted!
#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( !big-endian? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tbz2 ) )"
#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
#alpha) return 0 ;;
#arm64) return 0 ;;
#arm) return 0 ;;
amd64) return 0 ;;
#ia64) return 0 ;;
#ppc) return 0 ;;
#ppc64)
# use big-endian && return 0
# return 0
# ;;
#sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=8.10.0.20200123 # uncomment only for -alpha, -beta, -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? (
https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-src.tar.xz
test? ( https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
)"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
)
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS=""
IUSE="big-endian doc elfutils ghcbootstrap ghcmakebinary +gmp numa profile test"
IUSE+=" binary"
RESTRICT="!test? ( test )"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
sys-libs/ncurses:0=[unicode]
elfutils? ( dev-libs/elfutils )
!ghcmakebinary? ( dev-libs/libffi:= )
numa? ( sys-process/numactl )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses:0/6
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-python/sphinx
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
# we build binaries without profiling support
REQUIRED_USE="
?? ( ghcbootstrap binary )
?? ( profile binary )
"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
is_native() {
[[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
}
if ! is_crosscompile; then
PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
fi
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
# TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
if ! is_native; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
# Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
# options to gcc.
if is_native; then
# prevent from failing to build unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
fi
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1 ghc_v=${BIN_PV}
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${ghc_v}-orig"
cp "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/haddock-ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/hp2ps" \
"${WORKDIR}/usr/bin/hpc" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
ghc-check-reqs() {
# These are pessimistic values (slightly bigger than worst-case)
# Worst case is UNREG USE=profile ia64. See bug #611866 for some
# numbers on various arches.
CHECKREQS_DISK_BUILD=8G
CHECKREQS_DISK_USR=2G
# USE=binary roughly takes
use binary && CHECKREQS_DISK_BUILD=4G
"$@"
}
pkg_pretend() {
ghc-check-reqs check-reqs_pkg_pretend
}
pkg_setup() {
ghc-check-reqs check-reqs_pkg_setup
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
esac
unpack ${ONLYA}
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/ghc-${BIN_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
eapply_user
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# many arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise eapply will break
eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
eapply "${FILESDIR}"/${PN}-8.8.1-revert-CPP.patch
eapply "${FILESDIR}"/${PN}-8.10.1-allow-cross-bootstrap.patch
eapply "${FILESDIR}"/${PN}-8.10.2-revert-linker-rtsSymbols_more_linker_symbols.patch
# a bunch of crosscompiler patches
# needs newer version:
#eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
# mingw32 target
pushd "${S}/libraries/Win32"
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
popd
bump_libs
eapply_user
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# Speed up initial Cabal bootstrap
echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# not used outside of ghc's test
if [[ -n ${GHC_BUILD_DPH} ]]; then
echo "BUILD_DPH = YES" >> mk/build.mk
else
echo "BUILD_DPH = NO" >> mk/build.mk
fi
# Any non-native build has to skip as it needs
# target haddock binary to be runnabine.
if ! is_native; then
# disable docs generation as it requires running stage2
echo "HADDOCK_DOCS=NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
fi
if is_crosscompile; then
# Install ghc-stage1 crosscompiler instead of
# ghc-stage2 cross-built compiler.
echo "Stage1Only=YES" >> mk/build.mk
fi
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds toolchain it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
# User can use EXTRA_ECONF=CC=... to override this default.
econf_args+=(
AR=${CTARGET}-ar
CC=${CTARGET}-gcc
# these should be inferred by GHC but ghc defaults
# to using bundled tools on windows.
Windres=${CTARGET}-windres
DllWrap=${CTARGET}-dllwrap
# we set the linker explicitly below
--disable-ld-override
)
case ${CTARGET} in
arm*)
# ld.bfd-2.28 does not work for ghc. Force ld.gold
# instead. This should be removed once gentoo gets
# a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
econf_args+=(LD=${CTARGET}-ld.gold)
;;
sparc*)
# ld.gold-2.28 does not work for ghc. Force ld.bfd
# instead. This should be removed once gentoo gets
# a fix for missing --no-relax support bug:
# https://sourceware.org/ml/binutils/2017-07/msg00183.html
econf_args+=(LD=${CTARGET}-ld.bfd)
;;
*)
econf_args+=(LD=${CTARGET}-ld)
esac
if [[ ${CBUILD} != ${CHOST} ]]; then
# GHC bug: ghc claims not to support cross-building.
# It does, but does not distinct --host= value
# for stage1 and stage2 compiler.
econf_args+=(--host=${CBUILD})
fi
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
elif is_native; then
# using ${GTARGET}'s libffi is not supported yet:
# GHC embeds full path for ffi includes without /usr/${CTARGET} account.
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
einfo "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} \
--enable-bootstrap-with-devel-snapshot \
$(use_enable elfutils dwarf-unwind) \
$(use_enable numa)
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# Stage1Only crosscompiler does not build stage2
if ! is_crosscompile; then
# 1. build/pax-mark compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 2. build/pax-mark haddock using ghc-stage2
if is_native; then
# non-native build does not build haddock
# due to HADDOCK_DOCS=NO, but it could.
emake utils/haddock/dist/build/tmp/haddock
pax-mark -m utils/haddock/dist/build/tmp/haddock
fi
fi
# 3. and then all the rest
emake all
fi # ! use binary
}
src_test() {
# TODO: deal with:
# - sandbox (pollutes environment)
# - extra packages (to extend testsuite coverage)
# bits are taken from 'validate'
local make_test_target='test' # can be fulltest
# not 'emake' as testsuite uses '$MAKE' without jobserver available
make $make_test_target stage=2 THREADS=$(makeopts_jobs)
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
[[ -f VERSION ]] || emake VERSION
# -j1 due to a rare race in install script:
# make --no-print-directory -f ghc.mk phase=final install
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
# -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
# "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
# /usr/bin/install: cannot create regular file \
# '/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
emake -j1 install DESTDIR="${D}"
# Skip for cross-targets as they all share target location:
# /usr/share/doc/ghc-9999/
if ! is_crosscompile; then
dodoc "distrib/README" "LICENSE" "VERSION"
fi
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
if is_crosscompile; then
# When we build a cross-compiler the layout is the following:
# usr/lib/${CTARGET}-ghc-${VER}/ contains target libraries
# but
# usr/lib/${CTARGET}-ghc-${VER}/bin/ directory
# containst host binaries (modulo bugs).
# Portage's stripping mechanism does not skip stripping
# foreign binaries. This frequently causes binaries to be
# broken.
#
# Thus below we disable stripping of target libraries and allow
# stripping hosts executables.
dostrip -x "/usr/$(get_libdir)/$(cross)${GHC_P}"
dostrip "/usr/$(get_libdir)/$(cross)${GHC_P}/bin"
fi
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,796 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib multiprocessing pax-utils toolchain-funcs prefix
inherit check-reqs
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
BIN_PV=${PV}
# sorted!
#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( !big-endian? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tbz2 ) )"
#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
#alpha) return 0 ;;
#arm64) return 0 ;;
#arm) return 0 ;;
amd64) return 0 ;;
#ia64) return 0 ;;
#ppc) return 0 ;;
#ppc64)
# use big-endian && return 0
# return 0
# ;;
#sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=8.10.0.20200123 # uncomment only for -alpha, -beta, -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? (
https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-src.tar.xz
test? ( https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
)"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
)
LICENSE="BSD"
SLOT="0/${PV}"
#KEYWORDS="~amd64 ~x86"
IUSE="big-endian doc elfutils ghcbootstrap ghcmakebinary +gmp numa profile test"
IUSE+=" binary"
RESTRICT="!test? ( test )"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
sys-libs/ncurses:0=[unicode]
elfutils? ( dev-libs/elfutils )
!ghcmakebinary? ( dev-libs/libffi:= )
numa? ( sys-process/numactl )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses:0/6
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-python/sphinx
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
# we build binaries without profiling support
REQUIRED_USE="
?? ( ghcbootstrap binary )
?? ( profile binary )
"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
is_native() {
[[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
}
if ! is_crosscompile; then
PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
fi
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
# TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
if ! is_native; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
# Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
# options to gcc.
if is_native; then
# prevent from failing to build unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
fi
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1 ghc_v=${BIN_PV}
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${ghc_v}-orig"
cp "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/haddock-ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/hp2ps" \
"${WORKDIR}/usr/bin/hpc" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
ghc-check-reqs() {
# These are pessimistic values (slightly bigger than worst-case)
# Worst case is UNREG USE=profile ia64. See bug #611866 for some
# numbers on various arches.
CHECKREQS_DISK_BUILD=8G
CHECKREQS_DISK_USR=2G
# USE=binary roughly takes
use binary && CHECKREQS_DISK_BUILD=4G
"$@"
}
pkg_pretend() {
ghc-check-reqs check-reqs_pkg_pretend
}
pkg_setup() {
ghc-check-reqs check-reqs_pkg_setup
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
esac
unpack ${ONLYA}
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/ghc-${BIN_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
eapply_user
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# many arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise eapply will break
eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
eapply "${FILESDIR}"/${PN}-8.8.1-revert-CPP.patch
eapply "${FILESDIR}"/${PN}-8.10.1-allow-cross-bootstrap.patch
# a bunch of crosscompiler patches
# needs newer version:
#eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
# mingw32 target
pushd "${S}/libraries/Win32"
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
popd
bump_libs
eapply_user
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# Speed up initial Cabal bootstrap
echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# not used outside of ghc's test
if [[ -n ${GHC_BUILD_DPH} ]]; then
echo "BUILD_DPH = YES" >> mk/build.mk
else
echo "BUILD_DPH = NO" >> mk/build.mk
fi
# Any non-native build has to skip as it needs
# target haddock binary to be runnabine.
if ! is_native; then
# disable docs generation as it requires running stage2
echo "HADDOCK_DOCS=NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
fi
if is_crosscompile; then
# Install ghc-stage1 crosscompiler instead of
# ghc-stage2 cross-built compiler.
echo "Stage1Only=YES" >> mk/build.mk
fi
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds toolchain it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
# User can use EXTRA_ECONF=CC=... to override this default.
econf_args+=(
AR=${CTARGET}-ar
CC=${CTARGET}-gcc
# these should be inferred by GHC but ghc defaults
# to using bundled tools on windows.
Windres=${CTARGET}-windres
DllWrap=${CTARGET}-dllwrap
# we set the linker explicitly below
--disable-ld-override
)
case ${CTARGET} in
arm*)
# ld.bfd-2.28 does not work for ghc. Force ld.gold
# instead. This should be removed once gentoo gets
# a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
econf_args+=(LD=${CTARGET}-ld.gold)
;;
sparc*)
# ld.gold-2.28 does not work for ghc. Force ld.bfd
# instead. This should be removed once gentoo gets
# a fix for missing --no-relax support bug:
# https://sourceware.org/ml/binutils/2017-07/msg00183.html
econf_args+=(LD=${CTARGET}-ld.bfd)
;;
*)
econf_args+=(LD=${CTARGET}-ld)
esac
if [[ ${CBUILD} != ${CHOST} ]]; then
# GHC bug: ghc claims not to support cross-building.
# It does, but does not distinct --host= value
# for stage1 and stage2 compiler.
econf_args+=(--host=${CBUILD})
fi
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
elif is_native; then
# using ${GTARGET}'s libffi is not supported yet:
# GHC embeds full path for ffi includes without /usr/${CTARGET} account.
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
einfo "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} \
--enable-bootstrap-with-devel-snapshot \
$(use_enable elfutils dwarf-unwind) \
$(use_enable numa)
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# Stage1Only crosscompiler does not build stage2
if ! is_crosscompile; then
# 1. build/pax-mark compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 2. build/pax-mark haddock using ghc-stage2
if is_native; then
# non-native build does not build haddock
# due to HADDOCK_DOCS=NO, but it could.
emake utils/haddock/dist/build/tmp/haddock
pax-mark -m utils/haddock/dist/build/tmp/haddock
fi
fi
# 3. and then all the rest
emake all
fi # ! use binary
}
src_test() {
# TODO: deal with:
# - sandbox (pollutes environment)
# - extra packages (to extend testsuite coverage)
# bits are taken from 'validate'
local make_test_target='test' # can be fulltest
# not 'emake' as testsuite uses '$MAKE' without jobserver available
make $make_test_target stage=2 THREADS=$(makeopts_jobs)
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
[[ -f VERSION ]] || emake VERSION
# -j1 due to a rare race in install script:
# make --no-print-directory -f ghc.mk phase=final install
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
# -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
# "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
# /usr/bin/install: cannot create regular file \
# '/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
emake -j1 install DESTDIR="${D}"
# Skip for cross-targets as they all share target location:
# /usr/share/doc/ghc-9999/
if ! is_crosscompile; then
dodoc "distrib/README" "LICENSE" "VERSION"
fi
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
if is_crosscompile; then
# When we build a cross-compiler the layout is the following:
# usr/lib/${CTARGET}-ghc-${VER}/ contains target libraries
# but
# usr/lib/${CTARGET}-ghc-${VER}/bin/ directory
# containst host binaries (modulo bugs).
# Portage's stripping mechanism does not skip stripping
# foreign binaries. This frequently causes binaries to be
# broken.
#
# Thus below we disable stripping of target libraries and allow
# stripping hosts executables.
dostrip -x "/usr/$(get_libdir)/$(cross)${GHC_P}"
dostrip "/usr/$(get_libdir)/$(cross)${GHC_P}/bin"
fi
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,754 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=5
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib pax-utils toolchain-funcs versionator prefix
inherit check-reqs
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
# sorted!
#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
#alpha) return 0 ;;
#arm64) return 0 ;;
#arm) return 0 ;;
amd64) return 0 ;;
#ia64) return 0 ;;
#ppc) return 0 ;;
#ppc64) return 0 ;;
#sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=8.2.0.20170704 # uncomment only for -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? ( https://downloads.haskell.org/~ghc/${PV/_rc/-rc}/${GHC_P}-src.tar.xz )"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
)
LICENSE="BSD"
SLOT="0/${PV}"
#KEYWORDS="~alpha ~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="doc ghcbootstrap ghcmakebinary +gmp profile"
IUSE+=" binary"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
sys-libs/ncurses:0=[unicode]
!ghcmakebinary? ( dev-libs/libffi:= )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses:0/6
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-python/sphinx
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
PDEPEND="!ghcbootstrap? ( =app-admin/haskell-updater-1.2* )"
REQUIRED_USE="?? ( ghcbootstrap binary )"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
is_native() {
[[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
}
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
# TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
if ! is_native; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
# Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
# options to gcc.
if is_native; then
# hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
# are not built with fPIC, bug #606666
gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
tc-is-gcc && version_is_at_least 6.3 $(gcc-version) && if ! use ghcbootstrap; then
# gcc-6.3 has support for -no-pie upstream, but spelling differs from
# gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
# hardened users try '-pie' in USE=ghcbootstrap mode.
append-ghc-cflags compile link -no-pie
fi
# prevent from failing to build unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
fi
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${GHC_PV}-orig"
cp "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
"${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
ghc-check-reqs() {
# These are pessimistic values (slightly bigger than worst-case)
# Worst case is UNREG USE=profile ia64. See bug #611866 for some
# numbers on various arches.
CHECKREQS_DISK_BUILD=8G
CHECKREQS_DISK_USR=2G
# USE=binary roughly takes
use binary && CHECKREQS_DISK_BUILD=4G
"$@"
}
pkg_pretend() {
ghc-check-reqs check-reqs_pkg_pretend
}
pkg_setup() {
ghc-check-reqs check-reqs_pkg_setup
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
esac
unpack ${ONLYA}
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# much arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise epatch will break
epatch "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
epatch "${FILESDIR}"/${PN}-8.2.1-darwin.patch
epatch "${FILESDIR}"/${PN}-8.2.1_rc1-cgen-constify.patch
epatch "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
epatch "${FILESDIR}"/${PN}-8.0.2-no-relax-everywhere.patch
epatch "${FILESDIR}"/${PN}-8.2.1_rc2-O2-unreg.patch
# a bunch of crosscompiler patches
epatch "${FILESDIR}"/${PN}-8.2.1_rc1-unphased-cross.patch
epatch "${FILESDIR}"/${PN}-8.2.1_rc1-staged-cross.patch
epatch "${FILESDIR}"/${PN}-8.2.1_rc1-ghci-cross.patch
epatch "${FILESDIR}"/${PN}-8.2.1_rc1-stage2-cross.patch
epatch "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
epatch "${FILESDIR}"/${PN}-8.2.1_rc3-any-vendor.patch
epatch "${FILESDIR}"/${PN}-8.2.1_rc3-stginit-data.patch
# needs a new libffi release
epatch "${FILESDIR}"/${PN}-8.0.2-libffi-alpha.patch
# mingw32 target
pushd "${S}/libraries/Win32"
epatch "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-1.patch # upstreamed, waits for merge to -HEAD
epatch "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
popd
bump_libs
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# Speed up initial Cabal bootstrap
echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# not used outside of ghc's test
if [[ -n ${GHC_BUILD_DPH} ]]; then
echo "BUILD_DPH = YES" >> mk/build.mk
else
echo "BUILD_DPH = NO" >> mk/build.mk
fi
# Any non-native build has to skip as it needs
# target haddock binary to be runnabine.
if ! is_native; then
# disable docs generation as it requires running stage2
echo "HADDOCK_DOCS=NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
fi
if is_crosscompile; then
# Install ghc-stage1 crosscompiler instead of
# ghc-stage2 cross-built compiler.
echo "Stage1Only=YES" >> mk/build.mk
fi
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds toolchain it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
# User can use EXTRA_ECONF=CC=... to override this default.
econf_args+=(
AR=${CTARGET}-ar
CC=${CTARGET}-gcc
LD=${CTARGET}-ld
# these should be inferred by GHC but ghc defaults
# to using bundled tools on windows.
Windres=${CTARGET}-windres
DllWrap=${CTARGET}-dllwrap
)
if [[ ${CTARGET} == arm* ]] ; then
# ld.bfd-2.28 does not work for ghc. Force ld.gold
# instead. This should be removed once gentoo gets
# a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
econf_args+=(LD=${CTARGET}-ld.gold)
fi
if [[ ${CBUILD} != ${CHOST} ]]; then
# GHC bug: ghc claims not to support cross-building.
# It does, but does not distinct --host= value
# for stage1 and stage2 compiler.
econf_args+=(--host=${CBUILD})
fi
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
elif is_native; then
# using ${GTARGET}'s libffi is not supported yet:
# GHC embeds full path for ffi includes without /usr/${CTARGET} account.
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
einfo "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# Stage1Only crosscompiler does not build stage2
if ! is_crosscompile; then
# 1. build/pax-mark compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 2. build/pax-mark haddock using ghc-stage2
if is_native; then
# non-native build does not build haddock
# due to HADDOCK_DOCS=NO, but it could.
emake utils/haddock/dist/build/tmp/haddock
pax-mark -m utils/haddock/dist/build/tmp/haddock
fi
fi
# 3. and then all the rest
emake all
fi # ! use binary
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
[[ -f VERSION ]] || emake VERSION
# -j1 due to a rare race in install script:
# make --no-print-directory -f ghc.mk phase=final install
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
# -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
# "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
# /usr/bin/install: cannot create regular file \
# '/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
emake -j1 install DESTDIR="${D}"
# Skip for cross-targets as they all share target location:
# /usr/share/doc/ghc-9999/
if ! is_crosscompile; then
dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
fi
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,755 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib pax-utils toolchain-funcs versionator prefix
inherit check-reqs
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
# sorted!
#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
#alpha) return 0 ;;
#arm64) return 0 ;;
#arm) return 0 ;;
amd64) return 0 ;;
#ia64) return 0 ;;
#ppc) return 0 ;;
#ppc64) return 0 ;;
#sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=8.2.1.20171108 # uncomment only for -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? ( https://downloads.haskell.org/~ghc/${PV/_rc/-rc}/${GHC_P}-src.tar.xz )"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
)
LICENSE="BSD"
SLOT="0/${PV}"
#KEYWORDS="~alpha ~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="doc ghcbootstrap ghcmakebinary +gmp profile"
IUSE+=" binary"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
sys-libs/ncurses:0=[unicode]
!ghcmakebinary? ( dev-libs/libffi:= )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses:0/6
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-python/sphinx
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
REQUIRED_USE="?? ( ghcbootstrap binary )"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
is_native() {
[[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
}
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
# TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
if ! is_native; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
# Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
# options to gcc.
if is_native; then
# hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
# are not built with fPIC, bug #606666
gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
tc-is-gcc && version_is_at_least 6.3 $(gcc-version) && if ! use ghcbootstrap; then
# gcc-6.3 has support for -no-pie upstream, but spelling differs from
# gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
# hardened users try '-pie' in USE=ghcbootstrap mode.
append-ghc-cflags compile link -no-pie
fi
# prevent from failing to build unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
fi
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${GHC_PV}-orig"
cp "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
"${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
ghc-check-reqs() {
# These are pessimistic values (slightly bigger than worst-case)
# Worst case is UNREG USE=profile ia64. See bug #611866 for some
# numbers on various arches.
CHECKREQS_DISK_BUILD=8G
CHECKREQS_DISK_USR=2G
# USE=binary roughly takes
use binary && CHECKREQS_DISK_BUILD=4G
"$@"
}
pkg_pretend() {
ghc-check-reqs check-reqs_pkg_pretend
}
pkg_setup() {
ghc-check-reqs check-reqs_pkg_setup
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
esac
unpack ${ONLYA}
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
eapply_user
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# much arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise eapply will break
eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-cgen-constify.patch
eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
eapply "${FILESDIR}"/${PN}-8.0.2-no-relax-everywhere.patch
eapply "${FILESDIR}"/${PN}-8.2.1_rc2-O2-unreg.patch
eapply "${FILESDIR}"/${PN}-8.0.2-binutils-2.30.patch
# a bunch of crosscompiler patches
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-unphased-cross.patch
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-staged-cross.patch
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-ghci-cross.patch
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-stage2-cross.patch
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
# needs a new libffi release
eapply "${FILESDIR}"/${PN}-8.0.2-libffi-alpha.patch
# mingw32 target
pushd "${S}/libraries/Win32"
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-1.patch # upstreamed, waits for merge to -HEAD
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
popd
bump_libs
eapply_user
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# Speed up initial Cabal bootstrap
echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# not used outside of ghc's test
if [[ -n ${GHC_BUILD_DPH} ]]; then
echo "BUILD_DPH = YES" >> mk/build.mk
else
echo "BUILD_DPH = NO" >> mk/build.mk
fi
# Any non-native build has to skip as it needs
# target haddock binary to be runnabine.
if ! is_native; then
# disable docs generation as it requires running stage2
echo "HADDOCK_DOCS=NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
fi
if is_crosscompile; then
# Install ghc-stage1 crosscompiler instead of
# ghc-stage2 cross-built compiler.
echo "Stage1Only=YES" >> mk/build.mk
fi
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds toolchain it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
# User can use EXTRA_ECONF=CC=... to override this default.
econf_args+=(
AR=${CTARGET}-ar
CC=${CTARGET}-gcc
LD=${CTARGET}-ld
# these should be inferred by GHC but ghc defaults
# to using bundled tools on windows.
Windres=${CTARGET}-windres
DllWrap=${CTARGET}-dllwrap
)
if [[ ${CTARGET} == arm* ]] ; then
# ld.bfd-2.28 does not work for ghc. Force ld.gold
# instead. This should be removed once gentoo gets
# a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
econf_args+=(LD=${CTARGET}-ld.gold)
fi
if [[ ${CBUILD} != ${CHOST} ]]; then
# GHC bug: ghc claims not to support cross-building.
# It does, but does not distinct --host= value
# for stage1 and stage2 compiler.
econf_args+=(--host=${CBUILD})
fi
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
elif is_native; then
# using ${GTARGET}'s libffi is not supported yet:
# GHC embeds full path for ffi includes without /usr/${CTARGET} account.
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
einfo "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# Stage1Only crosscompiler does not build stage2
if ! is_crosscompile; then
# 1. build/pax-mark compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 2. build/pax-mark haddock using ghc-stage2
if is_native; then
# non-native build does not build haddock
# due to HADDOCK_DOCS=NO, but it could.
emake utils/haddock/dist/build/tmp/haddock
pax-mark -m utils/haddock/dist/build/tmp/haddock
fi
fi
# 3. and then all the rest
emake all
fi # ! use binary
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
[[ -f VERSION ]] || emake VERSION
# -j1 due to a rare race in install script:
# make --no-print-directory -f ghc.mk phase=final install
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
# -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
# "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
# /usr/bin/install: cannot create regular file \
# '/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
emake -j1 install DESTDIR="${D}"
# Skip for cross-targets as they all share target location:
# /usr/share/doc/ghc-9999/
if ! is_crosscompile; then
dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
fi
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,755 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib pax-utils toolchain-funcs versionator prefix
inherit check-reqs
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
# sorted!
#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
#alpha) return 0 ;;
#arm64) return 0 ;;
#arm) return 0 ;;
amd64) return 0 ;;
#ia64) return 0 ;;
#ppc) return 0 ;;
#ppc64) return 0 ;;
#sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=8.4.0.20180224 # uncomment only for -alpha, -beta, -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? ( https://downloads.haskell.org/~ghc/${PV/_/-}/${GHC_P}-src.tar.xz )"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
)
LICENSE="BSD"
SLOT="0/${PV}"
#KEYWORDS="~alpha ~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="doc ghcbootstrap ghcmakebinary +gmp profile"
IUSE+=" binary"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
sys-libs/ncurses:0=[unicode]
!ghcmakebinary? ( dev-libs/libffi:= )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses:0/6
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-python/sphinx
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
REQUIRED_USE="?? ( ghcbootstrap binary )"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
is_native() {
[[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
}
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
# TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
if ! is_native; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
# Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
# options to gcc.
if is_native; then
# hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
# are not built with fPIC, bug #606666
gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
tc-is-gcc && version_is_at_least 6.3 $(gcc-version) && if ! use ghcbootstrap; then
# gcc-6.3 has support for -no-pie upstream, but spelling differs from
# gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
# hardened users try '-pie' in USE=ghcbootstrap mode.
append-ghc-cflags compile link -no-pie
fi
# prevent from failing to build unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
fi
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${GHC_PV}-orig"
cp "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
"${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
ghc-check-reqs() {
# These are pessimistic values (slightly bigger than worst-case)
# Worst case is UNREG USE=profile ia64. See bug #611866 for some
# numbers on various arches.
CHECKREQS_DISK_BUILD=8G
CHECKREQS_DISK_USR=2G
# USE=binary roughly takes
use binary && CHECKREQS_DISK_BUILD=4G
"$@"
}
pkg_pretend() {
ghc-check-reqs check-reqs_pkg_pretend
}
pkg_setup() {
ghc-check-reqs check-reqs_pkg_setup
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
esac
unpack ${ONLYA}
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
eapply_user
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# much arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise eapply will break
eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
eapply "${FILESDIR}"/${PN}-8.0.2-no-relax-everywhere.patch
# a bunch of crosscompiler patches
# needs newer version:
#eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
# mingw32 target
pushd "${S}/libraries/Win32"
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
popd
bump_libs
eapply_user
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# Speed up initial Cabal bootstrap
echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# not used outside of ghc's test
if [[ -n ${GHC_BUILD_DPH} ]]; then
echo "BUILD_DPH = YES" >> mk/build.mk
else
echo "BUILD_DPH = NO" >> mk/build.mk
fi
# Any non-native build has to skip as it needs
# target haddock binary to be runnabine.
if ! is_native; then
# disable docs generation as it requires running stage2
echo "HADDOCK_DOCS=NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
fi
if is_crosscompile; then
# Install ghc-stage1 crosscompiler instead of
# ghc-stage2 cross-built compiler.
echo "Stage1Only=YES" >> mk/build.mk
fi
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds toolchain it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
# User can use EXTRA_ECONF=CC=... to override this default.
econf_args+=(
AR=${CTARGET}-ar
CC=${CTARGET}-gcc
# these should be inferred by GHC but ghc defaults
# to using bundled tools on windows.
Windres=${CTARGET}-windres
DllWrap=${CTARGET}-dllwrap
# we set the linker explicitly below
--disable-ld-override
)
case ${CTARGET} in
arm*)
# ld.bfd-2.28 does not work for ghc. Force ld.gold
# instead. This should be removed once gentoo gets
# a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
econf_args+=(LD=${CTARGET}-ld.gold)
;;
sparc*)
# ld.gold-2.28 does not work for ghc. Force ld.bfd
# instead. This should be removed once gentoo gets
# a fix for missing --no-relax support bug:
# https://sourceware.org/ml/binutils/2017-07/msg00183.html
econf_args+=(LD=${CTARGET}-ld.bfd)
;;
*)
econf_args+=(LD=${CTARGET}-ld)
esac
if [[ ${CBUILD} != ${CHOST} ]]; then
# GHC bug: ghc claims not to support cross-building.
# It does, but does not distinct --host= value
# for stage1 and stage2 compiler.
econf_args+=(--host=${CBUILD})
fi
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
elif is_native; then
# using ${GTARGET}'s libffi is not supported yet:
# GHC embeds full path for ffi includes without /usr/${CTARGET} account.
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
einfo "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# Stage1Only crosscompiler does not build stage2
if ! is_crosscompile; then
# 1. build/pax-mark compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 2. build/pax-mark haddock using ghc-stage2
if is_native; then
# non-native build does not build haddock
# due to HADDOCK_DOCS=NO, but it could.
emake utils/haddock/dist/build/tmp/haddock
pax-mark -m utils/haddock/dist/build/tmp/haddock
fi
fi
# 3. and then all the rest
emake all
fi # ! use binary
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
[[ -f VERSION ]] || emake VERSION
# -j1 due to a rare race in install script:
# make --no-print-directory -f ghc.mk phase=final install
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
# -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
# "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
# /usr/bin/install: cannot create regular file \
# '/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
emake -j1 install DESTDIR="${D}"
# Skip for cross-targets as they all share target location:
# /usr/share/doc/ghc-9999/
if ! is_crosscompile; then
dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
fi
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,760 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib pax-utils toolchain-funcs versionator prefix
inherit check-reqs
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
# sorted!
#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
#alpha) return 0 ;;
#arm64) return 0 ;;
#arm) return 0 ;;
amd64) return 0 ;;
#ia64) return 0 ;;
#ppc) return 0 ;;
#ppc64) return 0 ;;
#sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=8.4.1.20180329 # uncomment only for -alpha, -beta, -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? ( https://downloads.haskell.org/~ghc/${PV/_/-}/${GHC_P}-src.tar.xz )"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
)
LICENSE="BSD"
SLOT="0/${PV}"
#KEYWORDS="~alpha ~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="doc ghcbootstrap ghcmakebinary +gmp profile"
IUSE+=" binary"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
sys-libs/ncurses:0=[unicode]
!ghcmakebinary? ( dev-libs/libffi:= )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses:0/6
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-python/sphinx
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
REQUIRED_USE="?? ( ghcbootstrap binary )"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
is_native() {
[[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
}
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
# TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
if ! is_native; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
# Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
# options to gcc.
if is_native; then
# hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
# are not built with fPIC, bug #606666
gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
tc-is-gcc && version_is_at_least 6.3 $(gcc-version) && if ! use ghcbootstrap; then
# gcc-6.3 has support for -no-pie upstream, but spelling differs from
# gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
# hardened users try '-pie' in USE=ghcbootstrap mode.
append-ghc-cflags compile link -no-pie
fi
# prevent from failing to build unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
fi
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${GHC_PV}-orig"
cp "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/haddock-ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/hp2ps" \
"${WORKDIR}/usr/bin/hpc" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
"${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
ghc-check-reqs() {
# These are pessimistic values (slightly bigger than worst-case)
# Worst case is UNREG USE=profile ia64. See bug #611866 for some
# numbers on various arches.
CHECKREQS_DISK_BUILD=8G
CHECKREQS_DISK_USR=2G
# USE=binary roughly takes
use binary && CHECKREQS_DISK_BUILD=4G
"$@"
}
pkg_pretend() {
ghc-check-reqs check-reqs_pkg_pretend
}
pkg_setup() {
ghc-check-reqs check-reqs_pkg_setup
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
esac
unpack ${ONLYA}
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
eapply_user
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# much arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise eapply will break
eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
eapply "${FILESDIR}"/${PN}-8.0.2-no-relax-everywhere.patch
eapply "${FILESDIR}"/${PN}-8.0.2-binutils-2.30.patch
eapply "${FILESDIR}"/${PN}-8.4.2-allow-cross-bootstrap.patch
# a bunch of crosscompiler patches
# needs newer version:
#eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
# mingw32 target
pushd "${S}/libraries/Win32"
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
popd
bump_libs
eapply_user
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# Speed up initial Cabal bootstrap
echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# not used outside of ghc's test
if [[ -n ${GHC_BUILD_DPH} ]]; then
echo "BUILD_DPH = YES" >> mk/build.mk
else
echo "BUILD_DPH = NO" >> mk/build.mk
fi
# Any non-native build has to skip as it needs
# target haddock binary to be runnabine.
if ! is_native; then
# disable docs generation as it requires running stage2
echo "HADDOCK_DOCS=NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
fi
if is_crosscompile; then
# Install ghc-stage1 crosscompiler instead of
# ghc-stage2 cross-built compiler.
echo "Stage1Only=YES" >> mk/build.mk
fi
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds toolchain it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
# User can use EXTRA_ECONF=CC=... to override this default.
econf_args+=(
AR=${CTARGET}-ar
CC=${CTARGET}-gcc
# these should be inferred by GHC but ghc defaults
# to using bundled tools on windows.
Windres=${CTARGET}-windres
DllWrap=${CTARGET}-dllwrap
# we set the linker explicitly below
--disable-ld-override
)
case ${CTARGET} in
arm*)
# ld.bfd-2.28 does not work for ghc. Force ld.gold
# instead. This should be removed once gentoo gets
# a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
econf_args+=(LD=${CTARGET}-ld.gold)
;;
sparc*)
# ld.gold-2.28 does not work for ghc. Force ld.bfd
# instead. This should be removed once gentoo gets
# a fix for missing --no-relax support bug:
# https://sourceware.org/ml/binutils/2017-07/msg00183.html
econf_args+=(LD=${CTARGET}-ld.bfd)
;;
*)
econf_args+=(LD=${CTARGET}-ld)
esac
if [[ ${CBUILD} != ${CHOST} ]]; then
# GHC bug: ghc claims not to support cross-building.
# It does, but does not distinct --host= value
# for stage1 and stage2 compiler.
econf_args+=(--host=${CBUILD})
fi
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
elif is_native; then
# using ${GTARGET}'s libffi is not supported yet:
# GHC embeds full path for ffi includes without /usr/${CTARGET} account.
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
einfo "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# Stage1Only crosscompiler does not build stage2
if ! is_crosscompile; then
# 1. build/pax-mark compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 2. build/pax-mark haddock using ghc-stage2
if is_native; then
# non-native build does not build haddock
# due to HADDOCK_DOCS=NO, but it could.
emake utils/haddock/dist/build/tmp/haddock
pax-mark -m utils/haddock/dist/build/tmp/haddock
fi
fi
# 3. and then all the rest
emake all
fi # ! use binary
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
[[ -f VERSION ]] || emake VERSION
# -j1 due to a rare race in install script:
# make --no-print-directory -f ghc.mk phase=final install
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
# -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
# "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
# /usr/bin/install: cannot create regular file \
# '/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
emake -j1 install DESTDIR="${D}"
# Skip for cross-targets as they all share target location:
# /usr/share/doc/ghc-9999/
if ! is_crosscompile; then
dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
fi
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,759 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib pax-utils toolchain-funcs versionator prefix
inherit check-reqs
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
# sorted!
#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
#alpha) return 0 ;;
#arm64) return 0 ;;
#arm) return 0 ;;
amd64) return 0 ;;
#ia64) return 0 ;;
#ppc) return 0 ;;
#ppc64) return 0 ;;
#sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=8.4.1.20180329 # uncomment only for -alpha, -beta, -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? ( https://downloads.haskell.org/~ghc/${PV/_/-}/${GHC_P}-src.tar.xz )"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
)
LICENSE="BSD"
SLOT="0/${PV}"
#KEYWORDS="~alpha ~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="doc ghcbootstrap ghcmakebinary +gmp profile"
IUSE+=" binary"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
sys-libs/ncurses:0=[unicode]
!ghcmakebinary? ( dev-libs/libffi:= )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses:0/6
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-python/sphinx
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
REQUIRED_USE="?? ( ghcbootstrap binary )"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
is_native() {
[[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
}
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
# TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
if ! is_native; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
# Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
# options to gcc.
if is_native; then
# hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
# are not built with fPIC, bug #606666
gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
tc-is-gcc && version_is_at_least 6.3 $(gcc-version) && if ! use ghcbootstrap; then
# gcc-6.3 has support for -no-pie upstream, but spelling differs from
# gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
# hardened users try '-pie' in USE=ghcbootstrap mode.
append-ghc-cflags compile link -no-pie
fi
# prevent from failing to build unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
fi
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${GHC_PV}-orig"
cp "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
"${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
"${WORKDIR}/usr/bin/haddock-ghc-${GHC_PV}" \
"${WORKDIR}/usr/bin/hp2ps" \
"${WORKDIR}/usr/bin/hpc" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
"${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
ghc-check-reqs() {
# These are pessimistic values (slightly bigger than worst-case)
# Worst case is UNREG USE=profile ia64. See bug #611866 for some
# numbers on various arches.
CHECKREQS_DISK_BUILD=8G
CHECKREQS_DISK_USR=2G
# USE=binary roughly takes
use binary && CHECKREQS_DISK_BUILD=4G
"$@"
}
pkg_pretend() {
ghc-check-reqs check-reqs_pkg_pretend
}
pkg_setup() {
ghc-check-reqs check-reqs_pkg_setup
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
esac
unpack ${ONLYA}
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/ghc-${GHC_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
eapply_user
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# much arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise eapply will break
eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
eapply "${FILESDIR}"/${PN}-8.0.2-no-relax-everywhere.patch
eapply "${FILESDIR}"/${PN}-8.4.2-allow-cross-bootstrap.patch
# a bunch of crosscompiler patches
# needs newer version:
#eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
# mingw32 target
pushd "${S}/libraries/Win32"
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
popd
bump_libs
eapply_user
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# Speed up initial Cabal bootstrap
echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# not used outside of ghc's test
if [[ -n ${GHC_BUILD_DPH} ]]; then
echo "BUILD_DPH = YES" >> mk/build.mk
else
echo "BUILD_DPH = NO" >> mk/build.mk
fi
# Any non-native build has to skip as it needs
# target haddock binary to be runnabine.
if ! is_native; then
# disable docs generation as it requires running stage2
echo "HADDOCK_DOCS=NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
fi
if is_crosscompile; then
# Install ghc-stage1 crosscompiler instead of
# ghc-stage2 cross-built compiler.
echo "Stage1Only=YES" >> mk/build.mk
fi
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds toolchain it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
# User can use EXTRA_ECONF=CC=... to override this default.
econf_args+=(
AR=${CTARGET}-ar
CC=${CTARGET}-gcc
# these should be inferred by GHC but ghc defaults
# to using bundled tools on windows.
Windres=${CTARGET}-windres
DllWrap=${CTARGET}-dllwrap
# we set the linker explicitly below
--disable-ld-override
)
case ${CTARGET} in
arm*)
# ld.bfd-2.28 does not work for ghc. Force ld.gold
# instead. This should be removed once gentoo gets
# a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
econf_args+=(LD=${CTARGET}-ld.gold)
;;
sparc*)
# ld.gold-2.28 does not work for ghc. Force ld.bfd
# instead. This should be removed once gentoo gets
# a fix for missing --no-relax support bug:
# https://sourceware.org/ml/binutils/2017-07/msg00183.html
econf_args+=(LD=${CTARGET}-ld.bfd)
;;
*)
econf_args+=(LD=${CTARGET}-ld)
esac
if [[ ${CBUILD} != ${CHOST} ]]; then
# GHC bug: ghc claims not to support cross-building.
# It does, but does not distinct --host= value
# for stage1 and stage2 compiler.
econf_args+=(--host=${CBUILD})
fi
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
elif is_native; then
# using ${GTARGET}'s libffi is not supported yet:
# GHC embeds full path for ffi includes without /usr/${CTARGET} account.
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
einfo "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# Stage1Only crosscompiler does not build stage2
if ! is_crosscompile; then
# 1. build/pax-mark compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 2. build/pax-mark haddock using ghc-stage2
if is_native; then
# non-native build does not build haddock
# due to HADDOCK_DOCS=NO, but it could.
emake utils/haddock/dist/build/tmp/haddock
pax-mark -m utils/haddock/dist/build/tmp/haddock
fi
fi
# 3. and then all the rest
emake all
fi # ! use binary
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
[[ -f VERSION ]] || emake VERSION
# -j1 due to a rare race in install script:
# make --no-print-directory -f ghc.mk phase=final install
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
# -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
# "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
# /usr/bin/install: cannot create regular file \
# '/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
emake -j1 install DESTDIR="${D}"
# Skip for cross-targets as they all share target location:
# /usr/share/doc/ghc-9999/
if ! is_crosscompile; then
dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
fi
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,775 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib multiprocessing pax-utils toolchain-funcs versionator prefix
inherit check-reqs
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
BIN_PV=${PV}
# sorted!
#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
#alpha) return 0 ;;
#arm64) return 0 ;;
#arm) return 0 ;;
amd64) return 0 ;;
#ia64) return 0 ;;
#ppc) return 0 ;;
#ppc64) return 0 ;;
#sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=8.6.0.20180810 # uncomment only for -alpha, -beta, -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? (
https://downloads.haskell.org/~ghc/${PV/_/-}/${GHC_P}-src.tar.xz
test? ( https://downloads.haskell.org/~ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
)"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
)
LICENSE="BSD"
SLOT="0/${PV}"
#will need big tree sync
#KEYWORDS="~amd64 ~x86"
IUSE="doc ghcbootstrap ghcmakebinary +gmp profile test"
RESTRICT="!test? ( test )"
IUSE+=" binary"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
sys-libs/ncurses:0=[unicode]
!ghcmakebinary? ( dev-libs/libffi:= )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses:0/6
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-python/sphinx
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
REQUIRED_USE="?? ( ghcbootstrap binary )"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
is_native() {
[[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
}
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
# TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
if ! is_native; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
# Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
# options to gcc.
if is_native; then
# hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
# are not built with fPIC, bug #606666
gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
tc-is-gcc && version_is_at_least 6.3 $(gcc-version) && if ! use ghcbootstrap; then
# gcc-6.3 has support for -no-pie upstream, but spelling differs from
# gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
# hardened users try '-pie' in USE=ghcbootstrap mode.
append-ghc-cflags compile link -no-pie
fi
# prevent from failing to build unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
fi
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1 ghc_v=${BIN_PV}
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${ghc_v}-orig"
cp "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/haddock-ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/hp2ps" \
"${WORKDIR}/usr/bin/hpc" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
ghc-check-reqs() {
# These are pessimistic values (slightly bigger than worst-case)
# Worst case is UNREG USE=profile ia64. See bug #611866 for some
# numbers on various arches.
CHECKREQS_DISK_BUILD=8G
CHECKREQS_DISK_USR=2G
# USE=binary roughly takes
use binary && CHECKREQS_DISK_BUILD=4G
"$@"
}
pkg_pretend() {
ghc-check-reqs check-reqs_pkg_pretend
}
pkg_setup() {
ghc-check-reqs check-reqs_pkg_setup
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
esac
unpack ${ONLYA}
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/ghc-${BIN_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
eapply_user
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# many arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise eapply will break
eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
eapply "${FILESDIR}"/${PN}-8.0.2-no-relax-everywhere.patch
eapply "${FILESDIR}"/${PN}-8.4.2-allow-cross-bootstrap.patch
# a bunch of crosscompiler patches
# needs newer version:
#eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
# mingw32 target
pushd "${S}/libraries/Win32"
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
popd
bump_libs
eapply_user
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# Speed up initial Cabal bootstrap
echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# not used outside of ghc's test
if [[ -n ${GHC_BUILD_DPH} ]]; then
echo "BUILD_DPH = YES" >> mk/build.mk
else
echo "BUILD_DPH = NO" >> mk/build.mk
fi
# Any non-native build has to skip as it needs
# target haddock binary to be runnabine.
if ! is_native; then
# disable docs generation as it requires running stage2
echo "HADDOCK_DOCS=NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
fi
if is_crosscompile; then
# Install ghc-stage1 crosscompiler instead of
# ghc-stage2 cross-built compiler.
echo "Stage1Only=YES" >> mk/build.mk
fi
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds toolchain it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
# User can use EXTRA_ECONF=CC=... to override this default.
econf_args+=(
AR=${CTARGET}-ar
CC=${CTARGET}-gcc
# these should be inferred by GHC but ghc defaults
# to using bundled tools on windows.
Windres=${CTARGET}-windres
DllWrap=${CTARGET}-dllwrap
# we set the linker explicitly below
--disable-ld-override
)
case ${CTARGET} in
arm*)
# ld.bfd-2.28 does not work for ghc. Force ld.gold
# instead. This should be removed once gentoo gets
# a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
econf_args+=(LD=${CTARGET}-ld.gold)
;;
sparc*)
# ld.gold-2.28 does not work for ghc. Force ld.bfd
# instead. This should be removed once gentoo gets
# a fix for missing --no-relax support bug:
# https://sourceware.org/ml/binutils/2017-07/msg00183.html
econf_args+=(LD=${CTARGET}-ld.bfd)
;;
*)
econf_args+=(LD=${CTARGET}-ld)
esac
if [[ ${CBUILD} != ${CHOST} ]]; then
# GHC bug: ghc claims not to support cross-building.
# It does, but does not distinct --host= value
# for stage1 and stage2 compiler.
econf_args+=(--host=${CBUILD})
fi
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
elif is_native; then
# using ${GTARGET}'s libffi is not supported yet:
# GHC embeds full path for ffi includes without /usr/${CTARGET} account.
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
einfo "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# Stage1Only crosscompiler does not build stage2
if ! is_crosscompile; then
# 1. build/pax-mark compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 2. build/pax-mark haddock using ghc-stage2
if is_native; then
# non-native build does not build haddock
# due to HADDOCK_DOCS=NO, but it could.
emake utils/haddock/dist/build/tmp/haddock
pax-mark -m utils/haddock/dist/build/tmp/haddock
fi
fi
# 3. and then all the rest
emake all
fi # ! use binary
}
src_test() {
# TODO: deal with:
# - sandbox (pollutes environment)
# - extra packages (to extend testsuite coverage)
# bits are taken from 'validate'
local make_test_target='test' # can be fulltest
# not 'emake' as testsuite uses '$MAKE' without jobserver available
make $make_test_target stage=2 THREADS=$(makeopts_jobs)
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
[[ -f VERSION ]] || emake VERSION
# -j1 due to a rare race in install script:
# make --no-print-directory -f ghc.mk phase=final install
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
# -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
# "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
# /usr/bin/install: cannot create regular file \
# '/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
emake -j1 install DESTDIR="${D}"
# Skip for cross-targets as they all share target location:
# /usr/share/doc/ghc-9999/
if ! is_crosscompile; then
dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
fi
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,784 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib multiprocessing pax-utils toolchain-funcs versionator prefix
inherit check-reqs
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
BIN_PV=${PV}
# sorted!
#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
arch_binaries="$arch_binaries ppc64? ( !big-endian? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tbz2 ) )"
#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
#alpha) return 0 ;;
#arm64) return 0 ;;
#arm) return 0 ;;
amd64) return 0 ;;
#ia64) return 0 ;;
#ppc) return 0 ;;
ppc64)
use big-endian && return 1
return 0
;;
#sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=8.6.0.20180810 # uncomment only for -alpha, -beta, -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? (
https://downloads.haskell.org/~ghc/${PV/_/-}/${GHC_P}-src.tar.xz
test? ( https://downloads.haskell.org/~ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
)"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
)
LICENSE="BSD"
SLOT="0/${PV}"
# to be rekeyworded when most of revdeps are updated
#KEYWORDS="~amd64 ~x86"
IUSE="big-endian doc elfutils ghcbootstrap ghcmakebinary +gmp numa profile test"
IUSE+=" binary"
RESTRICT="!test? ( test )"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
sys-libs/ncurses:0=[unicode]
elfutils? ( dev-libs/elfutils )
!ghcmakebinary? ( dev-libs/libffi:= )
numa? ( sys-process/numactl )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses:0/6
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-python/sphinx
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
REQUIRED_USE="?? ( ghcbootstrap binary )"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
is_native() {
[[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
}
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
# TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
if ! is_native; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
# Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
# options to gcc.
if is_native; then
# hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
# are not built with fPIC, bug #606666
gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
tc-is-gcc && version_is_at_least 6.3 $(gcc-version) && if ! use ghcbootstrap; then
# gcc-6.3 has support for -no-pie upstream, but spelling differs from
# gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
# hardened users try '-pie' in USE=ghcbootstrap mode.
append-ghc-cflags compile link -no-pie
fi
# prevent from failing to build unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
fi
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1 ghc_v=${BIN_PV}
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${ghc_v}-orig"
cp "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/haddock-ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/hp2ps" \
"${WORKDIR}/usr/bin/hpc" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
ghc-check-reqs() {
# These are pessimistic values (slightly bigger than worst-case)
# Worst case is UNREG USE=profile ia64. See bug #611866 for some
# numbers on various arches.
CHECKREQS_DISK_BUILD=8G
CHECKREQS_DISK_USR=2G
# USE=binary roughly takes
use binary && CHECKREQS_DISK_BUILD=4G
"$@"
}
pkg_pretend() {
ghc-check-reqs check-reqs_pkg_pretend
}
pkg_setup() {
ghc-check-reqs check-reqs_pkg_setup
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
esac
unpack ${ONLYA}
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/ghc-${BIN_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
eapply_user
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# many arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise eapply will break
eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
eapply "${FILESDIR}"/${PN}-8.0.2-no-relax-everywhere.patch
eapply "${FILESDIR}"/${PN}-8.4.2-allow-cross-bootstrap.patch
eapply "${FILESDIR}"/${PN}-8.6.5-numa.patch
# a bunch of crosscompiler patches
# needs newer version:
#eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
# mingw32 target
pushd "${S}/libraries/Win32"
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
popd
bump_libs
eapply_user
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# Speed up initial Cabal bootstrap
echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# not used outside of ghc's test
if [[ -n ${GHC_BUILD_DPH} ]]; then
echo "BUILD_DPH = YES" >> mk/build.mk
else
echo "BUILD_DPH = NO" >> mk/build.mk
fi
# Any non-native build has to skip as it needs
# target haddock binary to be runnabine.
if ! is_native; then
# disable docs generation as it requires running stage2
echo "HADDOCK_DOCS=NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
fi
if is_crosscompile; then
# Install ghc-stage1 crosscompiler instead of
# ghc-stage2 cross-built compiler.
echo "Stage1Only=YES" >> mk/build.mk
fi
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds toolchain it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
# User can use EXTRA_ECONF=CC=... to override this default.
econf_args+=(
AR=${CTARGET}-ar
CC=${CTARGET}-gcc
# these should be inferred by GHC but ghc defaults
# to using bundled tools on windows.
Windres=${CTARGET}-windres
DllWrap=${CTARGET}-dllwrap
# we set the linker explicitly below
--disable-ld-override
)
case ${CTARGET} in
arm*)
# ld.bfd-2.28 does not work for ghc. Force ld.gold
# instead. This should be removed once gentoo gets
# a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
econf_args+=(LD=${CTARGET}-ld.gold)
;;
sparc*)
# ld.gold-2.28 does not work for ghc. Force ld.bfd
# instead. This should be removed once gentoo gets
# a fix for missing --no-relax support bug:
# https://sourceware.org/ml/binutils/2017-07/msg00183.html
econf_args+=(LD=${CTARGET}-ld.bfd)
;;
*)
econf_args+=(LD=${CTARGET}-ld)
esac
if [[ ${CBUILD} != ${CHOST} ]]; then
# GHC bug: ghc claims not to support cross-building.
# It does, but does not distinct --host= value
# for stage1 and stage2 compiler.
econf_args+=(--host=${CBUILD})
fi
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
elif is_native; then
# using ${GTARGET}'s libffi is not supported yet:
# GHC embeds full path for ffi includes without /usr/${CTARGET} account.
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
einfo "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} \
--enable-bootstrap-with-devel-snapshot \
$(use elfutils && echo --enable-dwarf-unwind) \
$(use_enable numa)
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# Stage1Only crosscompiler does not build stage2
if ! is_crosscompile; then
# 1. build/pax-mark compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 2. build/pax-mark haddock using ghc-stage2
if is_native; then
# non-native build does not build haddock
# due to HADDOCK_DOCS=NO, but it could.
emake utils/haddock/dist/build/tmp/haddock
pax-mark -m utils/haddock/dist/build/tmp/haddock
fi
fi
# 3. and then all the rest
emake all
fi # ! use binary
}
src_test() {
# TODO: deal with:
# - sandbox (pollutes environment)
# - extra packages (to extend testsuite coverage)
# bits are taken from 'validate'
local make_test_target='test' # can be fulltest
# not 'emake' as testsuite uses '$MAKE' without jobserver available
make $make_test_target stage=2 THREADS=$(makeopts_jobs)
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
[[ -f VERSION ]] || emake VERSION
# -j1 due to a rare race in install script:
# make --no-print-directory -f ghc.mk phase=final install
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
# -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
# "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
# /usr/bin/install: cannot create regular file \
# '/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
emake -j1 install DESTDIR="${D}"
# Skip for cross-targets as they all share target location:
# /usr/share/doc/ghc-9999/
if ! is_crosscompile; then
dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
fi
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,804 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib multiprocessing pax-utils toolchain-funcs prefix
inherit check-reqs
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
BIN_PV=${PV}
# sorted!
#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
arch_binaries="$arch_binaries ppc64? ( !big-endian? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tbz2 ) )"
#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
#alpha) return 0 ;;
#arm64) return 0 ;;
#arm) return 0 ;;
amd64) return 0 ;;
#ia64) return 0 ;;
#ppc) return 0 ;;
ppc64)
use big-endian && return 1
return 0
;;
#sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=8.6.0.20180810 # uncomment only for -alpha, -beta, -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? (
https://downloads.haskell.org/~ghc/${PV/_/-}/${GHC_P}-src.tar.xz
test? ( https://downloads.haskell.org/~ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
)"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
)
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS=""
IUSE="big-endian doc elfutils ghcbootstrap ghcmakebinary +gmp numa profile test"
IUSE+=" binary"
RESTRICT="!test? ( test )"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
sys-libs/ncurses:0=[unicode]
elfutils? ( dev-libs/elfutils )
!ghcmakebinary? ( dev-libs/libffi:= )
numa? ( sys-process/numactl )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses:0/6
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-python/sphinx
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
REQUIRED_USE="?? ( ghcbootstrap binary )"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
is_native() {
[[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
}
if ! is_crosscompile; then
PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
fi
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
# TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
if ! is_native; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
# Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
# options to gcc.
if is_native; then
# hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
# are not built with fPIC, bug #606666
gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
tc-is-gcc && ver_test $(gcc-version) -ge 6.3 && if ! use ghcbootstrap; then
# gcc-6.3 has support for -no-pie upstream, but spelling differs from
# gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
# hardened users try '-pie' in USE=ghcbootstrap mode.
append-ghc-cflags compile link -no-pie
fi
# prevent from failing to build unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
fi
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1 ghc_v=${BIN_PV}
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${ghc_v}-orig"
cp "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/haddock-ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/hp2ps" \
"${WORKDIR}/usr/bin/hpc" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
ghc-check-reqs() {
# These are pessimistic values (slightly bigger than worst-case)
# Worst case is UNREG USE=profile ia64. See bug #611866 for some
# numbers on various arches.
CHECKREQS_DISK_BUILD=8G
CHECKREQS_DISK_USR=2G
# USE=binary roughly takes
use binary && CHECKREQS_DISK_BUILD=4G
"$@"
}
pkg_pretend() {
ghc-check-reqs check-reqs_pkg_pretend
}
pkg_setup() {
ghc-check-reqs check-reqs_pkg_setup
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
esac
unpack ${ONLYA}
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/ghc-${BIN_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
eapply_user
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# many arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise eapply will break
eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
eapply "${FILESDIR}"/${PN}-8.0.2-no-relax-everywhere.patch
eapply "${FILESDIR}"/${PN}-8.4.2-allow-cross-bootstrap.patch
eapply "${FILESDIR}"/${PN}-8.6.5-numa.patch
eapply "${FILESDIR}"/${PN}-8.8.1-no-alex.patch
eapply "${FILESDIR}"/${PN}-8.8.1-revert-CPP.patch
# a bunch of crosscompiler patches
# needs newer version:
#eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
# mingw32 target
pushd "${S}/libraries/Win32"
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
popd
bump_libs
eapply_user
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# Speed up initial Cabal bootstrap
echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# not used outside of ghc's test
if [[ -n ${GHC_BUILD_DPH} ]]; then
echo "BUILD_DPH = YES" >> mk/build.mk
else
echo "BUILD_DPH = NO" >> mk/build.mk
fi
# Any non-native build has to skip as it needs
# target haddock binary to be runnabine.
if ! is_native; then
# disable docs generation as it requires running stage2
echo "HADDOCK_DOCS=NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
fi
if is_crosscompile; then
# Install ghc-stage1 crosscompiler instead of
# ghc-stage2 cross-built compiler.
echo "Stage1Only=YES" >> mk/build.mk
fi
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds toolchain it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
# User can use EXTRA_ECONF=CC=... to override this default.
econf_args+=(
AR=${CTARGET}-ar
CC=${CTARGET}-gcc
# these should be inferred by GHC but ghc defaults
# to using bundled tools on windows.
Windres=${CTARGET}-windres
DllWrap=${CTARGET}-dllwrap
# we set the linker explicitly below
--disable-ld-override
)
case ${CTARGET} in
arm*)
# ld.bfd-2.28 does not work for ghc. Force ld.gold
# instead. This should be removed once gentoo gets
# a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
econf_args+=(LD=${CTARGET}-ld.gold)
;;
sparc*)
# ld.gold-2.28 does not work for ghc. Force ld.bfd
# instead. This should be removed once gentoo gets
# a fix for missing --no-relax support bug:
# https://sourceware.org/ml/binutils/2017-07/msg00183.html
econf_args+=(LD=${CTARGET}-ld.bfd)
;;
*)
econf_args+=(LD=${CTARGET}-ld)
esac
if [[ ${CBUILD} != ${CHOST} ]]; then
# GHC bug: ghc claims not to support cross-building.
# It does, but does not distinct --host= value
# for stage1 and stage2 compiler.
econf_args+=(--host=${CBUILD})
fi
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
elif is_native; then
# using ${GTARGET}'s libffi is not supported yet:
# GHC embeds full path for ffi includes without /usr/${CTARGET} account.
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
einfo "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} \
--enable-bootstrap-with-devel-snapshot \
$(use elfutils && echo --enable-dwarf-unwind) \
$(use_enable numa)
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# Stage1Only crosscompiler does not build stage2
if ! is_crosscompile; then
# 1. build/pax-mark compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 2. build/pax-mark haddock using ghc-stage2
if is_native; then
# non-native build does not build haddock
# due to HADDOCK_DOCS=NO, but it could.
emake utils/haddock/dist/build/tmp/haddock
pax-mark -m utils/haddock/dist/build/tmp/haddock
fi
fi
# 3. and then all the rest
emake all
fi # ! use binary
}
src_test() {
# TODO: deal with:
# - sandbox (pollutes environment)
# - extra packages (to extend testsuite coverage)
# bits are taken from 'validate'
local make_test_target='test' # can be fulltest
# not 'emake' as testsuite uses '$MAKE' without jobserver available
make $make_test_target stage=2 THREADS=$(makeopts_jobs)
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
[[ -f VERSION ]] || emake VERSION
# -j1 due to a rare race in install script:
# make --no-print-directory -f ghc.mk phase=final install
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
# -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
# "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
# /usr/bin/install: cannot create regular file \
# '/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
emake -j1 install DESTDIR="${D}"
# Skip for cross-targets as they all share target location:
# /usr/share/doc/ghc-9999/
if ! is_crosscompile; then
dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
fi
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
if is_crosscompile; then
# When we build a cross-compiler the layout is the following:
# usr/lib/${CTARGET}-ghc-${VER}/ contains target libraries
# but
# usr/lib/${CTARGET}-ghc-${VER}/bin/ directory
# containst host binaries (modulo bugs).
# Portage's stripping mechanism does not skip stripping
# foreign binaries. This frequently causes binaries to be
# broken.
#
# Thus below we disable stripping of target libraries and allow
# stripping hosts executables.
dostrip -x "/usr/$(get_libdir)/$(cross)${GHC_P}"
dostrip "/usr/$(get_libdir)/$(cross)${GHC_P}/bin"
fi
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,803 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib multiprocessing pax-utils toolchain-funcs prefix
inherit check-reqs
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
BIN_PV=${PV}
# sorted!
#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( !big-endian? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tbz2 ) )"
#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
#alpha) return 0 ;;
#arm64) return 0 ;;
#arm) return 0 ;;
amd64) return 0 ;;
#ia64) return 0 ;;
#ppc) return 0 ;;
#ppc64)
# use big-endian && return 1
# return 0
# ;;
#sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=8.6.0.20180810 # uncomment only for -alpha, -beta, -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? (
https://downloads.haskell.org/~ghc/${PV/_/-}/${GHC_P}-src.tar.xz
test? ( https://downloads.haskell.org/~ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
)"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
)
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS=""
IUSE="big-endian doc elfutils ghcbootstrap ghcmakebinary +gmp numa profile test"
IUSE+=" binary"
RESTRICT="!test? ( test )"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
sys-libs/ncurses:0=[unicode]
elfutils? ( dev-libs/elfutils )
!ghcmakebinary? ( dev-libs/libffi:= )
numa? ( sys-process/numactl )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses:0/6
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-python/sphinx
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
REQUIRED_USE="?? ( ghcbootstrap binary )"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
is_native() {
[[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
}
if ! is_crosscompile; then
PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
fi
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
# TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
if ! is_native; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
# Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
# options to gcc.
if is_native; then
# hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
# are not built with fPIC, bug #606666
gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
tc-is-gcc && ver_test $(gcc-version) -ge 6.3 && if ! use ghcbootstrap; then
# gcc-6.3 has support for -no-pie upstream, but spelling differs from
# gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
# hardened users try '-pie' in USE=ghcbootstrap mode.
append-ghc-cflags compile link -no-pie
fi
# prevent from failing to build unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
fi
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1 ghc_v=${BIN_PV}
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${ghc_v}-orig"
cp "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/haddock-ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/hp2ps" \
"${WORKDIR}/usr/bin/hpc" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
ghc-check-reqs() {
# These are pessimistic values (slightly bigger than worst-case)
# Worst case is UNREG USE=profile ia64. See bug #611866 for some
# numbers on various arches.
CHECKREQS_DISK_BUILD=8G
CHECKREQS_DISK_USR=2G
# USE=binary roughly takes
use binary && CHECKREQS_DISK_BUILD=4G
"$@"
}
pkg_pretend() {
ghc-check-reqs check-reqs_pkg_pretend
}
pkg_setup() {
ghc-check-reqs check-reqs_pkg_setup
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
esac
unpack ${ONLYA}
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/ghc-${BIN_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
eapply_user
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# many arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise eapply will break
eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
eapply "${FILESDIR}"/${PN}-8.0.2-no-relax-everywhere.patch
eapply "${FILESDIR}"/${PN}-8.4.2-allow-cross-bootstrap.patch
eapply "${FILESDIR}"/${PN}-8.6.5-numa.patch
eapply "${FILESDIR}"/${PN}-8.8.1-revert-CPP.patch
# a bunch of crosscompiler patches
# needs newer version:
#eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
# mingw32 target
pushd "${S}/libraries/Win32"
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
popd
bump_libs
eapply_user
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# Speed up initial Cabal bootstrap
echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# not used outside of ghc's test
if [[ -n ${GHC_BUILD_DPH} ]]; then
echo "BUILD_DPH = YES" >> mk/build.mk
else
echo "BUILD_DPH = NO" >> mk/build.mk
fi
# Any non-native build has to skip as it needs
# target haddock binary to be runnabine.
if ! is_native; then
# disable docs generation as it requires running stage2
echo "HADDOCK_DOCS=NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
fi
if is_crosscompile; then
# Install ghc-stage1 crosscompiler instead of
# ghc-stage2 cross-built compiler.
echo "Stage1Only=YES" >> mk/build.mk
fi
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds toolchain it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
# User can use EXTRA_ECONF=CC=... to override this default.
econf_args+=(
AR=${CTARGET}-ar
CC=${CTARGET}-gcc
# these should be inferred by GHC but ghc defaults
# to using bundled tools on windows.
Windres=${CTARGET}-windres
DllWrap=${CTARGET}-dllwrap
# we set the linker explicitly below
--disable-ld-override
)
case ${CTARGET} in
arm*)
# ld.bfd-2.28 does not work for ghc. Force ld.gold
# instead. This should be removed once gentoo gets
# a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
econf_args+=(LD=${CTARGET}-ld.gold)
;;
sparc*)
# ld.gold-2.28 does not work for ghc. Force ld.bfd
# instead. This should be removed once gentoo gets
# a fix for missing --no-relax support bug:
# https://sourceware.org/ml/binutils/2017-07/msg00183.html
econf_args+=(LD=${CTARGET}-ld.bfd)
;;
*)
econf_args+=(LD=${CTARGET}-ld)
esac
if [[ ${CBUILD} != ${CHOST} ]]; then
# GHC bug: ghc claims not to support cross-building.
# It does, but does not distinct --host= value
# for stage1 and stage2 compiler.
econf_args+=(--host=${CBUILD})
fi
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
elif is_native; then
# using ${GTARGET}'s libffi is not supported yet:
# GHC embeds full path for ffi includes without /usr/${CTARGET} account.
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
einfo "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} \
--enable-bootstrap-with-devel-snapshot \
$(use elfutils && echo --enable-dwarf-unwind) \
$(use_enable numa)
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# Stage1Only crosscompiler does not build stage2
if ! is_crosscompile; then
# 1. build/pax-mark compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 2. build/pax-mark haddock using ghc-stage2
if is_native; then
# non-native build does not build haddock
# due to HADDOCK_DOCS=NO, but it could.
emake utils/haddock/dist/build/tmp/haddock
pax-mark -m utils/haddock/dist/build/tmp/haddock
fi
fi
# 3. and then all the rest
emake all
fi # ! use binary
}
src_test() {
# TODO: deal with:
# - sandbox (pollutes environment)
# - extra packages (to extend testsuite coverage)
# bits are taken from 'validate'
local make_test_target='test' # can be fulltest
# not 'emake' as testsuite uses '$MAKE' without jobserver available
make $make_test_target stage=2 THREADS=$(makeopts_jobs)
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
[[ -f VERSION ]] || emake VERSION
# -j1 due to a rare race in install script:
# make --no-print-directory -f ghc.mk phase=final install
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
# -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
# "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
# /usr/bin/install: cannot create regular file \
# '/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
emake -j1 install DESTDIR="${D}"
# Skip for cross-targets as they all share target location:
# /usr/share/doc/ghc-9999/
if ! is_crosscompile; then
dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
fi
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
if is_crosscompile; then
# When we build a cross-compiler the layout is the following:
# usr/lib/${CTARGET}-ghc-${VER}/ contains target libraries
# but
# usr/lib/${CTARGET}-ghc-${VER}/bin/ directory
# containst host binaries (modulo bugs).
# Portage's stripping mechanism does not skip stripping
# foreign binaries. This frequently causes binaries to be
# broken.
#
# Thus below we disable stripping of target libraries and allow
# stripping hosts executables.
dostrip -x "/usr/$(get_libdir)/$(cross)${GHC_P}"
dostrip "/usr/$(get_libdir)/$(cross)${GHC_P}/bin"
fi
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

@ -1,808 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# to make make a crosscompiler use crossdev and symlink ghc tree into
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib multiprocessing pax-utils toolchain-funcs prefix
inherit check-reqs
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="https://www.haskell.org/ghc/"
# we don't have any binaries yet
arch_binaries=""
BIN_PV=${PV}
# sorted!
#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( !big-endian? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tbz2 ) )"
#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
# various ports:
#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
# 0 - yet
yet_binary() {
case "${ARCH}" in
#alpha) return 0 ;;
#arm64) return 0 ;;
#arm) return 0 ;;
amd64) return 0 ;;
#ia64) return 0 ;;
#ppc) return 0 ;;
#ppc64)
# use big-endian && return 1
# return 0
# ;;
#sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
}
GHC_PV=${PV}
#GHC_PV=8.6.0.20180810 # uncomment only for -alpha, -beta, -rc ebuilds
GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
SRC_URI="!binary? (
https://downloads.haskell.org/~ghc/${PV/_/-}/${GHC_P}-src.tar.xz
test? ( https://downloads.haskell.org/~ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
)"
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
BUMP_LIBRARIES=(
# "hackage-name hackage-version"
)
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS=""
IUSE="big-endian doc elfutils ghcbootstrap ghcmakebinary +gmp numa profile test"
IUSE+=" binary"
RESTRICT="!test? ( test )"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
sys-libs/ncurses:0=[unicode]
elfutils? ( dev-libs/elfutils )
!ghcmakebinary? ( dev-libs/libffi:= )
numa? ( sys-process/numactl )
"
# This set of dependencies is needed to run
# prebuilt ghc. We specifically avoid ncurses
# dependency with:
# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
PREBUILT_BINARY_DEPENDS="
!prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
"
# This set of dependencies is needed to install
# ghc[binary] in system. terminfo package is linked
# against ncurses.
PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
sys-libs/ncurses:0/6
"
RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-python/sphinx
>=dev-libs/libxslt-1.1.2 )
!ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
# we build binaries without profiling support
REQUIRED_USE="
?? ( ghcbootstrap binary )
?? ( profile binary )
"
# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
is_native() {
[[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
}
if ! is_crosscompile; then
PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
fi
# returns tool prefix for crosscompiler.
# Example:
# CTARGET=armv7a-unknown-linux-gnueabi
# CHOST=x86_64-pc-linux-gnu
# "armv7a-unknown-linux-gnueabi-"
# CTARGET=${CHOST}
# ""
# Used in tools and library prefix:
# "${ED}"/usr/bin/$(cross)haddock
# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
cross() {
if is_crosscompile; then
echo "${CTARGET}-"
else
echo ""
fi
}
append-ghc-cflags() {
local persistent compile assemble link
local flag ghcflag
for flag in $*; do
case ${flag} in
persistent) persistent="yes";;
compile) compile="yes";;
assemble) assemble="yes";;
link) link="yes";;
*)
[[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
[[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
[[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
;;
esac
done
}
# $1 - lib name (under libraries/)
# $2 - lib version
# example: bump_lib "transformers" "0.4.2.0"
bump_lib() {
local pn=$1 pv=$2
local p=${pn}-${pv}
local f
einfo "Bumping ${pn} up to ${pv}"
for f in ghc.mk GNUmakefile; do
mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
done
mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
}
update_SRC_URI() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
done
}
update_SRC_URI
bump_libs() {
local p pn pv
for p in "${BUMP_LIBRARIES[@]}"; do
set -- $p
pn=$1 pv=$2
bump_lib "${pn}" "${pv}"
done
}
ghc_setup_cflags() {
# TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
if ! is_native; then
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
einfo "Crosscompiling mode:"
einfo " CHOST: ${CHOST}"
einfo " CTARGET: ${CTARGET}"
einfo " CFLAGS: ${CFLAGS}"
einfo " LDFLAGS: ${LDFLAGS}"
einfo " prefix: $(cross)"
return
fi
# We need to be very careful with the CFLAGS we ask ghc to pass through to
# gcc. There are plenty of flags which will make gcc produce output that
# breaks ghc in various ways. The main ones we want to pass through are
# -mcpu / -march flags. These are important for arches like alpha & sparc.
# We also use these CFLAGS for building the C parts of ghc, ie the rts.
strip-flags
strip-unsupported-flags
# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2
GHC_FLAGS=""
GHC_PERSISTENT_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
# Ignore extra optimisation (ghc passes -O to gcc anyway)
# -O2 and above break on too many systems
-O*) ;;
# Arch and ABI flags are what we're really after
-m*) append-ghc-cflags compile assemble ${flag};;
# Sometimes it's handy to see backtrace of RTS
# to get an idea what happens there
-g*) append-ghc-cflags compile ${flag};;
# Ignore all other flags, including all -f* flags
esac
done
for flag in ${LDFLAGS}; do
append-ghc-cflags link ${flag}
done
# GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
# Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
# options to gcc.
if is_native; then
# hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
# are not built with fPIC, bug #606666
gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
tc-is-gcc && ver_test $(gcc-version) -ge 6.3 && if ! use ghcbootstrap; then
# gcc-6.3 has support for -no-pie upstream, but spelling differs from
# gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
# hardened users try '-pie' in USE=ghcbootstrap mode.
append-ghc-cflags compile link -no-pie
fi
# prevent from failing to build unregisterised ghc:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
fi
}
# substitutes string $1 to $2 in files $3 $4 ...
relocate_path() {
local from=$1
local to=$2
shift 2
local file=
for file in "$@"
do
sed -i -e "s|$from|$to|g" \
"$file" || die "path relocation failed for '$file'"
done
}
# changes hardcoded ghc paths and updates package index
# $1 - new absolute root path
relocate_ghc() {
local to=$1 ghc_v=${BIN_PV}
# libdir for prebuilt binary and for current system may mismatch
# It does for prefix installation for example: bug #476998
local bin_ghc_prefix=${WORKDIR}/usr
local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
# backup original script to use it later after relocation
local gp_back="${T}/ghc-pkg-${ghc_v}-orig"
cp "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
if [[ ${bin_libdir} != $(get_libdir) ]]; then
einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
# moving the dir itself is not strictly needed
# but then USE=binary would result in installing
# in '${bin_libdir}'
mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"$gp_back" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
fi
# Relocate from /usr to ${EPREFIX}/usr
relocate_path "/usr" "${to}/usr" \
"${WORKDIR}/usr/bin/ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/ghci-${ghc_v}" \
"${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
"${WORKDIR}/usr/bin/haddock-ghc-${ghc_v}" \
"${WORKDIR}/usr/bin/hp2ps" \
"${WORKDIR}/usr/bin/hpc" \
"${WORKDIR}/usr/bin/hsc2hs" \
"${WORKDIR}/usr/bin/runghc-${ghc_v}" \
"${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
# this one we will use to regenerate cache
# so it should point to current tree location
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
if use prefix; then
hprefixify "${bin_libpath}"/${PN}*/settings
fi
# regenerate the binary package cache
"$gp_back" recache || die "failed to update cache after relocation"
rm "$gp_back"
}
ghc-check-reqs() {
# These are pessimistic values (slightly bigger than worst-case)
# Worst case is UNREG USE=profile ia64. See bug #611866 for some
# numbers on various arches.
CHECKREQS_DISK_BUILD=8G
CHECKREQS_DISK_USR=2G
# USE=binary roughly takes
use binary && CHECKREQS_DISK_BUILD=4G
"$@"
}
pkg_pretend() {
ghc-check-reqs check-reqs_pkg_pretend
}
pkg_setup() {
ghc-check-reqs check-reqs_pkg_setup
# quiet portage about prebuilt binaries
use binary && QA_PREBUILT="*"
[[ ${MERGE_TYPE} == binary ]] && return
if use ghcbootstrap; then
ewarn "You requested ghc bootstrapping, this is usually only used"
ewarn "by Gentoo developers to make binary .tbz2 packages."
[[ -z $(type -P ghc) ]] && \
die "Could not find a ghc to bootstrap with."
else
if ! yet_binary; then
eerror "Please try emerging with USE=ghcbootstrap and report build"
eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
fi
fi
}
src_unpack() {
# Create the ${S} dir if we're using the binary version
use binary && mkdir "${S}"
# the Solaris and Darwin binaries from ghc (maeder) need to be
# unpacked separately, so prevent them from being unpacked
local ONLYA=${A}
case ${CHOST} in
*-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
esac
unpack ${ONLYA}
}
src_prepare() {
ghc_setup_cflags
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
# Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
# See bug #313635.
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${WORKDIR}/usr/bin/ghc-${BIN_PV}"
# allow hardened users use vanilla binary to bootstrap ghc
# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
fi
if use binary; then
if use prefix; then
relocate_ghc "${EPREFIX}"
fi
# Move unpacked files to the expected place
mv "${WORKDIR}/usr" "${S}"
eapply_user
else
if ! use ghcbootstrap; then
case ${CHOST} in
*-darwin* | *-solaris*)
# UPDATE ME for ghc-7
mkdir "${WORKDIR}"/ghc-bin-installer || die
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
popd > /dev/null
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
# fix the binaries so they run, on Solaris we need an
# LD_LIBRARY_PATH which has our prefix libdirs, on
# Darwin we need to replace the frameworks with our libs
# from the prefix fix before installation, because some
# of the tools are actually used during configure/make
if [[ ${CHOST} == *-solaris* ]] ; then
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
elif [[ ${CHOST} == *-darwin* ]] ; then
local readline_framework=GNUreadline.framework/GNUreadline
local gmp_framework=/opt/local/lib/libgmp.10.dylib
local ncurses_file=/opt/local/lib/libncurses.5.dylib
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
install_name_tool -change \
${readline_framework} \
"${EPREFIX}"/lib/libreadline.dylib \
${binary} || die
install_name_tool -change \
${gmp_framework} \
"${EPREFIX}"/usr/lib/libgmp.dylib \
${binary} || die
install_name_tool -change \
${ncurses_file} \
"${EPREFIX}"/usr/lib/libncurses.dylib \
${binary} || die
done
# we don't do frameworks!
sed -i \
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
rts/package.conf.in || die
fi
# it is autoconf, but we really don't want to give it too
# many arguments, in fact we do the make in-place anyway
./configure --prefix="${WORKDIR}"/usr || die
make install || die
popd > /dev/null
;;
*)
relocate_ghc "${WORKDIR}"
;;
esac
fi
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
"${S}/ghc/ghc.wrapper"
cd "${S}" # otherwise eapply will break
eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
eapply "${FILESDIR}"/${PN}-8.0.2-no-relax-everywhere.patch
eapply "${FILESDIR}"/${PN}-8.4.2-allow-cross-bootstrap.patch
eapply "${FILESDIR}"/${PN}-8.6.5-numa.patch
# rumors say this is fixed properly in 8.8.3. Let's check!
#eapply "${FILESDIR}"/${PN}-8.8.1-revert-CPP.patch
# a bunch of crosscompiler patches
# needs newer version:
#eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
# mingw32 target
pushd "${S}/libraries/Win32"
eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
popd
bump_libs
eapply_user
# as we have changed the build system
eautoreconf
fi
}
src_configure() {
if ! use binary; then
# initialize build.mk
echo '# Gentoo changes' > mk/build.mk
# Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
# We also need to use the GHC_FLAGS flags when building ghc itself
echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
# Speed up initial Cabal bootstrap
echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
# We can't depend on haddock except when bootstrapping when we
# must build docs and include them into the binary .tbz2 package
# app-text/dblatex is not in portage, can not build PDF or PS
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
# this controls presence on 'xhtml' and 'haddock' in final install
echo "HADDOCK_DOCS = YES" >> mk/build.mk
# not used outside of ghc's test
if [[ -n ${GHC_BUILD_DPH} ]]; then
echo "BUILD_DPH = YES" >> mk/build.mk
else
echo "BUILD_DPH = NO" >> mk/build.mk
fi
# Any non-native build has to skip as it needs
# target haddock binary to be runnabine.
if ! is_native; then
# disable docs generation as it requires running stage2
echo "HADDOCK_DOCS=NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
fi
if is_crosscompile; then
# Install ghc-stage1 crosscompiler instead of
# ghc-stage2 cross-built compiler.
echo "Stage1Only=YES" >> mk/build.mk
fi
# allows overriding build flavours for libraries:
# v - vanilla (static libs)
# p - profiled
# dyn - shared libraries
# example: GHC_LIBRARY_WAYS="v dyn"
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
fi
echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
# Get ghc from the unpacked binary .tbz2
# except when bootstrapping we just pick ghc up off the path
if ! use ghcbootstrap; then
export PATH="${WORKDIR}/usr/bin:${PATH}"
fi
echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
# don't strip anything. Very useful when stage2 SIGSEGVs on you
echo "STRIP_CMD = :" >> mk/build.mk
local econf_args=()
# GHC embeds toolchain it was built by and uses it later.
# Don't allow things like ccache or versioned binary slip.
# We use stable thing across gcc upgrades.
# User can use EXTRA_ECONF=CC=... to override this default.
econf_args+=(
AR=${CTARGET}-ar
CC=${CTARGET}-gcc
# these should be inferred by GHC but ghc defaults
# to using bundled tools on windows.
Windres=${CTARGET}-windres
DllWrap=${CTARGET}-dllwrap
# we set the linker explicitly below
--disable-ld-override
)
case ${CTARGET} in
arm*)
# ld.bfd-2.28 does not work for ghc. Force ld.gold
# instead. This should be removed once gentoo gets
# a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
econf_args+=(LD=${CTARGET}-ld.gold)
;;
sparc*)
# ld.gold-2.28 does not work for ghc. Force ld.bfd
# instead. This should be removed once gentoo gets
# a fix for missing --no-relax support bug:
# https://sourceware.org/ml/binutils/2017-07/msg00183.html
econf_args+=(LD=${CTARGET}-ld.bfd)
;;
*)
econf_args+=(LD=${CTARGET}-ld)
esac
if [[ ${CBUILD} != ${CHOST} ]]; then
# GHC bug: ghc claims not to support cross-building.
# It does, but does not distinct --host= value
# for stage1 and stage2 compiler.
econf_args+=(--host=${CBUILD})
fi
if use ghcmakebinary; then
# When building booting libary we are trying to
# bundle or restrict most of external depends
# with unstable ABI:
# - embed libffi (default GHC behaviour)
# - disable ncurses support for ghci (via haskeline)
# https://bugs.gentoo.org/557478
# - disable ncurses support for ghc-pkg
echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
elif is_native; then
# using ${GTARGET}'s libffi is not supported yet:
# GHC embeds full path for ffi includes without /usr/${CTARGET} account.
econf_args+=(--with-system-libffi)
econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
fi
einfo "Final mk/build.mk:"
cat mk/build.mk || die
econf ${econf_args[@]} \
--enable-bootstrap-with-devel-snapshot \
$(use elfutils && echo --enable-dwarf-unwind) \
$(use_enable numa)
if [[ ${PV} == *9999* ]]; then
GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
GHC_P=${PN}-${GHC_PV}
fi
fi # ! use binary
}
src_compile() {
if ! use binary; then
# Stage1Only crosscompiler does not build stage2
if ! is_crosscompile; then
# 1. build/pax-mark compiler binary first
emake ghc/stage2/build/tmp/ghc-stage2
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 2. build/pax-mark haddock using ghc-stage2
if is_native; then
# non-native build does not build haddock
# due to HADDOCK_DOCS=NO, but it could.
emake utils/haddock/dist/build/tmp/haddock
pax-mark -m utils/haddock/dist/build/tmp/haddock
fi
fi
# 3. and then all the rest
emake all
fi # ! use binary
}
src_test() {
# TODO: deal with:
# - sandbox (pollutes environment)
# - extra packages (to extend testsuite coverage)
# bits are taken from 'validate'
local make_test_target='test' # can be fulltest
# not 'emake' as testsuite uses '$MAKE' without jobserver available
make $make_test_target stage=2 THREADS=$(makeopts_jobs)
}
src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
mv "${S}/usr" "${ED}"
else
[[ -f VERSION ]] || emake VERSION
# -j1 due to a rare race in install script:
# make --no-print-directory -f ghc.mk phase=final install
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
# -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
# /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
# "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
# /usr/bin/install: cannot create regular file \
# '/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
emake -j1 install DESTDIR="${D}"
# Skip for cross-targets as they all share target location:
# /usr/share/doc/ghc-9999/
if ! is_crosscompile; then
dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
fi
# rename ghc-shipped files to avoid collision
# of external packages. Motivating example:
# user had installed:
# dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
# dev-haskell/transformers-0.4.2.0
# then user tried to update to
# dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
# this will lead to single .conf file collision.
local shipped_conf renamed_conf
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
for shipped_conf in "${package_confdir}"/*.conf; do
# rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
mv "${shipped_conf}" "${renamed_conf}" || die
done
# remove link, but leave 'haddock-${GHC_P}'
rm -f "${ED}"/usr/bin/$(cross)haddock
if ! is_crosscompile; then
newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
newbashcomp utils/completion/ghc.bash ghc
fi
fi
# path to the package.cache
local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
PKGCACHE="${package_confdir}"/package.cache
# copy the package.conf.d, including timestamp, save it so we can help
# users that have a broken package.conf.d
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
# copy the package.conf, including timestamp, save it so we later can put it
# back before uninstalling, or when upgrading.
cp -p "${PKGCACHE}"{,.shipped} \
|| die "failed to copy package.conf.d/package.cache"
if is_crosscompile; then
# When we build a cross-compiler the layout is the following:
# usr/lib/${CTARGET}-ghc-${VER}/ contains target libraries
# but
# usr/lib/${CTARGET}-ghc-${VER}/bin/ directory
# containst host binaries (modulo bugs).
# Portage's stripping mechanism does not skip stripping
# foreign binaries. This frequently causes binaries to be
# broken.
#
# Thus below we disable stripping of target libraries and allow
# stripping hosts executables.
dostrip -x "/usr/$(get_libdir)/$(cross)${GHC_P}"
dostrip "/usr/$(get_libdir)/$(cross)${GHC_P}/bin"
fi
}
pkg_preinst() {
# have we got an earlier version of ghc installed?
if has_version "<${CATEGORY}/${PF}"; then
haskell_updater_warn="1"
fi
}
pkg_postinst() {
ghc-reregister
# path to the package.cache
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
# give the cache a new timestamp, it must be as recent as
# the package.conf.d directory.
touch "${PKGCACHE}"
if [[ "${haskell_updater_warn}" == "1" ]]; then
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ewarn "You have just upgraded from an older version of GHC."
ewarn "You may have to run"
ewarn " 'haskell-updater'"
ewarn "to rebuild all ghc-based Haskell libraries."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
fi
}
pkg_prerm() {
PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
rm -rf "${PKGCACHE}"
cp -p "${PKGCACHE}"{.shipped,}
}
pkg_postrm() {
ghc-package_pkg_postrm
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save