new gcc snapshot
[dottout.git] / net-im / emesene / files / sys-devel / gcc / files / fix_libtool_files.sh
blobc3a3c61f6774fb95582306a90f5cc4322945ca93
1 #!/bin/bash
2 # Copyright 1999-2007 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/fix_libtool_files.sh,v 1.14 2007/09/06 11:00:44 uberlord Exp $
6 usage() {
7 cat << "USAGE_END"
8 Usage: fix_libtool_files.sh <old-gcc-version> [--oldarch <old-CHOST>]
10 Where <old-gcc-version> is the version number of the
11 previous gcc version. For example, if you updated to
12 gcc-3.2.1, and you had gcc-3.2 installed, run:
14 # fix_libtool_files.sh 3.2
16 If you updated to gcc-3.2.3, and the old CHOST was i586-pc-linux-gnu
17 but you now have CHOST as i686-pc-linux-gnu, run:
19 # fix_libtool_files.sh 3.2 --oldarch i586-pc-linux-gnu
21 Note that if only the CHOST and not the version changed, you can run
22 it with the current version and the '--oldarch <old-CHOST>' arguments,
23 and it will do the expected:
25 # fix_libtool_files.sh `gcc -dumpversion` --oldarch i586-pc-linux-gnu
27 USAGE_END
28 exit 1
31 if [[ $2 != "--oldarch" && $# -ne 1 ]] || \
32 [[ $2 == "--oldarch" && $# -ne 3 ]]
33 then
34 usage
37 ARGV1=$1
38 ARGV2=$2
39 ARGV3=$3
41 source /etc/profile || exit 1
42 source /etc/init.d/functions.sh || exit 1
44 if [[ ${EUID} -ne 0 ]] ; then
45 eerror "${0##*/}: Must be root."
46 exit 1
49 # make sure the files come out sane
50 umask 0022
52 if [[ ${ARGV2} == "--oldarch" ]] && [[ -n ${ARGV3} ]] ; then
53 OLDCHOST=${ARGV3}
54 else
55 OLDCHOST=
58 AWKDIR="/lib/rcscripts/awk"
60 if [[ ! -r ${AWKDIR}/fixlafiles.awk ]] ; then
61 eerror "${0##*/}: ${AWKDIR}/fixlafiles.awk does not exist!"
62 exit 1
65 OLDVER=${ARGV1}
67 export OLDVER OLDCHOST
69 einfo "Scanning libtool files for hardcoded gcc library paths..."
70 gawk -f "${AWKDIR}/fixlafiles.awk"
72 # vim:ts=4