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.
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
|
||||||
|
@ -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.
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
|
|
||||||
|
|
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
|
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
|
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.
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.
@ -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
|
||||||
|
}
|
Binary file not shown.
@ -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…
Reference in new issue