buildgcc: move from ..
to $( .. )
Change-Id: I7a095470d408d013a4a915e010c59ea99ca1f1c8 Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: http://review.coreboot.org/10484 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins) Reviewed-by: Alexander Couzens <lynxis@fe80.eu>
This commit is contained in:
@@ -20,13 +20,13 @@
|
|||||||
# Foundation, Inc.
|
# Foundation, Inc.
|
||||||
#
|
#
|
||||||
|
|
||||||
cd `dirname $0`
|
cd $(dirname $0)
|
||||||
|
|
||||||
CROSSGCC_DATE="June 4th, 2015"
|
CROSSGCC_DATE="June 4th, 2015"
|
||||||
CROSSGCC_VERSION="1.29"
|
CROSSGCC_VERSION="1.29"
|
||||||
|
|
||||||
# default settings
|
# default settings
|
||||||
TARGETDIR=`pwd`/xgcc
|
TARGETDIR=$(pwd)/xgcc
|
||||||
TARGETARCH=i386-elf
|
TARGETARCH=i386-elf
|
||||||
DESTDIR=
|
DESTDIR=
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ cyan='\033[0;36m'
|
|||||||
CYAN='\033[1;36m'
|
CYAN='\033[1;36m'
|
||||||
NC='\033[0m' # No Color
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
UNAME=`uname`
|
UNAME=$(uname)
|
||||||
|
|
||||||
normalize_dirs()
|
normalize_dirs()
|
||||||
{
|
{
|
||||||
@@ -121,8 +121,8 @@ searchtool()
|
|||||||
search="$2"
|
search="$2"
|
||||||
fi
|
fi
|
||||||
for i in "$1" "g$1" "gnu$1"; do
|
for i in "$1" "g$1" "gnu$1"; do
|
||||||
if test -x "`which $i 2>/dev/null`"; then
|
if test -x "$(which $i 2>/dev/null)"; then
|
||||||
if test `cat /dev/null | $i --version 2>&1 |grep -c "$search"` \
|
if test $(cat /dev/null | $i --version 2>&1 |grep -c "$search") \
|
||||||
-gt 0; then
|
-gt 0; then
|
||||||
echo $i
|
echo $i
|
||||||
return
|
return
|
||||||
@@ -133,28 +133,28 @@ searchtool()
|
|||||||
# patch and tar also work.
|
# patch and tar also work.
|
||||||
if [ $UNAME = "Darwin" -o $UNAME = "FreeBSD" -o $UNAME = "NetBSD" -o $UNAME = "OpenBSD" ]; then
|
if [ $UNAME = "Darwin" -o $UNAME = "FreeBSD" -o $UNAME = "NetBSD" -o $UNAME = "OpenBSD" ]; then
|
||||||
if [ "$1" = "patch" -o "$1" = "tar" ]; then
|
if [ "$1" = "patch" -o "$1" = "tar" ]; then
|
||||||
if test -x "`which $1 2>/dev/null`"; then
|
if test -x "$(which $1 2>/dev/null)"; then
|
||||||
echo $1
|
echo $1
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "`echo $1 | cut -b -3`" = "sha" ]; then
|
if [ "$(echo $1 | cut -b -3)" = "sha" ]; then
|
||||||
if [ $UNAME = "FreeBSD" ]; then
|
if [ $UNAME = "FreeBSD" ]; then
|
||||||
if test -x "`which sha1 2>/dev/null`"; then
|
if test -x "$(which sha1 2>/dev/null)"; then
|
||||||
echo sha1
|
echo sha1
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ $UNAME = "NetBSD" ]; then
|
if [ $UNAME = "NetBSD" ]; then
|
||||||
if test -x "`which cksum 2>/dev/null`"; then
|
if test -x "$(which cksum 2>/dev/null)"; then
|
||||||
echo cksum -a `echo $1 | sed -e 's,sum,,'`
|
echo cksum -a $(echo $1 | sed -e 's,sum,,')
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ $UNAME = "Darwin" ]; then
|
if [ $UNAME = "Darwin" ]; then
|
||||||
if test -x "`which openssl 2>/dev/null`"; then
|
if test -x "$(which openssl 2>/dev/null)"; then
|
||||||
echo openssl `echo $1 | sed -e 's,sum,,'`
|
echo openssl $(echo $1 | sed -e 's,sum,,')
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -164,12 +164,12 @@ searchtool()
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
TAR=`searchtool tar` || exit $?
|
TAR=$(searchtool tar) || exit $?
|
||||||
PATCH=`searchtool patch` || exit $?
|
PATCH=$(searchtool patch) || exit $?
|
||||||
MAKE=`searchtool make` || exit $?
|
MAKE=$(searchtool make) || exit $?
|
||||||
CMAKE=`searchtool cmake "cmake"` || exit $?
|
CMAKE=$(searchtool cmake "cmake") || exit $?
|
||||||
SHA1SUM=`searchtool sha1sum`
|
SHA1SUM=$(searchtool sha1sum)
|
||||||
SHA512SUM=`searchtool sha512sum`
|
SHA512SUM=$(searchtool sha512sum)
|
||||||
CHECKSUM=$SHA1SUM
|
CHECKSUM=$SHA1SUM
|
||||||
|
|
||||||
searchtool m4 > /dev/null
|
searchtool m4 > /dev/null
|
||||||
@@ -184,12 +184,12 @@ download() {
|
|||||||
package=$1
|
package=$1
|
||||||
archive="$(eval echo \$$package"_ARCHIVE")"
|
archive="$(eval echo \$$package"_ARCHIVE")"
|
||||||
|
|
||||||
FILE=`basename $archive`
|
FILE=$(basename $archive)
|
||||||
printf " * $FILE "
|
printf " * $FILE "
|
||||||
|
|
||||||
test -f tarballs/$FILE && \
|
test -f tarballs/$FILE && \
|
||||||
(test -z "$CHECKSUM" || \
|
(test -z "$CHECKSUM" || \
|
||||||
test "`cat sum/$FILE.cksum 2>/dev/null | sed -e 's,.*\([0-9a-f]\{40\}\).*,\1,'`" = "`$CHECKSUM tarballs/$FILE 2>/dev/null | sed -e 's,.*\([0-9a-f]\{40\}\).*,\1,'`" ) && \
|
test "$(cat sum/$FILE.cksum 2>/dev/null | sed -e 's,.*\([0-9a-f]\{40\}\).*,\1,')" = "$($CHECKSUM tarballs/$FILE 2>/dev/null | sed -e 's,.*\([0-9a-f]\{40\}\).*,\1,')" ) && \
|
||||||
printf "(cached)" || (
|
printf "(cached)" || (
|
||||||
printf "(downloading)"
|
printf "(downloading)"
|
||||||
rm -f tarballs/$FILE
|
rm -f tarballs/$FILE
|
||||||
@@ -211,18 +211,18 @@ unpack_and_patch() {
|
|||||||
archive="$(eval echo \$$package"_ARCHIVE")"
|
archive="$(eval echo \$$package"_ARCHIVE")"
|
||||||
dir="$(eval echo \$$package"_DIR")"
|
dir="$(eval echo \$$package"_DIR")"
|
||||||
test -d ${dir} && test -f ${dir}/.unpack_success || (
|
test -d ${dir} && test -f ${dir}/.unpack_success || (
|
||||||
printf " * `basename $archive`\n"
|
printf " * $(basename $archive)\n"
|
||||||
FLAGS=zxf
|
FLAGS=zxf
|
||||||
suffix=`echo $archive | sed 's,.*\.,,'`
|
suffix=$(echo $archive | sed 's,.*\.,,')
|
||||||
test "$suffix" = "gz" && FLAGS=zxf
|
test "$suffix" = "gz" && FLAGS=zxf
|
||||||
test "$suffix" = "bz2" && FLAGS=jxf
|
test "$suffix" = "bz2" && FLAGS=jxf
|
||||||
test "$suffix" = "xz" && FLAGS="--xz -xf"
|
test "$suffix" = "xz" && FLAGS="--xz -xf"
|
||||||
test "$suffix" = "lzma" && FLAGS="--lzma -xf"
|
test "$suffix" = "lzma" && FLAGS="--lzma -xf"
|
||||||
$TAR $FLAGS tarballs/`basename $archive`
|
$TAR $FLAGS tarballs/$(basename $archive)
|
||||||
for patch in patches/${dir}_*.patch; do
|
for patch in patches/${dir}_*.patch; do
|
||||||
test -r $patch || continue
|
test -r $patch || continue
|
||||||
printf " o `basename $patch`\n"
|
printf " o $(basename $patch)\n"
|
||||||
$PATCH -s -N -p0 < `echo $patch` || \
|
$PATCH -s -N -p0 < $(echo $patch) || \
|
||||||
printf "\n${RED}Failed $patch.${NC}\n"
|
printf "\n${RED}Failed $patch.${NC}\n"
|
||||||
done
|
done
|
||||||
touch ${dir}/.unpack_success
|
touch ${dir}/.unpack_success
|
||||||
@@ -380,7 +380,7 @@ build_GCC() {
|
|||||||
cd ../gcc-${GCC_VERSION}
|
cd ../gcc-${GCC_VERSION}
|
||||||
sed '/dnl Ensure exactly this Autoconf version is used/d' \
|
sed '/dnl Ensure exactly this Autoconf version is used/d' \
|
||||||
config/override.m4 > config/override.m4.new
|
config/override.m4 > config/override.m4.new
|
||||||
autoconf_version=`autoconf -V | grep "autoconf" | tr ' ' '\n' | tail -1`
|
autoconf_version=$(autoconf -V | grep "autoconf" | tr ' ' '\n' | tail -1)
|
||||||
sed "s/${GCC_AUTOCONF_VERSION}/${autoconf_version}/g" \
|
sed "s/${GCC_AUTOCONF_VERSION}/${autoconf_version}/g" \
|
||||||
config/override.m4.new > config/override.m4
|
config/override.m4.new > config/override.m4
|
||||||
autoconf
|
autoconf
|
||||||
@@ -406,7 +406,7 @@ build_GCC() {
|
|||||||
$MAKE $JOBS CFLAGS_FOR_BUILD="$HOSTCFLAGS" all-gcc || touch .failed
|
$MAKE $JOBS CFLAGS_FOR_BUILD="$HOSTCFLAGS" all-gcc || touch .failed
|
||||||
$MAKE install-gcc DESTDIR=$DESTDIR || touch .failed
|
$MAKE install-gcc DESTDIR=$DESTDIR || touch .failed
|
||||||
|
|
||||||
if [ "`echo $TARGETARCH | grep -c -- -mingw32`" -eq 0 ]; then
|
if [ "$(echo $TARGETARCH | grep -c -- -mingw32)" -eq 0 ]; then
|
||||||
$MAKE $JOBS CFLAGS_FOR_BUILD="$HOSTCFLAGS" all-target-libgcc || touch .failed
|
$MAKE $JOBS CFLAGS_FOR_BUILD="$HOSTCFLAGS" all-target-libgcc || touch .failed
|
||||||
$MAKE install-target-libgcc DESTDIR=$DESTDIR || touch .failed
|
$MAKE install-target-libgcc DESTDIR=$DESTDIR || touch .failed
|
||||||
fi
|
fi
|
||||||
@@ -480,14 +480,14 @@ export PATH=$PATH:.
|
|||||||
getopt - > /dev/null 2>/dev/null || gcc -o getopt getopt.c
|
getopt - > /dev/null 2>/dev/null || gcc -o getopt getopt.c
|
||||||
|
|
||||||
# parse parameters.. try to find out whether we're running GNU getopt
|
# parse parameters.. try to find out whether we're running GNU getopt
|
||||||
getoptbrand="`getopt -V | sed -e '1!d' -e 's,^\(......\).*,\1,'`"
|
getoptbrand="$(getopt -V | sed -e '1!d' -e 's,^\(......\).*,\1,')"
|
||||||
if [ "${getoptbrand}" = "getopt" ]; then
|
if [ "${getoptbrand}" = "getopt" ]; then
|
||||||
# Detected GNU getopt that supports long options.
|
# Detected GNU getopt that supports long options.
|
||||||
args=`getopt -l version,help,clean,directory:,platform:,jobs:,destdir:,savetemps,skip-gdb,ccache,clang Vhcd:p:j:D:tGyC -- "$@"`
|
args=$(getopt -l version,help,clean,directory:,platform:,jobs:,destdir:,savetemps,skip-gdb,ccache,clang Vhcd:p:j:D:tGyC -- "$@")
|
||||||
eval set "$args"
|
eval set "$args"
|
||||||
else
|
else
|
||||||
# Detected non-GNU getopt
|
# Detected non-GNU getopt
|
||||||
args=`getopt Vhcd:p:j:D:tGyC $*`
|
args=$(getopt Vhcd:p:j:D:tGyC $*)
|
||||||
set -- $args
|
set -- $args
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -586,7 +586,7 @@ if [ $UNAME = "Darwin" ]; then
|
|||||||
# binaries in 10.6 (even if the kernel is 32bit)
|
# binaries in 10.6 (even if the kernel is 32bit)
|
||||||
# For some weird reason, 10.5 autodetects an ABI=64 though
|
# For some weird reason, 10.5 autodetects an ABI=64 though
|
||||||
# so we're setting the ABI explicitly here.
|
# so we're setting the ABI explicitly here.
|
||||||
if [ `sysctl -n hw.optional.x86_64 2>/dev/null` -eq 1 ] 2>/dev/null; then
|
if [ $(sysctl -n hw.optional.x86_64 2>/dev/null) -eq 1 ] 2>/dev/null; then
|
||||||
OPTIONS="ABI=64"
|
OPTIONS="ABI=64"
|
||||||
else
|
else
|
||||||
OPTIONS="ABI=32"
|
OPTIONS="ABI=32"
|
||||||
@@ -616,8 +616,8 @@ build GMP
|
|||||||
|
|
||||||
# Now set CFLAGS to match GMP CFLAGS but strip out -pedantic
|
# Now set CFLAGS to match GMP CFLAGS but strip out -pedantic
|
||||||
# as GCC 4.6.x fails if it's there.
|
# as GCC 4.6.x fails if it's there.
|
||||||
HOSTCFLAGS=`grep __GMP_CFLAGS $DESTDIR$TARGETDIR/include/gmp.h |cut -d\" -f2 |\
|
HOSTCFLAGS=$(grep __GMP_CFLAGS $DESTDIR$TARGETDIR/include/gmp.h |cut -d\" -f2 |\
|
||||||
sed s,-pedantic,,`
|
sed s,-pedantic,,)
|
||||||
|
|
||||||
build MPFR
|
build MPFR
|
||||||
build MPC
|
build MPC
|
||||||
@@ -632,9 +632,9 @@ build LLVM
|
|||||||
|
|
||||||
# Adding git information of current tree to target directory
|
# Adding git information of current tree to target directory
|
||||||
# for reproducibility
|
# for reproducibility
|
||||||
PROGNAME=`basename "$0"`
|
PROGNAME=$(basename "$0")
|
||||||
rm -f "$DESTDIR$TARGETDIR/$PROGNAME".commit.*
|
rm -f "$DESTDIR$TARGETDIR/$PROGNAME".commit.*
|
||||||
cp "$PROGNAME" $DESTDIR$TARGETDIR/"$PROGNAME.commit.`git describe`"
|
cp "$PROGNAME" $DESTDIR$TARGETDIR/"$PROGNAME.commit.$(git describe)"
|
||||||
|
|
||||||
if [ $SAVETEMPS -eq 0 ]; then
|
if [ $SAVETEMPS -eq 0 ]; then
|
||||||
cleanup
|
cleanup
|
||||||
|
Reference in New Issue
Block a user