#! /bin/bash PROJECT=binutils-gdb # Available sub-projects. AVAILABLE_PROJECTS=( binutils_gdb ) # Enabled sub-projects. PROJECTS=( binutils_gdb ) # Additional options (see functions sources below). # Options followed by a ':' require an argument, by '::' allow an optional argument. SHORT_OPTIONS= # Long options are not available with BSD getopt. LONG_OPTIONS= # Help for additional options usage() { # option h "help" "display this help and exit" return } # Find the directory containing this script. source="${BASH_SOURCE[0]}" while [ -h "${source}" ] ; do SCRIPTS="$(cd -P "$(dirname "${source}")" && pwd)" source="$(readlink "${source}")" [[ ${source} != /* ]] && source="$DIR/${source}" done SCRIPTS="$(cd -P "$(dirname "${source}")" && pwd)" # Get support functions and definitions. source ${SCRIPTS}/support # Add mingw targets EXTRATARGETS="x86_64-w64-mingw32 i686-w64-mingw32" # Projects. binutils_gdb="${SRCTOP} git://sourceware.org/git/binutils-gdb.git binutils-gdb git" if [ "${CROSS}" != "yes" ] ; then HOST=--host=${TARGETARCH}-${TARGETOS} fi CFLAGS="${CFLAGS} -Wno-tautological-compare" CXXFLAGS="${CXXFLAGS} -Wno-tautological-compare" if [ ${TOOLS} = "ecc" -a "${SHARED}" != "yes" ] ; then CFLAGS="${CFLAGS} -static" CXXFLAGS="${CXXFLAGS} -static" LDFLAGS="-all-static -Wno-unused-command-line-argument" HOST_CC="${HOST_CC} -static" fi check_library libc++.a "Disabling gdb build." if [ "${CROSS}" != "yes" -a "$?" != "0" ] ; then # C++ isn't ready yet, don't build gdb. DISABLE_GDB="--disable-gdb --disable-libdecnumber --disable-readline --disable-sim" fi configure() { # Configuring package binutils-gdb for all targets, adding a couple. moretargets=$(echo $TARGETS | sed -e "s/-elf /-linux,/g") moretargets=$moretargets,arm-elf-linux-eabi,armeb-elf-linux-eabi moretargets=$moretargets,$(echo $EXTRATARGETS | sed -e "s/ /,/g") run check_checkout run mkdir -p ${BUILDDIR} run cd ${BUILDDIR} run ${PROJECTDIR}/configure \ CC="${CC}" CFLAGS="${CFLAGS}" CXX=$"${CXX}" CXXFLAGS="${CXXFLAGS}" \ CPP="${CPP}" CC_FOR_BUILD="${HOST_CC}" \ AR=${AR} --enable-64-bit-bfd \ --bindir=${LOCALBIN} ${HOST} --enable-targets=${moretargets} \ --program-prefix=ecc- --prefix=${LOCAL} --enable-plugins=no \ --datadir=${LOCAL}/share --target=${HOSTTUPLE} --enable-nls=no \ --with-system-zlib=no \ ${DISABLE_GDB} for t in $TARGETS ${EXTRATARGETS} ; do run mkdir -p ${BUILDDIR}/${t} run cd ${BUILDDIR}/${t} run ${PROJECTDIR}/gas/configure \ CC="${CC}" CFLAGS="${CFLAGS}" CXX=$"${CXX}" CXXFLAGS="${CXXFLAGS}" \ CPP="${CPP}" AR=${AR} CC_FOR_BUILD="${HOST_CC}" \ --bindir=${LOCALBIN} ${HOST} --target=${t} --enable-nls=no \ --program-prefix=${t}- --prefix=${LOCAL} --enable-plugins=no \ --datadir=${LOCAL}/share done } build() { run check_checkout run check_configure run ${MAKE} LDFLAGS="${LDFLAGS}" -j ${MAXJOBS} -C ${BUILDDIR} for t in $TARGETS ${EXTRATARGETS} ; do run ${MAKE} LDFLAGS="${LDFLAGS}" -C ${BUILDDIR}/${t} done } install() { run check_checkout run check_configure run ${MAKE} DFLAGS="${LDFLAGS}" -j ${MAXJOBS} -C ${BUILDDIR} install for t in $TARGETS ${EXTRATARGETS} ; do run ${MAKE} LDFLAGS="${LDFLAGS}" -C ${BUILDDIR}/${t} install done } tests() { # Run regression tests. run cd ${BUILDDIR} run ${MAKE} -j ${MAXJOBS} -C ${BUILDDIR} check run ${MAKE} -j ${MAXJOBS} -C ${BUILDDIR} clang-test } if [ "${CHECKOUT}" == "y" ] ; then checkout || exit 1 fi if [ "${CONFIGURE}" == "y" ] ; then configure || exit 1 fi if [ "${UPDATE}" == "y" ] ; then update || exit 1 fi if [ "${PATCH}" == "y" ] ; then patch || exit 1 fi if [ "${CREATE_PATCH}" == "y" ] ; then create_patch || exit 1 fi if [ "${BUILD}" == "y" ] ; then build || exit 1 fi if [ "${TESTS}" == "y" ] ; then tests || exit 1 fi if [ "${INSTALL}" == "y" ] ; then install || exit 1 fi