Bug #308835 - Make econf() use sed to substitute $CONFIG_SHELL in
authorZac Medico <zmedico@gentoo.org>
Thu, 5 Aug 2010 06:18:52 +0000 (23:18 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 5 Aug 2010 06:18:52 +0000 (23:18 -0700)
the shebang of configure scripts when appropriate.

bin/ebuild.sh

index 9c599c01b4c6759c5a687c1370b47a8d03ccc190..a68b9731fa52144879dda10fcdb284ed58688978 100755 (executable)
@@ -479,6 +479,11 @@ econf() {
 
        : ${ECONF_SOURCE:=.}
        if [ -x "${ECONF_SOURCE}/configure" ]; then
+               if [[ -n $CONFIG_SHELL && \
+                       "$(head -n1 "$ECONF_SOURCE/configure")" =~ ^'#!'[[:space:]]*/bin/sh[[:space:]]*$ ]] ; then
+                       sed -e "1s:.*:#!$CONFIG_SHELL" -i "$ECONF_SOURCE/configure" || \
+                               die "Substition of shebang in '$ECONF_SOURCE/configure' failed"
+               fi
                if [ -e /usr/share/gnuconfig/ ]; then
                        find "${WORKDIR}" -type f '(' \
                        -name config.guess -o -name config.sub ')' -print0 | \