# 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 # 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