diff options
Diffstat (limited to 'profiles/default/bsd/fbsd/profile.bashrc')
-rw-r--r-- | profiles/default/bsd/fbsd/profile.bashrc | 72 |
1 files changed, 70 insertions, 2 deletions
diff --git a/profiles/default/bsd/fbsd/profile.bashrc b/profiles/default/bsd/fbsd/profile.bashrc index 11ebca7b..8492e476 100644 --- a/profiles/default/bsd/fbsd/profile.bashrc +++ b/profiles/default/bsd/fbsd/profile.bashrc @@ -1,20 +1,88 @@ #!/bin/bash # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/profiles/default/bsd/fbsd/profile.bashrc,v 1.4 2009/03/11 14:43:09 drizzt Exp $ +# $Header: /var/cvsroot/gentoo-x86/profiles/default/bsd/fbsd/profile.bashrc,v 1.8 2010/04/23 11:02:00 aballier Exp $ alias make=gmake alias patch=gpatch alias sed=gsed alias awk=gawk +# Attempt to point the default SHELL used by configure scripts to bash. +# while most should work with BSD's bourne just fine, the extra scripts +# used by some applications (specially test scripts) use way too many bashisms. +export CONFIG_SHELL="/bin/bash" + # Hack to avoid every package that uses libiconv/gettext # install a charset.alias that will collide with libiconv's one # See bugs 169678, 195148 and 256129. # Also the discussion on # http://archives.gentoo.org/gentoo-dev/msg_8cb1805411f37b4eb168a3e680e531f3.xml -post_src_install() +bsd-post_src_install() { if [ "${PN}" != "libiconv" -a -e "${D}"/usr/lib*/charset.alias ] ; then rm -f "${D}"/usr/lib*/charset.alias fi } + +# These are because of +# http://archives.gentoo.org/gentoo-dev/msg_529a0806ed2cf841a467940a57e2d588.xml +# The profile-* ones are meant to be used in etc/portage/profile.bashrc by user +# until there is the registration mechanism. +profile-post_src_install() { bsd-post_src_install ; } + post_src_install() { bsd-post_src_install ; } + + +# Another hack to fix old versions of install-sh (automake) where a non-gnu +# mkdir is not considered thread-safe (make install errors with -j > 1) +bsd-patch_install-sh() { + # Do nothing if we don't have patch installed: + if [[ -z $(type -P gpatch) ]]; then + return 0 + fi + + # Do nothing if $S does not exist + [ -d "${S}" ] || return 0 + + local EPDIR="${ECLASSDIR}/ELT-patches/install-sh" + local EPATCHES="${EPDIR}/1.5.6 ${EPDIR}/1.5.4 ${EPDIR}/1.5" + local ret=0 + cd "${S}" + for file in $(find . -name "install-sh" -print); do + if [[ -n $(egrep "scriptversion=2005|scriptversion=2004" ${file}) ]]; then + einfo "Automatically patching parallel-make unfriendly install-sh." + # Stolen from libtool.eclass + for mypatch in ${EPATCHES}; do + if gpatch -p0 --dry-run "${file}" "${mypatch}" &> "${T}/patch_install-sh.log"; then + gpatch -p0 -g0 --no-backup-if-mismatch "${file}" "${mypatch}" \ + &> "${T}/patch_install-sh.log" + ret=$? + break + else + ret=1 + fi + done + if [[ ret -eq 0 ]]; then + einfo "Patch applied successfully on \"${file}\"." + else + ewarn "Unable to apply install-sh patch. " + ewarn "If you experience errors during install phase, try with MAKEOPTS=\"-j1\"" + fi + fi + done +} + +# It should be run after everything has been unpacked/patched, some developers +# do patch this little bastard from time to time. +# So do it after unpack() for EAPI=0|1 and after prepare() for everything else. +if [[ -n $EAPI ]] ; then + case "$EAPI" in + 0|1) + profile-post_src_unpack() { bsd-patch_install-sh ; } + post_src_unpack() { bsd-patch_install-sh ; } + ;; + *) + profile_post_src_prepare() { bsd-patch_install-sh ; } + post_src_prepare() { bsd-patch_install-sh ; } + ;; + esac +fi |