]> git.draconx.ca Git - gentoo-draconx.git/blob - sys-devel/gcc/files/fix_libtool_files.sh
Add gcc with fixed POD dependencies.
[gentoo-draconx.git] / sys-devel / gcc / files / fix_libtool_files.sh
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 $
5
6 usage() {
7 cat << "USAGE_END"
8 Usage: fix_libtool_files.sh <old-gcc-version> [--oldarch <old-CHOST>]
9
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:
13
14       # fix_libtool_files.sh 3.2
15
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:
18
19       # fix_libtool_files.sh 3.2 --oldarch i586-pc-linux-gnu
20
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:
24
25       # fix_libtool_files.sh `gcc -dumpversion` --oldarch i586-pc-linux-gnu
26
27 USAGE_END
28         exit 1
29 }
30
31 if [[ $2 != "--oldarch" && $# -ne 1 ]] || \
32    [[ $2 == "--oldarch" && $# -ne 3 ]]
33 then
34         usage
35 fi
36
37 ARGV1=$1
38 ARGV2=$2
39 ARGV3=$3
40
41 source /etc/profile || exit 1
42 source /etc/init.d/functions.sh || exit 1
43
44 if [[ ${EUID} -ne 0 ]] ; then
45         eerror "${0##*/}: Must be root."
46         exit 1
47 fi
48
49 # make sure the files come out sane
50 umask 0022
51
52 if [[ ${ARGV2} == "--oldarch" ]] && [[ -n ${ARGV3} ]] ; then
53         OLDCHOST=${ARGV3}
54 else
55         OLDCHOST=
56 fi
57
58 AWKDIR="/lib/rcscripts/awk"
59
60 if [[ ! -r ${AWKDIR}/fixlafiles.awk ]] ; then
61         eerror "${0##*/}: ${AWKDIR}/fixlafiles.awk does not exist!"
62         exit 1
63 fi
64
65 OLDVER=${ARGV1}
66
67 export OLDVER OLDCHOST
68
69 einfo "Scanning libtool files for hardcoded gcc library paths..."
70 gawk -f "${AWKDIR}/fixlafiles.awk"
71
72 # vim:ts=4