gcc-build.sh 1.16 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

set -x
TAR_FILE=`ls *.tar.bz2`
SRC=source
INST_DIR=${TAR_FILE/.tar.bz2/}
DEST_SUBDIR=$INST_DIR-$HOST_LABEL
DEST_DIR=$WORKSPACE/$DEST_SUBDIR
PREFIX=/var/lib/jenkins/slave/opt/$INST_DIR
set +x

# Workaround for Debian >7
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
export LD_LIBRARY_PATH
LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
export LIBRARY_PATH
C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu
export C_INCLUDE_PATH
CPLUS_INCLUDE_PATH=/usr/include/x86_64-linux-gnu
export CPLUS_INCLUDE_PATH

Simon Brass's avatar
Simon Brass committed
22
tar jxf $TAR_FILE
23
24
25
26
mv $INST_DIR $SRC
mkdir $INST_DIR
cd $INST_DIR

Simon Brass's avatar
Simon Brass committed
27
../$SRC/configure --enable-languages=c,c++,fortran --disable-multilib -prefix=$PREFIX > configure.log
28
29
30
31
32
exit_code=$?
if [ $exit_code -ne 0 ]; then
    exit $exit_code
fi

Simon Brass's avatar
Simon Brass committed
33
34
make $HOST_MAKE_FLAGS -s V=0 2>&1 | tee make.log

35
36
37
38
39
40
41
42
43
44
45
exit_code=$?
if [ $exit_code -ne 0 ]; then
    exit $exit_code
fi

mkdir -p $DEST_DIR/$PREFIX/lib
cd $DEST_DIR/$PREFIX

ln -s lib lib64
cd $WORKSPACE/$INST_DIR

Simon Brass's avatar
Simon Brass committed
46
make $HOST_MAKE_FLAGS DESTDIR=$DEST_DIR -s V=0 install 2>&1 | tee make-install.log
47
48
49
50
51
52
53
54
55
56
exit_code=$?
if [ $exit_code -ne 0 ]
then exit $exit_code
fi

cd ..
rm -rf $INST_DIR
rm -rf *.bz2
tar cjf $DEST_SUBDIR.tar.bz2 $DEST_SUBDIR
rm -rf $DEST_SUBDIR