install.sh 2.84 KB
Newer Older
Matthieu Boileau's avatar
Matthieu Boileau committed
1
2
3
4
5
6
7
#!/bin/bash

set -x 
export LIB_NAME="gcc"
export LIB_VERSION=6.4.0

export LIB_FULLNAME=${LIB_NAME}-${LIB_VERSION}
Matthieu Boileau's avatar
Matthieu Boileau committed
8
#export LIB_VERSION_SHORT="${LIB_VERSION//.}"
Matthieu Boileau's avatar
Matthieu Boileau committed
9
SUB_DIR=${LIB_NAME}/${LIB_VERSION}
Matthieu Boileau's avatar
Matthieu Boileau committed
10
11
12
13
14
15
WORK_DIR=/data/software/sources/${SUB_DIR}
SRC_DIR=${WORK_DIR}/${LIB_FULLNAME}
ARCHIVE=${SRC_DIR}.tar.gz
URL="ftp://ftp.irisa.fr/pub/mirrors/gcc.gnu.org/gcc/releases/gcc-${LIB_VERSION}/gcc-${LIB_VERSION}.tar.gz"
BUILD_DIR=${WORK_DIR}/${LIB_FULLNAME}-build
export INSTALL_DIR=/data/software/install/${SUB_DIR}
Matthieu Boileau's avatar
Matthieu Boileau committed
16
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Matthieu Boileau's avatar
Matthieu Boileau committed
17
MODULE_DIR=/data/software/modules/compilers/${LIB_NAME}
Matthieu Boileau's avatar
Matthieu Boileau committed
18
MODULE_PATH=${MODULE_DIR}/${LIB_VERSION}
Matthieu Boileau's avatar
Matthieu Boileau committed
19

Matthieu Boileau's avatar
Matthieu Boileau committed
20
21
22
install_lib()
{
module purge
Matthieu Boileau's avatar
Matthieu Boileau committed
23
gcc --version
Matthieu Boileau's avatar
Matthieu Boileau committed
24
sleep 1
Matthieu Boileau's avatar
Matthieu Boileau committed
25
26
27
28
29
30
31
32
33
34
35
36
37

if [[ ! -f $ARCHIVE ]]; then
  mkdir -p $WORK_DIR
  wget $URL -O $ARCHIVE
fi

if [[ ! -d $SRC_DIR ]]; then
  tar zxf $ARCHIVE --directory $WORK_DIR
fi

if [[ ! -d $BUILD_DIR ]]; then
  mkdir $BUILD_DIR
  cd $BUILD_DIR
Matthieu Boileau's avatar
Matthieu Boileau committed
38
  ${SRC_DIR}/configure -v --with-pkgversion='gcc 6.4.0' \
Matthieu Boileau's avatar
Matthieu Boileau committed
39
  --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs \
Matthieu Boileau's avatar
Matthieu Boileau committed
40
  --enable-languages=c,c++,fortran \
Matthieu Boileau's avatar
Matthieu Boileau committed
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
  --enable-shared \
  --enable-linker-build-id \
  --without-included-gettext \
  --enable-threads=posix \
  --enable-nls \
  --with-sysroot=/ \
  --enable-clocale=gnu \
  --enable-libstdcxx-debug \
  --enable-libstdcxx-time=yes \
  --with-default-libstdcxx-abi=new \
  --enable-gnu-unique-object \
  --disable-vtable-verify \
  --enable-libmpx \
  --enable-plugin \
  --enable-default-pie \
  --with-system-zlib \
  --disable-browser-plugin \
  --enable-gtk-cairo \
  --with-arch-directory=amd64 \
  --with-target-system-zlib \
  --enable-multiarch \
  --disable-werror \
  --with-arch-32=i686 \
  --with-abi=m64 \
  --with-multilib-list=m32,m64,mx32 \
  --enable-multilib \
  --with-tune=generic \
  --enable-checking=release \
  --build=x86_64-linux-gnu \
  --host=x86_64-linux-gnu \
  --target=x86_64-linux-gnu \
  --prefix=${INSTALL_DIR}
Matthieu Boileau's avatar
Matthieu Boileau committed
73
74
75
76
77
78
79
80
81
82
83
84
#  --libdir=/usr/lib \
#  --libexecdir=/usr/lib \
#  --program-suffix=-6 \
#  --program-prefix=x86_64-linux-gnu- \
#  --enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++ \
#  --enable-java-awt=gtk \
#  --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre \
#  --enable-java-home \
#  --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 \
#  --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 \
#  --with-ecj-jar=/usr/share/java/eclipse-ecj.jar \
#  --enable-objc-gc=auto \
Matthieu Boileau's avatar
Matthieu Boileau committed
85
86
87
88
89
fi

cd $BUILD_DIR
make -j || exit 1
make -j install || exit 1
Matthieu Boileau's avatar
Matthieu Boileau committed
90
}
Matthieu Boileau's avatar
Matthieu Boileau committed
91

Matthieu Boileau's avatar
Matthieu Boileau committed
92
93
install_module()
{
Matthieu Boileau's avatar
Matthieu Boileau committed
94
cd $SCRIPT_DIR
Matthieu Boileau's avatar
Matthieu Boileau committed
95
mkdir -p ${MODULE_DIR}
Matthieu Boileau's avatar
Matthieu Boileau committed
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
export LIB_NAME
export LIB_VERSION
export LIB_FULLNAME
export INSTALL_DIR
envtpl  --keep-template -o $MODULE_PATH module.tmpl
}

if [[ $1 == "module" ]]
then
  install_module
elif [[ $1 == "clean" ]]
then
  if [[ -d $BUILD_DIR ]]
  then
    rm -rf $BUILD_DIR
  else
    echo "$BUILD_DIR does not exist"
    exit 1
  fi
else
  install_lib
  install_module
fi