utils/clone_and_compile_ns3_dce.sh
changeset 275 9055b93b8b08
parent 269 6704c1c48929
child 276 990d4aae7530
equal deleted inserted replaced
274:d45e93cd80f0 275:9055b93b8b08
     1 #!/bin/bash
     1 #!/bin/bash
     2 # this script checkout NS3 and DCE sources, and build them.
     2 # this script checkout NS3 and DCE sources, and build them.
     3 USE_KERNEL=NO
     3 USE_KERNEL=NO
     4 USE_VDL=NO
       
     5 USE_MPI=NO
     4 USE_MPI=NO
     6 USE_OPT=NO
     5 USE_OPT=NO
     7 WAF_VDL=
       
     8 args=("$@")
     6 args=("$@")
     9 NB=$#
     7 NB=$#
    10 for (( i=0;i<$NB;i++)); do
     8 for (( i=0;i<$NB;i++)); do
    11     if [ ${args[${i}]} = '-k' ]
     9     if [ ${args[${i}]} = '-k' ]
    12     then 
    10     then 
    13        USE_KERNEL=YES
    11        USE_KERNEL=YES
    14        WGET=wget
    12        WGET=wget
    15     fi
       
    16     if [ ${args[${i}]} = '-v' ]
       
    17     then 
       
    18        USE_VDL=YES
       
    19     fi
    13     fi
    20     if [ ${args[${i}]} = '-m' ]
    14     if [ ${args[${i}]} = '-m' ]
    21     then 
    15     then 
    22        USE_MPI=YES
    16        USE_MPI=YES
    23        MPI_SWITCH=--enable-mpi
    17        MPI_SWITCH=--enable-mpi
    44 SAVE_PKG=$PKG_CONFIG_PATH
    38 SAVE_PKG=$PKG_CONFIG_PATH
    45 #echo clone ns-3-dce : 
    39 #echo clone ns-3-dce : 
    46 #hg clone http://code.nsnam.org/furbani/ns-3-dce
    40 #hg clone http://code.nsnam.org/furbani/ns-3-dce
    47 echo clone readversiondef
    41 echo clone readversiondef
    48 hg clone http://code.nsnam.org/mathieu/readversiondef
    42 hg clone http://code.nsnam.org/mathieu/readversiondef
       
    43 
       
    44 echo clone elf-loader
       
    45 hg clone -r d7ef4732dccc http://code.nsnam.org/mathieu/elf-loader/
       
    46 
    49 if [ "YES" == "$USE_KERNEL" ]
    47 if [ "YES" == "$USE_KERNEL" ]
    50 then
    48 then
    51 	echo clone ns-3-linux
    49 	echo clone ns-3-linux
    52  	hg clone http://code.nsnam.org/furbani/ns-3-linux
    50  	hg clone http://code.nsnam.org/furbani/ns-3-linux
    53 fi
    51 fi
    69 ./waf install
    67 ./waf install
    70 cd ..
    68 cd ..
    71 export PATH=$SAVE_PATH:`pwd`/build/bin
    69 export PATH=$SAVE_PATH:`pwd`/build/bin
    72 export LD_LIBRARY_PATH=$SAVE_LDLP:`pwd`/build/lib
    70 export LD_LIBRARY_PATH=$SAVE_LDLP:`pwd`/build/lib
    73 export PKG_CONFIG_PATH=$SAVE_PKG:`pwd`/build/lib/pkgconfig
    71 export PKG_CONFIG_PATH=$SAVE_PKG:`pwd`/build/lib/pkgconfig
       
    72 # build readversiondef
    74 cd readversiondef/
    73 cd readversiondef/
    75 make 
    74 make 
    76 make install PREFIX=`pwd`/../build/
    75 make install PREFIX=`pwd`/../build/
    77 cd ..
    76 cd ..
       
    77 # build elf-loader
       
    78 cd elf-loader
       
    79 make vdl-config.h
       
    80 make
       
    81 make test
       
    82 cp libvdl.so ../build/lib
       
    83 cd ..
       
    84 
    78 if [ "YES" == "$USE_KERNEL" ]
    85 if [ "YES" == "$USE_KERNEL" ]
    79 then
    86 then
    80 	cd ns-3-linux/
    87 	cd ns-3-linux/
    81 	make
    88 	make
    82 	cd ..
    89 	cd ..
    91 	ln -s ../../../ns-3-linux/libnet-next-2.6.so liblinux.so
    98 	ln -s ../../../ns-3-linux/libnet-next-2.6.so liblinux.so
    92 	ln -s ../../../ns-3-linux/libnet-next-2.6.so
    99 	ln -s ../../../ns-3-linux/libnet-next-2.6.so
    93 	ln -s ../../../iproute2-2.6.38/ip/ip
   100 	ln -s ../../../iproute2-2.6.38/ip/ip
    94 	cd ../..
   101 	cd ../..
    95 fi
   102 fi
    96 if [ "YES" == "$USE_VDL" ]
       
    97 then
       
    98 	hg clone -r d7ef4732dccc http://code.nsnam.org/mathieu/elf-loader/
       
    99 	cd elf-loader
       
   100 	make vdl-config.h
       
   101 	make
       
   102 	make test
       
   103 	cp libvdl.so ../build/lib
       
   104 	cd ..
       
   105 	WAF_VDL="--enable-vdl-loader"
       
   106 fi	
       
   107 cd ns-3-dce/
   103 cd ns-3-dce/
   108 if [ "YES" == "$USE_KERNEL" ]
   104 if [ "YES" == "$USE_KERNEL" ]
   109 then
   105 then
   110     WAF_KERNEL=--enable-kernel-stack=`pwd`/../ns-3-linux
   106     WAF_KERNEL=--enable-kernel-stack=`pwd`/../ns-3-linux
   111 fi
   107 fi
   112 ./waf configure --prefix=`pwd`/../build --verbose $WAF_KERNEL $WAF_VDL $MPI_SWITCH $OPT_SWITCH
   108 ./waf configure --prefix=`pwd`/../build --verbose $WAF_KERNEL $MPI_SWITCH $OPT_SWITCH
   113 ./waf
   109 ./waf
   114 ./waf install
   110 ./waf install
   115 export LD_LIBRARY_PATH=$SAVE_LDLP:`pwd`/build/lib:`pwd`/build/bin:`pwd`/../build/lib
   111 export LD_LIBRARY_PATH=$SAVE_LDLP:`pwd`/build/lib:`pwd`/build/bin:`pwd`/../build/lib
   116 . utils/setenv.sh
   112 . utils/setenv.sh
   117 echo Launch NS3TEST-DCE
   113 echo Launch NS3TEST-DCE