-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathstage-gcc.sh
executable file
·74 lines (60 loc) · 2.11 KB
/
stage-gcc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
##
## Script: stage-gcc.sh
##
## This top-level script installs the new GCC build into a staging location
## suitable for building a distribution tarball and/or RPM.
##
##- Make sure we're in the same directory as this script.
##
export TOP_DIR="$(cd "$(dirname "$0")" && pwd)"
cd $TOP_DIR
##- Get the GCC-related variables for this build.
##
source ./gcc-build-vars.sh
##- Make the dummy installation directories.
##
mkdir -p $GCC_STAGEDIR/$GCC_INSTALL_RELDIR
mkdir -p $GCC_STAGEDIR/$GCC_INSTALL_SCRIPTS_RELDIR
##- Install GCC itself.
##
cd $GCC_BLD_DIR
$GCC_MAKE install DESTDIR=$GCC_STAGEDIR
##- If requested, install custom binutils.
##
if [ "$GCC_PLATFORM" == "Linux" ] && [ "$GCC_USE_CUSTOM_BINUTILS" == "YES" ]
then
cd $BU_BLD_DIR
$GCC_MAKE install-gas DESTDIR=$GCC_STAGEDIR
$GCC_MAKE install-ld DESTDIR=$GCC_STAGEDIR
cd $GCC_SRC_DIR
GCC_TRIPLE=`./config.guess`
GCC_EXEC_DIR=libexec/gcc/$GCC_TRIPLE/$GCC_VERSION
cp -v $GCC_STAGEDIR/usr/local/bin/as $GCC_STAGEDIR/$GCC_INSTALL_PREFIX/$GCC_EXEC_DIR
cp -v $GCC_STAGEDIR/usr/local/bin/ld* $GCC_STAGEDIR/$GCC_INSTALL_PREFIX/$GCC_EXEC_DIR
fi
##- Install helper scripts and create helper links.
##
cd $TOP_DIR
sed "s|ABCXYZ|$GCC_INSTALL_PREFIX|" \
./setenv-for-gcc.sh > \
./setenv-for-gcc$GCC_TAG.sh
sed -i "s|DEFUVW|$GCC_INSTALL_SCRIPTS_PREFIX|" \
./setenv-for-gcc$GCC_TAG.sh
chmod 755 ./setenv-for-gcc$GCC_TAG.sh
mv -vf ./setenv-for-gcc$GCC_TAG.sh $GCC_STAGEDIR/$GCC_INSTALL_SCRIPTS_RELDIR
cp -v ./restore-default-paths.sh ./restore-default-paths-gcc$GCC_TAG.sh
chmod 755 ./restore-default-paths-gcc$GCC_TAG.sh
mv -vf ./restore-default-paths-gcc$GCC_TAG.sh $GCC_STAGEDIR/$GCC_INSTALL_SCRIPTS_RELDIR
cd $GCC_STAGEDIR/$GCC_INSTALL_SCRIPTS_RELDIR
ln -vf -s $GCC_INSTALL_PREFIX/bin/gcc gcc$GCC_TAG
ln -vf -s $GCC_INSTALL_PREFIX/bin/g++ g++$GCC_TAG
cd $GCC_STAGEDIR/$GCC_INSTALL_RELDIR/bin
ln -vf -s gcc cc
ln -vf -s g++ c++
ln -vf -s gcc gcc-$GCC_MAJOR_VERSION
ln -vf -s g++ g++-$GCC_MAJOR_VERSION
##- Touch all the files to have the desired timestamp.
##
cd $GCC_STAGEDIR
find . -exec touch -h -t $GCC_TIME_STAMP {} \+