utils/clone_and_compile_ns3_dce.sh
author Hajime Tazaki <tazaki@nict.go.jp>
Thu, 20 Sep 2012 11:17:36 +0900
changeset 275 9055b93b8b08
parent 269 6704c1c48929
child 276 990d4aae7530
permissions -rwxr-xr-x
build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
119
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
     1
#!/bin/bash
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
     2
# this script checkout NS3 and DCE sources, and build them.
148
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
     3
USE_KERNEL=NO
259
8229b566699d Update NS-3-DEV used version.
frederic.urbani@inria.fr
parents: 245
diff changeset
     4
USE_MPI=NO
269
6704c1c48929 Add support of NS-3 optimized build.
frederic.urbani@inria.fr
parents: 264
diff changeset
     5
USE_OPT=NO
224
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
     6
args=("$@")
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
     7
NB=$#
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
     8
for (( i=0;i<$NB;i++)); do
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
     9
    if [ ${args[${i}]} = '-k' ]
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
    10
    then 
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
    11
       USE_KERNEL=YES
225
dd5e3466cb3c Add a myscripts directories for user scripts build.
frederic.urbani@inria.fr
parents: 224
diff changeset
    12
       WGET=wget
224
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
    13
    fi
259
8229b566699d Update NS-3-DEV used version.
frederic.urbani@inria.fr
parents: 245
diff changeset
    14
    if [ ${args[${i}]} = '-m' ]
8229b566699d Update NS-3-DEV used version.
frederic.urbani@inria.fr
parents: 245
diff changeset
    15
    then 
8229b566699d Update NS-3-DEV used version.
frederic.urbani@inria.fr
parents: 245
diff changeset
    16
       USE_MPI=YES
8229b566699d Update NS-3-DEV used version.
frederic.urbani@inria.fr
parents: 245
diff changeset
    17
       MPI_SWITCH=--enable-mpi
8229b566699d Update NS-3-DEV used version.
frederic.urbani@inria.fr
parents: 245
diff changeset
    18
    fi
269
6704c1c48929 Add support of NS-3 optimized build.
frederic.urbani@inria.fr
parents: 264
diff changeset
    19
    if [ ${args[${i}]} = '-o' ]
6704c1c48929 Add support of NS-3 optimized build.
frederic.urbani@inria.fr
parents: 264
diff changeset
    20
    then 
6704c1c48929 Add support of NS-3 optimized build.
frederic.urbani@inria.fr
parents: 264
diff changeset
    21
       USE_OPT=YES
6704c1c48929 Add support of NS-3 optimized build.
frederic.urbani@inria.fr
parents: 264
diff changeset
    22
       OPT_SWITCH=--enable-opt
6704c1c48929 Add support of NS-3 optimized build.
frederic.urbani@inria.fr
parents: 264
diff changeset
    23
    fi    
224
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
    24
done 
225
dd5e3466cb3c Add a myscripts directories for user scripts build.
frederic.urbani@inria.fr
parents: 224
diff changeset
    25
for i in patch hg make $WGET tar
224
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
    26
do
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
    27
which $i >/dev/null
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
    28
if [ 1 == $? ]
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
    29
then
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
    30
	echo $i not found !
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
    31
	echo "Please, install $i command line tool."
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
    32
	exit 1
206
0f48e3ded7e3 Add checking of patch command existance in compile script.
frederic.urbani@inria.fr
parents: 205
diff changeset
    33
fi
224
7c6a6046bf4b Inprove build script.
frederic.urbani@inria.fr
parents: 223
diff changeset
    34
done
120
dde8b2c0b748 Fix Scripts.
frederic.urbani@inria.fr
parents: 119
diff changeset
    35
cd `dirname $BASH_SOURCE`/../..
119
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    36
SAVE_PATH=$PATH
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    37
SAVE_LDLP=$LD_LIBRARY_PATH
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    38
SAVE_PKG=$PKG_CONFIG_PATH
120
dde8b2c0b748 Fix Scripts.
frederic.urbani@inria.fr
parents: 119
diff changeset
    39
#echo clone ns-3-dce : 
dde8b2c0b748 Fix Scripts.
frederic.urbani@inria.fr
parents: 119
diff changeset
    40
#hg clone http://code.nsnam.org/furbani/ns-3-dce
119
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    41
echo clone readversiondef
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    42
hg clone http://code.nsnam.org/mathieu/readversiondef
275
9055b93b8b08 build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Hajime Tazaki <tazaki@nict.go.jp>
parents: 269
diff changeset
    43
9055b93b8b08 build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Hajime Tazaki <tazaki@nict.go.jp>
parents: 269
diff changeset
    44
echo clone elf-loader
9055b93b8b08 build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Hajime Tazaki <tazaki@nict.go.jp>
parents: 269
diff changeset
    45
hg clone -r d7ef4732dccc http://code.nsnam.org/mathieu/elf-loader/
9055b93b8b08 build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Hajime Tazaki <tazaki@nict.go.jp>
parents: 269
diff changeset
    46
148
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
    47
if [ "YES" == "$USE_KERNEL" ]
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
    48
then
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
    49
	echo clone ns-3-linux
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
    50
 	hg clone http://code.nsnam.org/furbani/ns-3-linux
227
fe6f336cf5a8 Update ns-3-dev version.
frederic.urbani@inria.fr
parents: 225
diff changeset
    51
fi
134
62b921ab6f2a Merge with ns-3-dev.
frederic.urbani@inria.fr
parents: 120
diff changeset
    52
echo clone ns-3-dev
259
8229b566699d Update NS-3-DEV used version.
frederic.urbani@inria.fr
parents: 245
diff changeset
    53
hg clone -r 7752dc4ce7e9 http://code.nsnam.org/ns-3-dev
119
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    54
mkdir build
134
62b921ab6f2a Merge with ns-3-dev.
frederic.urbani@inria.fr
parents: 120
diff changeset
    55
cd ns-3-dev
245
7bcafc101432 clean up the build script along with ns-3-linux
Hajime Tazaki <tazaki@nict.go.jp>
parents: 243
diff changeset
    56
hg revert -a
162
cb46566adf75 Add prototype implementation for socket of domain AF_PACKET and type SOCK_RAW.
frederic.urbani@inria.fr
parents: 161
diff changeset
    57
patch -p1 <../ns-3-dce/utils/packet-socket-upgrade-exp.patch
227
fe6f336cf5a8 Update ns-3-dev version.
frederic.urbani@inria.fr
parents: 225
diff changeset
    58
patch -p1 <../ns-3-dce/utils/remove-default-simulator-asserts.patch
269
6704c1c48929 Add support of NS-3 optimized build.
frederic.urbani@inria.fr
parents: 264
diff changeset
    59
patch -p1 <../ns-3-dce/utils/NS3-shutdown.patch
6704c1c48929 Add support of NS-3 optimized build.
frederic.urbani@inria.fr
parents: 264
diff changeset
    60
if [ "YES" == "$USE_OPT" ]
6704c1c48929 Add support of NS-3 optimized build.
frederic.urbani@inria.fr
parents: 264
diff changeset
    61
then
6704c1c48929 Add support of NS-3 optimized build.
frederic.urbani@inria.fr
parents: 264
diff changeset
    62
	CXXFLAGS='-O3' ./waf configure -d optimized --prefix=`pwd`/../build --enable-tests $MPI_SWITCH
6704c1c48929 Add support of NS-3 optimized build.
frederic.urbani@inria.fr
parents: 264
diff changeset
    63
else
6704c1c48929 Add support of NS-3 optimized build.
frederic.urbani@inria.fr
parents: 264
diff changeset
    64
	./waf configure --prefix=`pwd`/../build --enable-tests $MPI_SWITCH
6704c1c48929 Add support of NS-3 optimized build.
frederic.urbani@inria.fr
parents: 264
diff changeset
    65
fi
119
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    66
./waf
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    67
./waf install
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    68
cd ..
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    69
export PATH=$SAVE_PATH:`pwd`/build/bin
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    70
export LD_LIBRARY_PATH=$SAVE_LDLP:`pwd`/build/lib
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    71
export PKG_CONFIG_PATH=$SAVE_PKG:`pwd`/build/lib/pkgconfig
275
9055b93b8b08 build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Hajime Tazaki <tazaki@nict.go.jp>
parents: 269
diff changeset
    72
# build readversiondef
119
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    73
cd readversiondef/
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    74
make 
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    75
make install PREFIX=`pwd`/../build/
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
    76
cd ..
275
9055b93b8b08 build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Hajime Tazaki <tazaki@nict.go.jp>
parents: 269
diff changeset
    77
# build elf-loader
9055b93b8b08 build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Hajime Tazaki <tazaki@nict.go.jp>
parents: 269
diff changeset
    78
cd elf-loader
9055b93b8b08 build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Hajime Tazaki <tazaki@nict.go.jp>
parents: 269
diff changeset
    79
make vdl-config.h
9055b93b8b08 build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Hajime Tazaki <tazaki@nict.go.jp>
parents: 269
diff changeset
    80
make
9055b93b8b08 build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Hajime Tazaki <tazaki@nict.go.jp>
parents: 269
diff changeset
    81
make test
9055b93b8b08 build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Hajime Tazaki <tazaki@nict.go.jp>
parents: 269
diff changeset
    82
cp libvdl.so ../build/lib
9055b93b8b08 build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Hajime Tazaki <tazaki@nict.go.jp>
parents: 269
diff changeset
    83
cd ..
9055b93b8b08 build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Hajime Tazaki <tazaki@nict.go.jp>
parents: 269
diff changeset
    84
148
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
    85
if [ "YES" == "$USE_KERNEL" ]
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
    86
then
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
    87
	cd ns-3-linux/
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
    88
	make
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
    89
	cd ..
173
721b6053d1af Update kernel and iproute2 sources of sources !
frederic.urbani@inria.fr
parents: 162
diff changeset
    90
	wget http://www.linuxgrill.com/anonymous/iproute2/NEW-OSDL/iproute2-2.6.38.tar.bz2     
721b6053d1af Update kernel and iproute2 sources of sources !
frederic.urbani@inria.fr
parents: 162
diff changeset
    91
	tar jxf iproute2-2.6.38.tar.bz2
721b6053d1af Update kernel and iproute2 sources of sources !
frederic.urbani@inria.fr
parents: 162
diff changeset
    92
	cd iproute2-2.6.38
721b6053d1af Update kernel and iproute2 sources of sources !
frederic.urbani@inria.fr
parents: 162
diff changeset
    93
	./configure
148
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
    94
	LDFLAGS=-pie make CCOPTS='-fpic -D_GNU_SOURCE -O0 -U_FORTIFY_SOURCE'
264
990f99d5b4d2 little fix.
frederic.urbani@inria.fr
parents: 263
diff changeset
    95
	cd ../ns-3-dce
204
60a9cf52e24a Fix kernel mode and tests.
frederic.urbani@inria.fr
parents: 203
diff changeset
    96
	mkdir -p build/bin_dce
60a9cf52e24a Fix kernel mode and tests.
frederic.urbani@inria.fr
parents: 203
diff changeset
    97
	cd  build/bin_dce
262
e2fa5ca29cd4 Change the name of the kernel library used in examples and tests.
frederic.urbani@inria.fr
parents: 259
diff changeset
    98
	ln -s ../../../ns-3-linux/libnet-next-2.6.so liblinux.so
263
80ddc553e4ec Fix kernel lib name for quagga examples .
frederic.urbani@inria.fr
parents: 262
diff changeset
    99
	ln -s ../../../ns-3-linux/libnet-next-2.6.so
204
60a9cf52e24a Fix kernel mode and tests.
frederic.urbani@inria.fr
parents: 203
diff changeset
   100
	ln -s ../../../iproute2-2.6.38/ip/ip
60a9cf52e24a Fix kernel mode and tests.
frederic.urbani@inria.fr
parents: 203
diff changeset
   101
	cd ../..
148
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
   102
fi
119
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
   103
cd ns-3-dce/
148
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
   104
if [ "YES" == "$USE_KERNEL" ]
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
   105
then
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
   106
    WAF_KERNEL=--enable-kernel-stack=`pwd`/../ns-3-linux
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
   107
fi
275
9055b93b8b08 build elf-loader by default, improve test-case to cover pthread/ucontext, dlm/cooja, with vdl/no-vdl
Hajime Tazaki <tazaki@nict.go.jp>
parents: 269
diff changeset
   108
./waf configure --prefix=`pwd`/../build --verbose $WAF_KERNEL $MPI_SWITCH $OPT_SWITCH
119
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
   109
./waf
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
   110
./waf install
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
   111
export LD_LIBRARY_PATH=$SAVE_LDLP:`pwd`/build/lib:`pwd`/build/bin:`pwd`/../build/lib
148
5dd2d890f1a0 Update documentation and build script.
frederic.urbani@inria.fr
parents: 140
diff changeset
   112
. utils/setenv.sh
119
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
   113
echo Launch NS3TEST-DCE
c4e9b1d9e57f Add some utils scripts.
frederic.urbani@inria.fr
parents:
diff changeset
   114
./build/bin/ns3test-dce --verbose