URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [contrib/] [gcc_update] - Rev 778
Go to most recent revision | Compare with Previous | Blame | View Log
#! /bin/sh## Update a local Subversion, Git or Mercurial tree from the GCC# repository, with an emphasis on treating generated files correctly, so# that autoconf, gperf et al are not required for the ``end'' user.## (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010,# 2011 Free Software Foundation# Originally by Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>, August 1998.## This script is Free Software, and it can be copied, distributed and# modified as defined in the GNU General Public License. A copy of# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html### By default all command-line options are passed to `svn update` or `hg/git# pull` in addition to $UPDATE_OPTIONS (defined below). If the first parameter# reads --nostdflags, $UPDATE_OPTIONS as well as this parameter itself# are omitted.## If the first parameter reads --patch, the second parameter is considered# a patch file.## If the first parameter is --touch, no svn operation will be performed,# only generated files that appear to be out of date in the local tree# will be touched.## If the first parameter is --list, a list of the generated files and# their dependencies will be printed; --help prints this message.## If the first parameter is --silent, this script prints nothing other# than error messages; the second parameter is then interpreted as above.## Examples:## contrib/gcc_update -r 8712# contrib/gcc_update --patch some-patch# contrib/gcc_update --touch# contrib/gcc_update --list# Default options used when updating (none).UPDATE_OPTIONS=""# Set the locale to C to make this script work for users with foreign# locale like e.g. French UTF-8.LANG=CLC_ALL=Cexport LANG LC_ALL######## Anything below shouldn't be changed by regular users.# Arrange for the value of $0 to be available for functionsself=$0# This function prints its arguments to standard output unless# "silent" is set.unset silentchat () {if [ -z "$silent" ]; thenecho "$@"fi}# This function prints a list of all generated files, along with their# dependencies. Note that only one target is supported per line: the# colon is stripped from the output.files_and_dependencies () {sed -e 's/ *#.*//' -e '/^$/d' -e 's/://' <<\EOF# fixincludesfixincludes/configure: fixincludes/configure.ac fixincludes/aclocal.m4fixincludes/config.h.in: fixincludes/configure.ac fixincludes/aclocal.m4# intl libraryintl/plural.c: intl/plural.yintl/configure: intl/configure.ac intl/aclocal.m4intl/config.h.in: intl/configure.ac intl/aclocal.m4# Now, proceed to gcc automatically generated filesgcc/configure: gcc/configure.acgcc/cstamp-h.in: gcc/configure.acgcc/config.in: gcc/cstamp-h.ingcc/fixinc/fixincl.x: gcc/fixinc/fixincl.tpl gcc/fixinc/inclhack.defgcc/config/arm/arm-tune.md: gcc/config/arm/arm-cores.def gcc/config/arm/gentune.shgcc/config/arm/arm-tables.opt: gcc/config/arm/arm-arches.def gcc/config/arm/arm-cores.def gcc/config/arm/arm-fpus.def gcc/config/arm/genopt.shgcc/config/avr/avr-tables.opt: gcc/config/avr/avr-mcus.def gcc/config/avr/genopt.shgcc/config/avr/t-multilib: gcc/config/avr/avr-mcus.def gcc/config/avr/genmultilib.awkgcc/config/avr/multilib.h: gcc/config/avr/avr-mcus.def gcc/config/avr/genmultilib.awkgcc/config/c6x/c6x-tables.opt: gcc/config/c6x/c6x-isas.def gcc/config/c6x/genopt.shgcc/config/c6x/c6x-sched.md: gcc/config/c6x/c6x-sched.md.in gcc/config/c6x/gensched.shgcc/config/c6x/c6x-mult.md: gcc/config/c6x/c6x-mult.md.in gcc/config/c6x/genmult.shgcc/config/m68k/m68k-tables.opt: gcc/config/m68k/m68k-devices.def gcc/config/m68k/m68k-isas.def gcc/config/m68k/m68k-microarchs.def gcc/config/m68k/genopt.shgcc/config/mips/mips-tables.opt: gcc/config/mips/mips-cpus.def gcc/config/mips/genopt.shgcc/config/rs6000/rs6000-tables.opt: gcc/config/rs6000/rs6000-cpus.def gcc/config/rs6000/genopt.shgcc/config/tilegx/mul-tables.c: gcc/config/tilepro/gen-mul-tables.ccgcc/config/tilepro/mul-tables.c: gcc/config/tilepro/gen-mul-tables.cc# And then, language-specific filesgcc/cp/cfns.h: gcc/cp/cfns.gperfgcc/java/keyword.h: gcc/java/keyword.gperf# testsuite# Without this, _Pragma3.c can have a false negative.gcc/testsuite/gcc.dg/cpp/_Pragma3.c: gcc/testsuite/gcc.dg/cpp/mi1c.h# Similarly, without this, you will see:# direct2s.c:35: warning: current file is older than direct2.cgcc/testsuite/gcc.dg/cpp/direct2s.c: gcc/testsuite/gcc.dg/cpp/direct2.c# lto-pluginlto-plugin/configure: lto-plugin/configure.ac lto-plugin/aclocal.m4lto-plugin/Makefile.in: lto-plugin/Makefile.am lto-plugin/aclocal.m4# And libraries, at lastlibbanshee/configure: libbanshee/configure.aclibmudflap/configure: libmudflap/configure.aclibobjc/configure: libobjc/configure.aczlib/aclocal.m4: zlib/configure.ac zlib/acinclude.m4zlib/Makefile.in: zlib/Makefile.am zlib/configure.ac zlib/aclocal.m4zlib/configure: zlib/configure.ac zlib/aclocal.m4fastjar/aclocal.m4: fastjar/configure.acfastjar/Makefile.in: fastjar/Makefile.am fastjar/configure.ac fastjar/aclocal.m4fastjar/configure: fastjar/configure.ac fastjar/aclocal.m4boehm-gc/aclocal.m4: boehm-gc/configure.acboehm-gc/Makefile.in: boehm-gc/Makefile.am boehm-gc/configure.ac boehm-gc/aclocal.m4boehm-gc/configure: boehm-gc/configure.ac boehm-gc/aclocal.m4libada/configure: libada/configure.aclibffi/aclocal.m4: libffi/configure.ac libffi/acinclude.m4libffi/Makefile.in: libffi/Makefile.am libffi/configure.ac libffi/aclocal.m4libffi/configure: libffi/configure.ac libffi/aclocal.m4libffi/fficonfig.h.in: libffi/configure.ac libffi/aclocal.m4libgfortran/aclocal.m4: libgfortran/configure.ac libgfortran/acinclude.m4libgfortran/Makefile.in: libgfortran/Makefile.am libgfortran/configure.ac libgfortran/aclocal.m4libgfortran/configure: libgfortran/configure.ac libgfortran/aclocal.m4libjava/aclocal.m4: libjava/configure.aclibjava/Makefile.in: libjava/Makefile.am libjava/configure.ac libjava/aclocal.m4libjava/configure: libjava/configure.ac libjava/aclocal.m4libjava/libltdl/aclocal.m4: libjava/libltdl/configure.ac libjava/libltdl/acinclude.m4libjava/libltdl/Makefile.in: libjava/libltdl/Makefile.am libjava/libltdl/configure.ac libjava/libltdl/aclocal.m4libjava/libltdl/configure: libjava/libltdl/configure.ac libjava/libltdl/aclocal.m4libjava/libltdl/config-h.in: libjava/libltdl/configure.ac libjava/libltdl/aclocal.m4libcpp/aclocal.m4: libcpp/configure.aclibcpp/Makefile.in: libcpp/configure.ac libcpp/aclocal.m4libcpp/configure: libcpp/configure.ac libcpp/aclocal.m4libgomp/aclocal.m4: libgomp/configure.ac libgomp/acinclude.m4libgomp/Makefile.in: libgomp/Makefile.am libgomp/aclocal.m4libgomp/testsuite/Makefile.in: libgomp/Makefile.am libgomp/aclocal.m4libgomp/configure: libgomp/configure.ac libgomp/aclocal.m4libgomp/config.h.in: libgomp/configure.ac libgomp/aclocal.m4libitm/aclocal.m4: libitm/configure.ac libitm/acinclude.m4libitm/Makefile.in: libitm/Makefile.am libitm/aclocal.m4libitm/testsuite/Makefile.in: libitm/testsuite/Makefile.am libitm/aclocal.m4libitm/configure: libitm/configure.ac libitm/aclocal.m4libitm/config.h.in: libitm/configure.ac libitm/aclocal.m4# Top levelMakefile.in: Makefile.tpl Makefile.defconfigure: configure.ac config/acx.m4EOF}# This function touches generated files such that the ``end'' user does# not have to rebuild them.touch_files () {rm -f Makefile.$$echo 'all: \' > Makefile.$$files_and_dependencies | sed 's, .*, \\,' >> Makefile.$$echo '; @true' >> Makefile.$$files_and_dependencies | sed 's, ,: ,' >> Makefile.$$files_and_dependencies | sed 's, .*, \\,' >> Makefile.$$echo ':' >> Makefile.$$echo ' @for f in $? $@; do test -f $$f || exit 0; done; \' >> Makefile.$$echo ' echo Touching $@...; \' >> Makefile.$$chat ' echo Touching $@... 1>&2; \' >> Makefile.$$echo ' touch $@' >> Makefile.$$files_and_dependencies | sed 's,[^ ]* ,,;s,$, :,' >> Makefile.$$# We would have to explicitly shut off the "Entering... Leaving..."# messages through "--no-print-directory" to handle the case when# we were called from a recursive invocation (i.e. "$(MAKE)" in a# Makefile, not just make). Passing only "-s" doesn't help then,# because make has helpfully added "-w" to MAKEFLAGS automatically.# Unfortunately we do not require GNU make other than for building# and testing, so let's just grep known text explicitly echoed by# the rule.while ${MAKE-make} -s -f Makefile.$$ all | grep Touching > /dev/null; dosleep 1done 2>&1rm -f Makefile.$$}# Whenever we update the tree or install a patch, we may be modifying# this script. By re-execing it, we ensure that the appropriate# dependencies and rules will be used.touch_files_reexec () {chat "Adjusting file timestamps"exec ${CONFIG_SHELL-/bin/sh} $self ${silent+"--silent"} --touch}# This functions applies a patch to an existing tree.apply_patch () {if [ -f "$1" ]; thenecho "Applying patch file $1"case $1 in*gz)gzip -d -c "$1" | patch -p1 ;;*bz2)bzip2 -d -c "$1" | patch -p1 ;;*)patch -p1 < "$1";;esacfitouch_files_reexec}# Check whether this indeed looks like a local tree.if [ ! -f gcc/version.c ]; thenecho "This does not seem to be a GCC tree!"exitficase "$1" in--silent)silent=tshift;;esaccase "$1" in# First of all, check whether we are going to process a patch.--patch)if test "$#" != 2; thenecho "$1" expects only one argument >&2exit 1fiapply_patch "${2}"exit $?;;--touch)if test "$#" != 1; thenecho "$1" does not expect any argument >&2exit 1fitouch_filesexit $?;;--list)if test "$#" != 1; thenecho "$1" does not expect any argument >&2exit 1fifiles_and_dependencies | sed 's/ /: /'exit $?;;--help)sed -e '1,2d' -e '/^UPDATE_OPTIONS=/{i\\p}' \-e '/^$/,$d' -e 's/#//' -e 's/^ //' < $0exit $?;;esac# Check for known version control systems.if [ -d .git ]; thenGCC_GIT=${GCC_GIT-${GIT-git}}vcs_type="git"elif [ -d .hg ]; thenGCC_HG=${GCC_HG-${HG-hg}}vcs_type="hg"elif [ -d .svn ]; thenGCC_SVN=${GCC_SVN-${SVN-svn}}vcs_type="svn"elseecho "This does not seem to be a GCC GIT/HG/SVN tree!"exitfi# Check command-line optionsif [ x"${1}"x = x"--nostdflags"x ]; thenshiftelseset -- $UPDATE_OPTIONS ${1+"$@"}ficase $vcs_type ingit)chat "Updating GIT tree"$GCC_GIT diff --quiet --exit-code HEADif [ $? -ne 0 ]; thenecho "Attempting to update a dirty git tree!" >&2echo "Commit or stash your changes first and retry." >&2exit 1fi$GCC_GIT pull ${silent+-q} --rebase ${1+"$@"}if [ $? -ne 0 ]; then(touch_files_reexec)echo "git pull of full tree failed." >&2exit 1firevision=`$GCC_GIT log -n1 --pretty=%p:%t:%H`branch=`$GCC_GIT name-rev --name-only HEAD || :`;;hg)chat "Updating HG tree"# Add -q so untracked files aren't listed.if [ `$GCC_HG status -q | wc -l` -gt 0 ]; thenecho "Attempting to update a dirty hg tree!" >&2echo "Commit or revert your changes first and retry." >&2exit 1fi# Check for mq extension. mq patches must be popped so tip has# been converted from the SVN tree.if [ -d .hg/patches ] && [ `$GCC_HG qapplied | wc -l` -gt 0 ]; then# FIXME: Perhaps pop queue instead? We could do that since we# know the tree is clean.echo "Attempting to update hg tree with mq patches applied!" >&2echo "Pop your patches first and retry." >&2exit 1fi# Update tree, but make sure to only pull the default branch.# Otherwise all branches in the upstream repo are added, even if# only a single one has been cloned.$GCC_HG pull ${silent+-q} -r`$GCC_HG branch` ${1+"$@"}if [ $? -ne 0 ]; then(touch_files_reexec)echo "hg pull of full tree failed." >&2exit 1fi# Update tree. Needs to be done separately from pull so# gcc_update -rREV works.$GCC_HG update ${silent+-q} ${1+"$@"}if [ $? -ne 0 ]; then(touch_files_reexec)echo "hg update of full tree failed." >&2exit 1fi# Extract SVN revision corresponding to parents, as stored by# hg convert. Before hg 1.4.3, there's no template keyword# corresponding to the extra: tag, so need to use hg log --debug# to extract the info.parents=`$GCC_HG parents --template '{rev}'`convert_revision=`$GCC_HG log --debug -r$parents | \sed -ne "/^extra:.*convert_revision=svn:/ {s%^[^/]*/%%p}"`revision=`echo $convert_revision | sed -e 's/.*@//'`branch=`echo $convert_revision | sed -e 's%branches/%%' -e 's/@.*//'`;;svn)chat "Updating SVN tree"$GCC_SVN ${silent+-q} --non-interactive update ${1+"$@"}if [ $? -ne 0 ]; then(touch_files_reexec)echo "SVN update of full tree failed." >&2exit 1firevision=`svn info | awk '/Revision:/ { print $2 }'`branch=`svn info | sed -ne "/URL:/ {s,.*/trunk,trunk,s,.*/branches/,,s,.*/tags/,,p}"`;;esacrm -f LAST_UPDATED gcc/REVISION{dateecho "`TZ=UTC date` (revision $revision)"} > LAST_UPDATEDecho "[$branch revision $revision]" > gcc/REVISIONtouch_files_reexec
Go to most recent revision | Compare with Previous | Blame | View Log
