diff options
author | 2010-07-14 09:02:35 +0000 | |
---|---|---|
committer | 2010-07-14 09:02:35 +0000 | |
commit | 480388e23d5f403ed18413d69424934559f5b91a (patch) | |
tree | 0b450aebd2447e8631007bc0c40dc45a5d2828ac /dev-lang/ghc/files | |
parent | Stable on amd64 wrt bug #328071 (diff) | |
download | historical-480388e23d5f403ed18413d69424934559f5b91a.tar.gz historical-480388e23d5f403ed18413d69424934559f5b91a.tar.bz2 historical-480388e23d5f403ed18413d69424934559f5b91a.zip |
Added ability to bootstrap ghc on systems with gmp-5
To understand why it is supposed to work, please, read comments in dev-lang/ghc/files/ghc-apply-gmp-hack
Package-Manager: portage-2.1.8.3/cvs/Linux x86_64
Diffstat (limited to 'dev-lang/ghc/files')
-rw-r--r-- | dev-lang/ghc/files/ghc-apply-gmp-hack | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/dev-lang/ghc/files/ghc-apply-gmp-hack b/dev-lang/ghc/files/ghc-apply-gmp-hack new file mode 100644 index 000000000000..a0b4ab8ffd9c --- /dev/null +++ b/dev-lang/ghc/files/ghc-apply-gmp-hack @@ -0,0 +1,61 @@ +# this script is expected to be sourced by ghc ebuilds built against libgmp.so.3 library +# +# > source "${FILESDIR}/ghc-apply-gmp-hack" +# +# What it does and why it works: +# > GMP 5.0 is upwardly source and binary compatible with 4.x, and 3.x versions, +# > except for applications that use the semi-documented mpn_bdivmod function. +# +# > The solib numbers now reflect the removal of the documented but preliminary +# > mpn_bdivmod function; we correctly flag incompatibility with GMP 4.3. +# > GMP 5.0.0 has this wrong, and should perhaps be uninstalled to avoid confusion. +# +# taken from http://gmplib.org/gmp5.0.html +# +# Luckily, ghc does not use the 'mpn_bdivmod' function, so we can easily use +# libgmp.so.10 for binaries which require libgmp.so.3 +# +# So, this script checks whether this system has libgmp.so.10 and if has +# shows it to bootstrapper-compiler via populating LD_LIBRARY_PATH +# (it actually exports function doing this) +# +# After bootstrapping resulting compiler will not depend on old libgmp +# Newer ghc binaries must be built against newer gmp +# +# Blames should be directed to Sergei Trofimovich <slyfox@gentoo.org> + +# should be used: +# > inherit multilib +# > ... +# > # somewhere in src_unpack() { # as early as possible, right after unpacking source/binary +# > source "${FILESDIR}/ghc-apply-gmp-hack" "$(get_libdir)" + +local libdir_name=$1 +# let's see if we are in affected system +if has_version '>=dev-libs/gmp-5.0.1'; then + local libgmpso3=$ROOT/usr/$libdir_name/libgmp.so.3 + local libgmpso10=$ROOT/usr/$libdir_name/libgmp.so.10 + + # bother user only if things won't work for him + if [[ ! -e "$libgmpso3" ]]; then + if use binary; then + eerror "You have requested precompiled binary installation, which is" + eerror "built against 'libgmp.so.3'. You can create compatibility symlink" + eerror "if you have '$libgmpso10' and wish to use installed binary:" + eerror " # ln -s libgmp.so.10 '$libgmpso3'" + die "libgmp.so.3 not found" + else + if [[ -e "$libgmpso10" ]]; then + local fake_solib_dir=${S}/fake_solibs + mkdir "$fake_solib_dir" || die "failed to make fake lib dir" + elog "Enabling libgmp hack:" + elog "| Making symlink: '$fake_solib_dir/libgmp.so.3' -> '$libgmpso10'" + ln -s "$libgmpso10" "$fake_solib_dir/libgmp.so.3" || die "failed to make fake symlink" + export LD_LIBRARY_PATH=$fake_solib_dir${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH + elog "| setting new LD_LIBRARY_PATH='$LD_LIBRARY_PATH'" + else + eerror "'$libgmpso3' and '$libgmpso10' are not found. Please, report the breakage." + fi + fi + fi +fi |