#!/bin/sh MY_PORT_DIR=${PORTDIR:-/usr/portage} patch -t -d "${MY_PORT_DIR}"/eclass << 'TOOLCHAIN_GCC_PATCH' --- toolchain.eclass.orig 2014-05-20 08:37:51.028289320 +0200 +++ toolchain.eclass 2014-05-20 08:37:38.907481332 +0200 @@ -25,7 +25,7 @@ FEATURES=${FEATURES/multilib-strict/} -EXPORTED_FUNCTIONS="pkg_setup src_unpack src_compile src_test src_install pkg_postinst pkg_postrm" +EXPORTED_FUNCTIONS="pkg_setup src_unpack src_compile src_test src_install pkg_postinst pkg_postrm pkg_preinst pkg_prerm" case ${EAPI:-0} in 0|1) ;; 2|3) EXPORTED_FUNCTIONS+=" src_prepare src_configure" ;; @@ -1905,10 +1905,29 @@ #---->> pkg_post* <<---- +toolchain_pkg_preinst() { + if ! is_crosscompile ; then + # Temporarily add the the new path directly to the linker search paths + # to be sure the new libgcc_s.so will be found after the old one got removed. + # This has to be done because pkg_postinst (and thus gcc_config) is called + # only after the old (current) libgcc_s.so was removed, which would leave + # the system without any libgcc_s.so which is necessary for gcc_config. + # See bug #437050 + echo "${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}" > "/etc/ld.so.conf.d/00_toolchain_eclass_tmp_${PF}.conf" + fi +} + toolchain_pkg_postinst() { do_gcc_config if ! is_crosscompile ; then + # gcc_config was called so the new libgcc_s.so can be found without the temporary. + # See bug #437050 + rm "/etc/ld.so.conf.d/00_toolchain_eclass_tmp_${PF}.conf" # remove temporary file + ldconfig # update the dynamic linker search paths + fi + + if ! is_crosscompile ; then echo ewarn "If you have issues with packages unable to locate libstdc++.la," ewarn "then try running 'fix_libtool_files.sh' on the old gcc versions." @@ -1937,6 +1956,12 @@ fi } +toolchain_pkg_prerm() { + if ! is_crosscompile ; then + ldconfig # update the dynamic linker search paths + fi +} + toolchain_pkg_postrm() { # to make our lives easier (and saner), we do the fix_libtool stuff here. # rather than checking SLOT's and trying in upgrade paths, we just see if TOOLCHAIN_GCC_PATCH [ $? == 0 ] || cp "${MY_PORT_DIR}"/eclass/toolchain.eclass.orig "${MY_PORT_DIR}"/eclass/toolchain.eclass #rm -f "${MY_PORT_DIR}"/eclass/toolchain.eclass.orig "${MY_PORT_DIR}"/eclass/toolchain.eclass.rej