Lines 1-42
Link Here
|
1 |
#!/bin/bash |
1 |
#!/bin/bash |
2 |
# Copyright 1999-2005 Gentoo Foundation |
2 |
# Copyright 1999-2005 Gentoo Foundation |
3 |
# Distributed under the terms of the GNU General Public License v2 |
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.12 2005/01/30 18:45:22 vapier Exp $ |
4 |
# $Header: $ |
5 |
|
5 |
|
6 |
usage() { |
6 |
usage() { |
7 |
cat << "USAGE_END" |
7 |
cat << "USAGE_END" |
8 |
Usage: fix_libtool_files.sh <old-gcc-version> [--oldarch <old-CHOST>] |
8 |
Usage: fix_libtool_files.sh [--oldarch <old-CHOST>] |
9 |
|
9 |
|
10 |
Where <old-gcc-version> is the version number of the |
10 |
This program will update all the references to a version of |
11 |
previous gcc version. For example, if you updated to |
11 |
gcc to the curently used one. |
12 |
gcc-3.2.1, and you had gcc-3.2 installed, run: |
12 |
For example, if you updated to gcc-3.2.1, and you had gcc-3.2 installed, run: |
|
|
13 |
|
14 |
# fix_libtool_files.sh |
13 |
|
15 |
|
14 |
# fix_libtool_files.sh 3.2 |
|
|
15 |
|
16 |
|
16 |
If you updated to gcc-3.2.3, and the old CHOST was i586-pc-linux-gnu |
17 |
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 |
but you now have CHOST as i686-pc-linux-gnu, run: |
18 |
|
19 |
|
19 |
# fix_libtool_files.sh 3.2 --oldarch i586-pc-linux-gnu |
20 |
# fix_libtool_files.sh --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 |
|
21 |
|
27 |
USAGE_END |
22 |
USAGE_END |
28 |
exit 1 |
23 |
exit 1 |
29 |
} |
24 |
} |
30 |
|
25 |
|
31 |
if [[ $2 != "--oldarch" && $# -ne 1 ]] || \ |
26 |
if [[ "$1" == "--help" ]] || \ |
32 |
[[ $2 == "--oldarch" && $# -ne 3 ]] |
27 |
[[ "$1" == "--oldarch" ]] && [[ "$#" -ne 2 ]] |
33 |
then |
28 |
then |
34 |
usage |
29 |
usage |
|
|
30 |
else |
31 |
: |
35 |
fi |
32 |
fi |
36 |
|
33 |
|
37 |
ARGV1=$1 |
34 |
ARGV1=$1 |
38 |
ARGV2=$2 |
35 |
ARGV2=$2 |
39 |
ARGV3=$3 |
|
|
40 |
|
36 |
|
41 |
source /etc/profile |
37 |
source /etc/profile |
42 |
source /sbin/functions.sh |
38 |
source /sbin/functions.sh |
Lines 49-72
Link Here
|
49 |
# make sure the files come out sane |
45 |
# make sure the files come out sane |
50 |
umask 0022 |
46 |
umask 0022 |
51 |
|
47 |
|
52 |
if [[ ${ARGV2} == "--oldarch" ]] && [[ -n ${ARGV3} ]] ; then |
48 |
if [[ ${ARGV1} == "--oldarch" ]] && [[ -n "${ARGV2}" ]] ; then |
53 |
OLDCHOST=${ARGV3} |
49 |
OLDCHOST=${ARGV2} |
54 |
else |
50 |
else |
55 |
OLDCHOST= |
51 |
OLDCHOST= |
56 |
fi |
52 |
fi |
57 |
|
53 |
|
58 |
AWKDIR="/lib/rcscripts/awk" |
54 |
PORTAGEBINDIR="/usr/lib/portage/bin" |
59 |
|
55 |
|
60 |
if [[ ! -r ${AWKDIR}/fixlafiles.awk ]] ; then |
56 |
if [[ ! -r "${PORTAGEBINDIR}/fixlafiles.py" ]] ; then |
61 |
eerror "${0##*/}: ${AWKDIR}/fixlafiles.awk does not exist!" |
57 |
eerror "${0##*/}: ${PORTAGEBINDIR}/fixlafiles.py does not exist!" |
62 |
exit 1 |
58 |
exit 1 |
63 |
fi |
59 |
fi |
64 |
|
60 |
|
65 |
OLDVER=${ARGV1} |
61 |
export OLDCHOST |
66 |
|
|
|
67 |
export OLDVER OLDCHOST |
68 |
|
62 |
|
69 |
einfo "Scanning libtool files for hardcoded gcc library paths..." |
63 |
einfo "Scanning libtool files for hardcoded gcc library paths..." |
70 |
/bin/gawk -f "${AWKDIR}/fixlafiles.awk" |
64 |
${PORTAGEBINDIR}/fixlafiles.py |
71 |
|
65 |
|
72 |
# vim:ts=4 |
66 |
# vim:ts=4 |