| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # |
| 3 | # Copyright (C) 2000 by USC/ISI |
| 4 | # All rights reserved. |
| 5 | # |
| 6 | # Redistribution and use in source and binary forms are permitted |
| 7 | # provided that the above copyright notice and this paragraph are |
| 8 | # duplicated in all such forms and that any documentation, advertising |
| 9 | # materials, and other materials related to such distribution and use |
| 10 | # acknowledge that the software was developed by the University of |
| 11 | # Southern California, Information Sciences Institute. The name of the |
| 12 | # University may not be used to endorse or promote products derived from |
| 13 | # this software without specific prior written permission. |
| 14 | # |
| 15 | # THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
| 16 | # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
| 17 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 18 | # |
| 19 | # $Header: /cvsroot/nsnam/ns-2/allinone/install,v 1.35 2010/03/08 04:47:18 tom_henderson Exp $ |
| 20 | |
| 21 | diescip-shell shell shell-project 0.0.0 die().() { |
| 22 | echoscip-shell system . . echo. "$@" 1>&2 |
| 23 | testscip-shell system . . test. ! -z "$blame" && echoscip-shell system . . echo. "$blame" 1>&2 |
| 24 | exit 1 |
| 25 | } |
| 26 | |
| 27 | warnscip-shell shell shell-project 0.0.0 warn().() { |
| 28 | echoscip-shell system . . echo. "$@" |
| 29 | } |
| 30 | |
| 31 | test_proceedscip-shell shell shell-project 0.0.0 test_proceed().() { |
| 32 | echoscip-shell system . . echo. ""; |
| 33 | echoscip-shell system . . echo. "The above test indicates that your installation of Cygwin"; |
| 34 | echoscip-shell system . . echo. "is probably NOT SUITABLE for installing ns-2 allinone."; |
| 35 | echoscip-shell system . . echo. "(More details can be found in the specific error message above.)"; |
| 36 | echoscip-shell system . . echo. ""; |
| 37 | echoscip-shell system . . echo. -n "Do you wish to proceed regardless? [y/N] " |
| 38 | read answer; |
| 39 | if [scip-shell system . . `[`. "$answer" != "y" ] && [scip-shell system . . `[`. "$answer" != "Y" ]; then |
| 40 | diescip-shell shell shell-project 0.0.0 die(). "Installation aborted..."; |
| 41 | exit 1; |
| 42 | fi; |
| 43 | echoscip-shell system . . echo. ""; |
| 44 | echoscip-shell system . . echo. "*** OK, but you're on your own... ***"; |
| 45 | echoscip-shell system . . echo. ""; |
| 46 | } |
| 47 | |
| 48 | test_packagesscip-shell shell shell-project 0.0.0 test_packages().() { |
| 49 | for i in $@; do |
| 50 | echoscip-shell system . . echo. -n "Checking for ${i}... "; |
| 51 | cygcheck -c ${i} | grepscip-shell system . . grep. ${i} >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; |
| 52 | if [scip-shell system . . `[`. "$?" -eq "0" ]; then |
| 53 | echoscip-shell system . . echo. "ok"; |
| 54 | else |
| 55 | echoscip-shell system . . echo. "NO!"; |
| 56 | echoscip-shell system . . echo. ""; |
| 57 | echoscip-shell system . . echo. "Package ${i} is not present on your system."; |
| 58 | echoscip-shell system . . echo. ""; |
| 59 | echoscip-shell system . . echo. "Please install it using Cygwin's setup.exe"; |
| 60 | echoscip-shell system . . echo. "before trying to install the ns-2 distribution."; |
| 61 | test_proceedscip-shell shell shell-project 0.0.0 test_proceed().; |
| 62 | fi; |
| 63 | done; |
| 64 | } |
| 65 | |
| 66 | cygwin_testsscip-shell shell shell-project 0.0.0 cygwin_tests().() { |
| 67 | echoscip-shell system . . echo. -n "Checking Cygwin version is >= 1.7.1... " |
| 68 | cmaj=` unamescip-shell system . . uname. -r | sedscip-shell system . . sed. -e 's/^\([0-9]*\)\.\([0-9]*\).\([0-9]*\).*/\1/'`; |
| 69 | echoscip-shell system . . echo. $cmaj | grepscip-shell system . . grep. -v [0-9] >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 70 | if [scip-shell system . . `[`. "$?" -eq "0" ]; then |
| 71 | cmaj=0; |
| 72 | fi; |
| 73 | cmin=` unamescip-shell system . . uname. -r | sedscip-shell system . . sed. -e 's/^\([0-9]*\)\.\([0-9]*\).\([0-9]*\).*/\2/'`; |
| 74 | echoscip-shell system . . echo. $cmin | grepscip-shell system . . grep. -v [0-9] >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 75 | if [scip-shell system . . `[`. "$?" -eq "0" ]; then |
| 76 | cmin=0; |
| 77 | fi; |
| 78 | cpat=` unamescip-shell system . . uname. -r | sedscip-shell system . . sed. -e 's/^\([0-9]*\)\.\([0-9]*\).\([0-9]*\).*/\3/'`; |
| 79 | echoscip-shell system . . echo. $cpat | grepscip-shell system . . grep. -v [0-9] >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 80 | if [scip-shell system . . `[`. "$?" -eq "0" ]; then |
| 81 | cpat=0; |
| 82 | fi; |
| 83 | echoscip-shell system . . echo. -n "$cmaj.$cmin.$cpat "; |
| 84 | if ([scip-shell system . . `[`. "$cmaj" -gt "1" ]) || ([scip-shell system . . `[`. "$cmaj" -eq "1" ] && [scip-shell system . . `[`. $cmin -gt "7" ]) || ([scip-shell system . . `[`. "$cmaj" -eq 1 ] && [scip-shell system . . `[`. $cmin -eq "7" ] && [scip-shell system . . `[`. "$cpat" -ge "1" ]); then |
| 85 | echoscip-shell system . . echo. "(should be ok)"; |
| 86 | else |
| 87 | echoscip-shell system . . echo. "(NO!)"; |
| 88 | echoscip-shell system . . echo. ""; |
| 89 | echoscip-shell system . . echo. "ns-allinone-${NSVER} has not been tested under versions of Cygwin older than"; |
| 90 | echoscip-shell system . . echo. "1.7.1. Your version ($cmaj.$cmin.$cpat) appears to be older than that. Success of"; |
| 91 | echoscip-shell system . . echo. "the install process is therefore NOT GUARANTEED."; |
| 92 | echoscip-shell system . . echo. ""; |
| 93 | cygversion="failed"; |
| 94 | test_proceedscip-shell shell shell-project 0.0.0 test_proceed().; |
| 95 | fi; |
| 96 | echoscip-shell system . . echo. -n "Checking filesystems are mounted as UNIX filetype... "; |
| 97 | mountscip-shell system . . mount. | grepscip-shell system . . grep. "textmode" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; |
| 98 | if [scip-shell system . . `[`. "$?" -eq "0" ]; then |
| 99 | echoscip-shell system . . echo. "NO!"; |
| 100 | mount_test="failed"; |
| 101 | echoscip-shell system . . echo. ""; |
| 102 | echoscip-shell system . . echo. "It appears that some of your Cygwin shares are mounted as DOS file"; |
| 103 | echoscip-shell system . . echo. "type. This has not been tested, but is likely to result in failure of"; |
| 104 | echoscip-shell system . . echo. "validation tests. Success of the install process is also NOT"; |
| 105 | echoscip-shell system . . echo. "GUARANTEED."; |
| 106 | echoscip-shell system . . echo. ""; |
| 107 | echoscip-shell system . . echo. "Refer to the Cygwin user guide for how to install Cygwin with the UNIX"; |
| 108 | echoscip-shell system . . echo. "file text mode."; |
| 109 | test_proceedscip-shell shell shell-project 0.0.0 test_proceed().; |
| 110 | else |
| 111 | echoscip-shell system . . echo. "yes"; |
| 112 | echoscip-shell system . . echo. -n "Checking default mode is binmode... "; |
| 113 | echoscip-shell system . . echo. ${CYGWIN} | grepscip-shell system . . grep. "nobinmode" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; |
| 114 | if [scip-shell system . . `[`. "$?" -eq "0" ]; then |
| 115 | cyg_env_var="failed"; |
| 116 | echoscip-shell system . . echo. "*** NO! ***"; |
| 117 | echoscip-shell system . . echo. ""; |
| 118 | echoscip-shell system . . echo. "Your \$CYGWIN environment variable specifies \"nobinmode\". This is"; |
| 119 | echoscip-shell system . . echo. "likely to result in failure of validation tests, and (possibly) of"; |
| 120 | echoscip-shell system . . echo. "the whole install process. You need to have the \$CYGWIN environment"; |
| 121 | echoscip-shell system . . echo. "variable set to \"binmode\". Please refer to the Cygwin user guide for"; |
| 122 | echoscip-shell system . . echo. "details on how to change this."; |
| 123 | test_proceedscip-shell shell shell-project 0.0.0 test_proceed().; |
| 124 | else |
| 125 | echoscip-shell system . . echo. "yes"; |
| 126 | fi; |
| 127 | fi; |
| 128 | |
| 129 | login=`whoamiscip-shell system . . whoami.` |
| 130 | echoscip-shell system . . echo. -n "Checking legitimate login name... "; |
| 131 | echoscip-shell system . . echo. ${login} | grepscip-shell system . . grep. " " >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; |
| 132 | if [scip-shell system . . `[`. "$?" -eq "0" ]; then |
| 133 | echoscip-shell system . . echo. "NO!"; |
| 134 | echoscip-shell system . . echo. ""; |
| 135 | echoscip-shell system . . echo. "Your username (${login}) contains spaces,"; |
| 136 | echoscip-shell system . . echo. "which makes the installation of ns-2 impossible."; |
| 137 | echoscip-shell system . . echo. "Please try to install ns-2 as a different user, whose"; |
| 138 | echoscip-shell system . . echo. "name does not contain any spaces."; |
| 139 | |
| 140 | test_proceedscip-shell shell shell-project 0.0.0 test_proceed().; |
| 141 | else |
| 142 | echoscip-shell system . . echo. "ok"; |
| 143 | fi; |
| 144 | |
| 145 | echoscip-shell system . . echo. -n "Checking legitimate path name... "; |
| 146 | |
| 147 | installpath=`cygpath -d /scip-shell filesystem . . `/`.`; |
| 148 | echoscip-shell system . . echo. ${installpath} | grepscip-shell system . . grep. " " >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; |
| 149 | if [scip-shell system . . `[`. "$?" -eq "0" ]; then |
| 150 | echoscip-shell system . . echo. "NO!"; |
| 151 | echoscip-shell system . . echo. ""; |
| 152 | echoscip-shell system . . echo. "Your Cygwin installation path (${installpath}) contains spaces,"; |
| 153 | echoscip-shell system . . echo. "which makes the installation of ns-2 impossible."; |
| 154 | echoscip-shell system . . echo. "Please reinstall Cygwin in a different directory, which"; |
| 155 | echoscip-shell system . . echo. "does not contain any spaces."; |
| 156 | test_proceedscip-shell shell shell-project 0.0.0 test_proceed().; |
| 157 | else |
| 158 | echoscip-shell system . . echo. "ok"; |
| 159 | fi; |
| 160 | |
| 161 | test_packagesscip-shell shell shell-project 0.0.0 test_packages(). ${packages_base} |
| 162 | |
| 163 | echoscip-shell system . . echo. -n "Checking for diff... "; |
| 164 | diffscip-shell system . . diff. -v 2>&1 | grepscip-shell system . . grep. -iv "not found" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; |
| 165 | if [scip-shell system . . `[`. "$?" -eq "0" ]; then |
| 166 | echoscip-shell system . . echo. "ok"; |
| 167 | else |
| 168 | echoscip-shell system . . echo. "NO!"; |
| 169 | echoscip-shell system . . echo. ""; |
| 170 | echoscip-shell system . . echo. "diff is not present on your system."; |
| 171 | echoscip-shell system . . echo. ""; |
| 172 | echoscip-shell system . . echo. "Please install it using Cygwin's setup.exe"; |
| 173 | echoscip-shell system . . echo. "before trying to install the ns-2 distribution."; |
| 174 | test_proceedscip-shell shell shell-project 0.0.0 test_proceed().; |
| 175 | fi; |
| 176 | |
| 177 | echoscip-shell system . . echo. -n "Checking for X... "; |
| 178 | test_packagesscip-shell shell shell-project 0.0.0 test_packages(). ${packages_xorg} |
| 179 | } |
| 180 | |
| 181 | |
| 182 | # Package VERSIONs. Change these when releasing new packages |
| 183 | TCLVER=8.5.8 |
| 184 | TKVER=8.5.8 |
| 185 | OTCLVER=1.14 |
| 186 | TCLCLVER=1.20 |
| 187 | NSVER=2.35 |
| 188 | NAMVER=1.15 |
| 189 | XGRAPHVER=12.2 |
| 190 | ZLIBVER=1.2.3 |
| 191 | DEI80211MRVER=1.1.4 |
| 192 | |
| 193 | # Get current path |
| 194 | CUR_PATH=`pwdscip-shell system . . pwd.` |
| 195 | |
| 196 | echoscip-shell system . . echo. "============================================================" |
| 197 | echoscip-shell system . . echo. "* Testing for Darwin (OS X) environment" |
| 198 | echoscip-shell system . . echo. "============================================================" |
| 199 | if [scip-shell system . . `[`. `unamescip-shell system . . uname.` = "Darwin" ]; then |
| 200 | echoscip-shell system . . echo. "Darwin detected"; |
| 201 | DYLD_LIBRARY_PATH=$CUR_PATH/tcl$TCLVER/unix:$CUR_PATH/tk$TKVER/unix:$DYLD_LIBRARY_PATH |
| 202 | export DYLD_LIBRARY_PATH |
| 203 | test_darwin=true |
| 204 | fi |
| 205 | |
| 206 | # A Cygwin install requires these packages: |
| 207 | packages_base="gcc4 gcc4-g++ gawk tar gzip make patch perl w32api" |
| 208 | packages_xorg="xorg-server xinit libX11-devel" |
| 209 | |
| 210 | # Check if we are using Cygwin, and if so, if it is a good install |
| 211 | # Most Cygwin fixes in the tree and this part of the install script were |
| 212 | # contributed by Nicolas Christin <[email protected]> |
| 213 | |
| 214 | echoscip-shell system . . echo. "============================================================" |
| 215 | echoscip-shell system . . echo. "* Testing for Cygwin environment" |
| 216 | echoscip-shell system . . echo. "============================================================" |
| 217 | |
| 218 | if [scip-shell system . . `[`. -x /usr/bin/unamescip-shell filesystem . . `/usr/bin/uname`. ]; then |
| 219 | # it may be a Cygwin install |
| 220 | test_cygwin=`unamescip-shell system . . uname. | trscip-shell system . . tr. [a-z] [A-Z] | sedscip-shell system . . sed. -e 's|.*CYGWIN.*|true|'`; |
| 221 | if [scip-shell system . . `[`. "${test_cygwin}" = "true" ]; then |
| 222 | echoscip-shell system . . echo. "Cygwin detected"; |
| 223 | echoscip-shell system . . echo. "Note: Cygwin install is still considered EXPERIMENTAL"; |
| 224 | echoscip-shell system . . echo. ""; |
| 225 | cygwin_testsscip-shell shell shell-project 0.0.0 cygwin_tests().; |
| 226 | |
| 227 | echoscip-shell system . . echo. "Patching Tcl/Tk for Cygwin."; |
| 228 | if [scip-shell system . . `[`. ! -f ./tcl${TCLVER}/generic/tcl.h.orig ]; then |
| 229 | cpscip-shell system . . cp. ./tcl${TCLVER}/generic/tcl.h ./tcl${TCLVER}/generic/tcl.h.orig; |
| 230 | echoscip-shell system . . echo. "The original tcl${TCLVER}/generic/tcl.h is backed up as tcl${TCLVER}/generic/tcl.h.orig"; |
| 231 | sedscip-shell system . . sed. -e 's/\#define _TCL/\#define _TCL\`\`\#ifdef __CYGWIN__\`\#define HAVE_TM_ZONE 1\`\#endif \/\* __CYGWIN__ \*\//g' ./tcl${TCLVER}/generic/tcl.h.orig | trscip-shell system . . tr. '\`' '\n' > ./tcl${TCLVER}/generic/tcl.h; |
| 232 | cpscip-shell system . . cp. ./tk${TCLVER}/generic/default.h ./tk${TCLVER}/generic/default.h.orig; |
| 233 | echoscip-shell system . . echo. "The original tk${TKVER}/generic/default.h is backed up as tk${TKVER}/generic/default.h.orig"; |
| 234 | sedscip-shell system . . sed. -e 's/defined(__CYGWIN__) || defined(__MINGW32__)/0/g' ./tk${TKVER}/generic/default.h.orig > ./tk${TKVER}/generic/default.h; |
| 235 | fi; |
| 236 | touchscip-shell system . . touch. ./tcl${TCLVER}/generic/tclStubInit.c; |
| 237 | echoscip-shell system . . echo. "Patching sgb for Cygwin."; |
| 238 | cpscip-shell system . . cp. ./sgb/Makefile ./sgb/Makefile.orig; |
| 239 | echoscip-shell system . . echo. "The original sgb/Makefile is backed up as sgb/Makefile.orig"; |
| 240 | sedscip-shell system . . sed. -e 's|rm \(.*\)test_io test_graph test_flip test_sample\(.*\)|rm -f \1test_io.exe test_graph.exe test_flip.exe test_sample.exe\2|' ./sgb/Makefile.orig > ./sgb/Makefile; |
| 241 | echoscip-shell system . . echo. "Setting executable format to .exe..."; |
| 242 | EXE=".exe"; |
| 243 | else |
| 244 | echoscip-shell system . . echo. "Cygwin not detected, proceeding with regular install."; |
| 245 | EXE=; |
| 246 | fi; |
| 247 | else |
| 248 | echoscip-shell system . . echo. "Cygwin not detected, proceeding with regular install."; |
| 249 | fi; |
| 250 | |
| 251 | echoscip-shell system . . echo. "============================================================" |
| 252 | echoscip-shell system . . echo. "* Testing for FreeBSD environment" |
| 253 | echoscip-shell system . . echo. "============================================================" |
| 254 | # See if we need to use gmake. |
| 255 | if [scip-shell system . . `[`. "`unamescip-shell system . . uname. -s`" = "FreeBSD" ]; then |
| 256 | echoscip-shell system . . echo. "FreeBSD detected; using gmake instead of make" |
| 257 | if (type gmake &>/dev/nullscip-shell filesystem . . `/dev/null`.); then |
| 258 | alias make="gmake" |
| 259 | fi |
| 260 | else |
| 261 | echoscip-shell system . . echo. "FreeBSD not detected" |
| 262 | fi |
| 263 | |
| 264 | # Compile and install xgraph |
| 265 | |
| 266 | echoscip-shell system . . echo. "============================================================" |
| 267 | echoscip-shell system . . echo. "* Build XGraph-$XGRAPHVER" |
| 268 | echoscip-shell system . . echo. "============================================================" |
| 269 | |
| 270 | cd ./xgraph-$XGRAPHVER |
| 271 | ./configure --prefix=../ |
| 272 | if [scip-shell system . . `[`. "${test_cygwin}" = "true" ]; then |
| 273 | touchscip-shell system . . touch. stamp-h; |
| 274 | fi; |
| 275 | if makescip-shell system . . make. |
| 276 | then |
| 277 | echoscip-shell system . . echo. "xgraph has been installed successfully. " |
| 278 | else |
| 279 | echoscip-shell system . . echo. "Can not create xgraph; But xgraph is an optional package, continuing..." |
| 280 | fi |
| 281 | |
| 282 | cd ../ |
| 283 | |
| 284 | # Compile and install cweb and sgblib |
| 285 | |
| 286 | echoscip-shell system . . echo. "============================================================" |
| 287 | echoscip-shell system . . echo. "* Build CWeb" |
| 288 | echoscip-shell system . . echo. "============================================================" |
| 289 | |
| 290 | cd ./cweb |
| 291 | |
| 292 | if [scip-shell system . . `[`. ! -f ./Makefile ] |
| 293 | then |
| 294 | echoscip-shell system . . echo. "ns-allinone unable to install cweb for you. Please install it manually. cweb is used by sgb to create sgblibrary needed by scenario-generator. But this will not affect the use of ns as such, so continue.." |
| 295 | else |
| 296 | echoscip-shell system . . echo. "Making cweb" |
| 297 | touchscip-shell system . . touch. *.c |
| 298 | makescip-shell system . . make. all || warnscip-shell shell shell-project 0.0.0 warn(). "cweb failed to make, but it's optional" |
| 299 | # xxx: other stuff will fail... |
| 300 | chmodscip-shell system . . chmod. 755 cweave${EXE} |
| 301 | chmodscip-shell system . . chmod. 755 ctangle${EXE} |
| 302 | cd .. |
| 303 | #echo "cd .." |
| 304 | if [scip-shell system . . `[`. ! -d bin ] |
| 305 | then |
| 306 | mkdirscip-shell system . . mkdir. bin |
| 307 | fi |
| 308 | cd bin |
| 309 | lnscip-shell system . . ln. -s $CUR_PATH/cweb/cweave${EXE} cweave${EXE} |
| 310 | lnscip-shell system . . ln. -s $CUR_PATH/cweb/ctangle${EXE} ctangle${EXE} |
| 311 | fi |
| 312 | |
| 313 | cd .. |
| 314 | PATH=$CUR_PATH/bin:$PATH |
| 315 | export PATH |
| 316 | |
| 317 | echoscip-shell system . . echo. "============================================================" |
| 318 | echoscip-shell system . . echo. "* Build Stanford GraphBase" |
| 319 | echoscip-shell system . . echo. "============================================================" |
| 320 | |
| 321 | cd ./sgb |
| 322 | if [scip-shell system . . `[`. ! -f ./Makefile ] |
| 323 | then |
| 324 | echoscip-shell system . . echo. "Unable to create sgb library. This library is used by gt-itm and so for scenario generators. If you already have sgblib (possible if you are on solaris,sunos or freebsd platforms) you may still be able to run gt-itm. so continuing.." |
| 325 | else |
| 326 | echoscip-shell system . . echo. "Making sgb" |
| 327 | if makescip-shell system . . make. tests |
| 328 | then |
| 329 | if [scip-shell system . . `[`. -f libgb.a ] ; then |
| 330 | rmscip-shell system . . rm. -f ../gt-itm/lib/libgb.a |
| 331 | cpscip-shell system . . cp. libgb.a ../gt-itm/lib/libgb.a |
| 332 | else |
| 333 | echoscip-shell system . . echo. "* Weird: sgb said it has been built but we can't find libgb.a! " |
| 334 | exit -1 |
| 335 | fi |
| 336 | else |
| 337 | echoscip-shell system . . echo. "Unable to create sgb library, but it's optional, so continuing..." |
| 338 | fi |
| 339 | fi |
| 340 | |
| 341 | cd .. |
| 342 | |
| 343 | # Compile and install gt-itm & sgb2ns |
| 344 | |
| 345 | echoscip-shell system . . echo. "============================================================" |
| 346 | echoscip-shell system . . echo. "* Build GT-ITM" |
| 347 | echoscip-shell system . . echo. "============================================================" |
| 348 | |
| 349 | if [scip-shell system . . `[`. -f ./gt-itm/lib/libgb.a ] |
| 350 | then |
| 351 | if [scip-shell system . . `[`. ! -f ./gt-itm/src/Makefile ] |
| 352 | then |
| 353 | echoscip-shell system . . echo. "ns-alline is unable to install gt-itm sgb2ns for you, please install" |
| 354 | echoscip-shell system . . echo. "them manually. You can't run scenario generator without gt-itm" |
| 355 | echoscip-shell system . . echo. "and sgb2ns. But it will not affect you use ns, so continue ..." |
| 356 | else |
| 357 | cd ./gt-itm/src |
| 358 | if makescip-shell system . . make. |
| 359 | then |
| 360 | echoscip-shell system . . echo. "gt-itm has been installed successfully." |
| 361 | fi |
| 362 | |
| 363 | cd ../sgb2ns |
| 364 | if makescip-shell system . . make. |
| 365 | then |
| 366 | echoscip-shell system . . echo. "sgb2ns has been installed successfully." |
| 367 | fi |
| 368 | cd ../../ |
| 369 | fi |
| 370 | else |
| 371 | echoscip-shell system . . echo. "sgb lib not found. gt-itm & sgb2ns could not be installed. Continuing.." |
| 372 | fi |
| 373 | |
| 374 | # Build zlib |
| 375 | |
| 376 | echoscip-shell system . . echo. "============================================================" |
| 377 | echoscip-shell system . . echo. "* Build zlib" |
| 378 | echoscip-shell system . . echo. "============================================================" |
| 379 | |
| 380 | cd ./zlib-$ZLIBVER |
| 381 | |
| 382 | if ./configure --exec-prefix=../ --prefix=../ |
| 383 | then |
| 384 | if makescip-shell system . . make. |
| 385 | then |
| 386 | echoscip-shell system . . echo. "Zlib has been installed successfully." |
| 387 | else |
| 388 | warnscip-shell shell shell-project 0.0.0 warn(). "Zlib make failed, but it's optional Continue ..." |
| 389 | fi |
| 390 | else |
| 391 | warnscip-shell shell shell-project 0.0.0 warn(). "Zlib-$ZLIBVER configuration failed, but it's optional, so continuing ..." |
| 392 | fi |
| 393 | |
| 394 | cd ../ |
| 395 | |
| 396 | # Build Tcl8.4.18 |
| 397 | |
| 398 | echoscip-shell system . . echo. "============================================================" |
| 399 | echoscip-shell system . . echo. "* Build tcl$TCLVER" |
| 400 | echoscip-shell system . . echo. "============================================================" |
| 401 | |
| 402 | cd ./tcl$TCLVER/unix |
| 403 | if [scip-shell system . . `[`. -f Makefile ] ; then |
| 404 | makescip-shell system . . make. distclean |
| 405 | fi |
| 406 | |
| 407 | blame='Tcl is not part of the ns project. Please see www.Scriptics.com |
| 408 | to see if they have a fix for your platform.' |
| 409 | autoconfscip-shell system . . autoconf. |
| 410 | ./configure --enable-gcc --disable-shared --prefix=$CUR_PATH || diescip-shell shell shell-project 0.0.0 die(). "tcl$TCLVER configuration failed! Exiting ..." |
| 411 | if makescip-shell system . . make. |
| 412 | then |
| 413 | echoscip-shell system . . echo. "tcl$TCLVER make succeeded." |
| 414 | makescip-shell system . . make. install || diescip-shell shell shell-project 0.0.0 die(). "tcl$TCLVER installation failed." |
| 415 | makescip-shell system . . make. install-private-headers || diescip-shell shell shell-project 0.0.0 die(). "tcl$TCLVER installation failed." |
| 416 | echoscip-shell system . . echo. "tcl$TCLVER installation succeeded." |
| 417 | #cp ../generic/*.h ../../include |
| 418 | else |
| 419 | echoscip-shell system . . echo. "tcl$TCLVER make failed! Exiting ..." |
| 420 | echoscip-shell system . . echo. "For problems with Tcl/Tk see http://www.scriptics.com" |
| 421 | exit |
| 422 | fi |
| 423 | |
| 424 | cd ../../ |
| 425 | |
| 426 | # compile and install tk |
| 427 | |
| 428 | echoscip-shell system . . echo. "============================================================" |
| 429 | echoscip-shell system . . echo. "* Build Tk$TKVER" |
| 430 | echoscip-shell system . . echo. "============================================================" |
| 431 | |
| 432 | cd ./tk$TKVER/unix |
| 433 | if [scip-shell system . . `[`. -f Makefile ] ; then |
| 434 | makescip-shell system . . make. distclean |
| 435 | fi |
| 436 | |
| 437 | blame='Tk is not part of the ns project. Please see www.Scriptics.com |
| 438 | to see if they have a fix for your platform.' |
| 439 | autoconfscip-shell system . . autoconf. |
| 440 | ./configure --enable-gcc --disable-shared --disable-xft --disable-xss --prefix=$CUR_PATH || diescip-shell shell shell-project 0.0.0 die(). "tk$TKVER configuration failed! Exiting ..." |
| 441 | if makescip-shell system . . make. |
| 442 | then |
| 443 | echoscip-shell system . . echo. "tk$TKVER build succeeded." |
| 444 | makescip-shell system . . make. install || diescip-shell shell shell-project 0.0.0 die(). "tk$TKVER installation failed." |
| 445 | makescip-shell system . . make. install-private-headers || diescip-shell shell shell-project 0.0.0 die(). "tcl$TCLVER installation failed." |
| 446 | echoscip-shell system . . echo. "tk$TKVER installation succeeded." |
| 447 | else |
| 448 | echoscip-shell system . . echo. "tk$TKVER make failed! Exiting ..." |
| 449 | echoscip-shell system . . echo. "For problems with Tcl/Tk see http://www.scriptics.com" |
| 450 | exit |
| 451 | fi |
| 452 | |
| 453 | cd ../../ |
| 454 | |
| 455 | # |
| 456 | # Since our configures search for tclsh in $PATH, the following |
| 457 | # is needed. This is necessary for otcl/tclcl/ns/nam |
| 458 | # |
| 459 | #PATH=$CUR_PATH/tcl$TCLVER/unix:$CUR_PATH/tk$TKVER/unix:$PATH |
| 460 | #LD_LIBRARY_PATH=$CUR_PATH/tcl$TCLVER/unix:$CUR_PATH/tk$TKVER/unix:$LD_LIBRARY_PATH |
| 461 | |
| 462 | # However, the above library path setting has been found to be still |
| 463 | # fragile for systems that have multiple versions of Tcl/Tk installed |
| 464 | # in various places, so in the below, we will force the allinone build |
| 465 | # to use the tcl/tk version installed with allinone by passing the |
| 466 | # --with-tcl-ver and --with-tk-ver options |
| 467 | |
| 468 | # Build otcl |
| 469 | |
| 470 | echoscip-shell system . . echo. "============================================================" |
| 471 | echoscip-shell system . . echo. "* Build OTcl-$OTCLVER" |
| 472 | echoscip-shell system . . echo. "============================================================" |
| 473 | |
| 474 | cd ./otcl-$OTCLVER |
| 475 | |
| 476 | blame='Please check http://www.isi.edu/nsnam/ns/ns-problems.html |
| 477 | for common problems and bug fixes.' |
| 478 | if [scip-shell system . . `[`. "${test_cygwin}" = "true" ]; then |
| 479 | ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include --with-tcl-ver=$TCLVER --with-tk-ver=$TKVER --disable-shlib || diescip-shell shell shell-project 0.0.0 die(). "otcl-$OTCLVER configuration failed! Exiting ..."; |
| 480 | if makescip-shell system . . make. |
| 481 | then |
| 482 | echoscip-shell system . . echo. "otcl-$OTCLVER has been installed successfully." |
| 483 | else |
| 484 | echoscip-shell system . . echo. "otcl-$OTCLVER make failed! Exiting ..." |
| 485 | echoscip-shell system . . echo. "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems" |
| 486 | exit |
| 487 | fi |
| 488 | else |
| 489 | ./configure --with-tcl-ver=$TCLVER --with-tk-ver=$TKVER || diescip-shell shell shell-project 0.0.0 die(). "otcl-$OTCLVER configuration failed! Exiting ..."; |
| 490 | |
| 491 | if makescip-shell system . . make. |
| 492 | then |
| 493 | echoscip-shell system . . echo. "otcl-$OTCLVER has been installed successfully." |
| 494 | else |
| 495 | echoscip-shell system . . echo. "otcl-$OTCLVER make failed! Exiting ..." |
| 496 | echoscip-shell system . . echo. "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems" |
| 497 | exit |
| 498 | fi |
| 499 | fi |
| 500 | |
| 501 | cd .. |
| 502 | |
| 503 | # Build tclcl |
| 504 | |
| 505 | echoscip-shell system . . echo. "============================================================" |
| 506 | echoscip-shell system . . echo. "* Build Tclcl-$TCLCLVER" |
| 507 | echoscip-shell system . . echo. "============================================================" |
| 508 | |
| 509 | cd ./tclcl-$TCLCLVER |
| 510 | |
| 511 | if [scip-shell system . . `[`. "${test_cygwin}" = "true" ]; then |
| 512 | ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include --with-tcl-ver=$TCLVER --with-tk-ver=$TKVER || diescip-shell shell shell-project 0.0.0 die(). "tclcl-$TCLCLVER configuration failed! Exiting ..."; |
| 513 | else |
| 514 | ./configure --with-otcl=../otcl-$OTCLVER --with-tcl-ver=$TCLVER --with-tk-ver=$TKVER || diescip-shell shell shell-project 0.0.0 die(). "tclcl-$TCLCLVER configuration failed! Exiting ..." |
| 515 | fi |
| 516 | |
| 517 | if makescip-shell system . . make. |
| 518 | then |
| 519 | echoscip-shell system . . echo. "tclcl-$TCLCLVER has been installed successfully." |
| 520 | else |
| 521 | echoscip-shell system . . echo. "tclcl-$TCLCLVER make failed! Exiting ..." |
| 522 | echoscip-shell system . . echo. "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems" |
| 523 | exit |
| 524 | fi |
| 525 | |
| 526 | cd ../ |
| 527 | |
| 528 | # John's hack |
| 529 | testscip-shell system . . test. -f ./otcl-$OTCLVER/libotcl.a && rmscip-shell system . . rm. ./otcl-$OTCLVER/libotcl.so |
| 530 | |
| 531 | echoscip-shell system . . echo. "============================================================" |
| 532 | echoscip-shell system . . echo. "* Build ns-$NSVER" |
| 533 | echoscip-shell system . . echo. "============================================================" |
| 534 | |
| 535 | cd ./ns-$NSVER |
| 536 | if [scip-shell system . . `[`. -f Makefile ] ; then |
| 537 | makescip-shell system . . make. distclean |
| 538 | fi |
| 539 | |
| 540 | if [scip-shell system . . `[`. "${test_cygwin}" = "true" ]; then |
| 541 | ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include --with-tcl-ver=$TCLVER --with-tk-ver=$TKVER || diescip-shell shell shell-project 0.0.0 die(). "Ns configuration failed! Exiting ..."; |
| 542 | else |
| 543 | ./configure --with-otcl=../otcl-$OTCLVER --with-tclcl=../tclcl-$TCLCLVER --with-tcl-ver=$TCLVER --with-tk-ver=$TKVER || diescip-shell shell shell-project 0.0.0 die(). "Ns configuration failed! Exiting ..."; |
| 544 | fi |
| 545 | |
| 546 | if makescip-shell system . . make. |
| 547 | then |
| 548 | echoscip-shell system . . echo. " Ns has been installed successfully." |
| 549 | else |
| 550 | echoscip-shell system . . echo. "Ns make failed!" |
| 551 | echoscip-shell system . . echo. "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems" |
| 552 | exit |
| 553 | fi |
| 554 | |
| 555 | cd ../ |
| 556 | |
| 557 | # Build nam |
| 558 | |
| 559 | echoscip-shell system . . echo. "============================================================" |
| 560 | echoscip-shell system . . echo. "* Build nam-$NAMVER" |
| 561 | echoscip-shell system . . echo. "============================================================" |
| 562 | |
| 563 | lnscip-shell system . . ln. -s otcl-$OTCLVER otcl |
| 564 | lnscip-shell system . . ln. -s tclcl-$TCLCLVER tclcl |
| 565 | |
| 566 | cd ./nam-$NAMVER |
| 567 | |
| 568 | # XXX temporary OS X hack |
| 569 | if [scip-shell system . . `[`. "${test_darwin}" = "true" ]; then |
| 570 | lnscip-shell system . . ln. -s /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundationscip-shell filesystem . . `/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation`. libcorefoundation.dylib |
| 571 | fi |
| 572 | |
| 573 | if [scip-shell system . . `[`. "${test_cygwin}" = "true" ]; then |
| 574 | ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include --with-tclcl=$CUR_PATH/tclcl-$TCLCLVER --with-tcl-ver=$TCLVER --with-tk-ver=$TKVER || diescip-shell shell shell-project 0.0.0 die(). "Nam configuration failed! Exiting ..."; |
| 575 | else |
| 576 | ./configure --with-otcl=../otcl-$OTCLVER --with-tclcl=../tclcl-$TCLCLVER --with-tcl-ver=$TCLVER --with-tk-ver=$TKVER || diescip-shell shell shell-project 0.0.0 die(). "Nam configuration failed! Exiting ..."; |
| 577 | fi |
| 578 | |
| 579 | if makescip-shell system . . make. |
| 580 | then |
| 581 | echoscip-shell system . . echo. "Nam has been installed successfully." |
| 582 | elif [scip-shell system . . `[`. "${test_darwin}" = "true" ]; then |
| 583 | # XXX workaround for OS X nam Tcl/Tk problems |
| 584 | echoscip-shell system . . echo. "Nam make failed! Trying to relink..." |
| 585 | echoscip-shell system . . echo. "g++ -o nam tkcompat.o tkUnixInit.o xwd.o netview.o netmodel.o edge.o packet.o node.o main.o trace.o queue.o drop.o animation.o agent.o feature.o route.o transform.o paint.o state.o monitor.o anetmodel.o random.o rng.o view.o graphview.o netgraph.o tracehook.o lan.o psview.o group.o editview.o tag.o address.o animator.o wnetmodel.o nam_stream.o enetmodel.o testview.o parser.o trafficsource.o lossmodel.o queuehandle.o gen/version.o gen/nam_tcl.o ../tcl8.5.8/unix/libtcl8.5.a ../tk8.5.8/unix/libtk8.5.a ../tcl8.5.8/unix/libtclstub8.5.a -L../tclcl-1.20 -ltclcl -L../otcl -lotcl -L/usr/lib -lz -L/usr/X11R6/lib -lXext -lX11 -lm -L. -lcorefoundation" |
| 586 | g++ -o nam tkcompat.o tkUnixInit.o xwd.o netview.o netmodel.o edge.o packet.o node.o main.o trace.o queue.o drop.o animation.o agent.o feature.o route.o transform.o paint.o state.o monitor.o anetmodel.o random.o rng.o view.o graphview.o netgraph.o tracehook.o lan.o psview.o group.o editview.o tag.o address.o animator.o wnetmodel.o nam_stream.o enetmodel.o testview.o parser.o trafficsource.o lossmodel.o queuehandle.o gen/version.o gen/nam_tcl.o ../tcl8.5.8/unix/libtcl8.5.a ../tk8.5.8/unix/libtk8.5.a ../tcl8.5.8/unix/libtclstub8.5.a -L../tclcl-1.20 -ltclcl -L../otcl -lotcl -L/usr/lib -lz -L/usr/X11R6/lib -lXext -lX11 -lm -L. -lcorefoundation |
| 587 | if [scip-shell system . . `[`. -e nam ]; then |
| 588 | echoscip-shell system . . echo. "Nam relinking succeeded; nam has been installed successfully." |
| 589 | else |
| 590 | echoscip-shell system . . echo. "Nam make failed! You may want to tweak the above linker path if libraries are not being picked up successfuly. Continue ..." |
| 591 | echoscip-shell system . . echo. "See http://www.isi.edu/nsnam/ns-problems.html for problems" |
| 592 | fi |
| 593 | else |
| 594 | echoscip-shell system . . echo. "Nam make failed! Continue ..." |
| 595 | echoscip-shell system . . echo. "See http://www.isi.edu/nsnam/ns-problems.html for problems" |
| 596 | fi |
| 597 | |
| 598 | cd ../ |
| 599 | |
| 600 | |
| 601 | |
| 602 | # Building dei80211mr |
| 603 | |
| 604 | cd ./dei80211mr-${DEI80211MRVER} |
| 605 | |
| 606 | ./configure --with-ns-allinone=${CUR_PATH} --prefix=${CUR_PATH} \ |
| 607 | && makescip-shell system . . make. \ |
| 608 | && makescip-shell system . . make. install |
| 609 | |
| 610 | cd .. |
| 611 | |
| 612 | |
| 613 | # Install nam, ns, xgraph into bin |
| 614 | |
| 615 | if [scip-shell system . . `[`. ! -d bin ] ; then |
| 616 | mkdirscip-shell system . . mkdir. bin |
| 617 | fi |
| 618 | |
| 619 | cd bin |
| 620 | |
| 621 | lnscip-shell system . . ln. -s $CUR_PATH/ns-$NSVER/ns${EXE} ns${EXE} |
| 622 | |
| 623 | if testscip-shell system . . test. -x $CUR_PATH/nam-$NAMVER/nam${EXE} |
| 624 | then |
| 625 | lnscip-shell system . . ln. -s $CUR_PATH/nam-$NAMVER/nam${EXE} nam${EXE} |
| 626 | else |
| 627 | echoscip-shell system . . echo. "Please compile your nam separately." |
| 628 | fi |
| 629 | |
| 630 | if testscip-shell system . . test. -x $CUR_PATH/xgraph-$XGRAPHVER/xgraph${EXE} |
| 631 | then |
| 632 | lnscip-shell system . . ln. -s $CUR_PATH/xgraph-$XGRAPHVER/xgraph${EXE} xgraph${EXE} |
| 633 | else |
| 634 | echoscip-shell system . . echo. "Please compile your xgraph separately." |
| 635 | fi |
| 636 | |
| 637 | if testscip-shell system . . test. -x $CUR_PATH/gt-itm/bin/sgb2ns${EXE} |
| 638 | then |
| 639 | lnscip-shell system . . ln. -s $CUR_PATH/gt-itm/bin/sgb2ns${EXE} sgb2ns${EXE} |
| 640 | lnscip-shell system . . ln. -s $CUR_PATH/gt-itm/bin/sgb2hierns${EXE} sgb2hierns${EXE} |
| 641 | lnscip-shell system . . ln. -s $CUR_PATH/gt-itm/bin/sgb2comns${EXE} sgb2comns${EXE} |
| 642 | lnscip-shell system . . ln. -s $CUR_PATH/gt-itm/bin/itm${EXE} itm${EXE} |
| 643 | lnscip-shell system . . ln. -s $CUR_PATH/gt-itm/bin/sgb2alt${EXE} sgb2alt${EXE} |
| 644 | lnscip-shell system . . ln. -s $CUR_PATH/gt-itm/bin/edriver${EXE} edriver${EXE} |
| 645 | else |
| 646 | echoscip-shell system . . echo. "Please compile your gt-itm & sgb2ns separately." |
| 647 | fi |
| 648 | |
| 649 | echoscip-shell system . . echo. "" |
| 650 | echoscip-shell system . . echo. "Ns-allinone package has been installed successfully." |
| 651 | echoscip-shell system . . echo. "Here are the installation places:" |
| 652 | echoscip-shell system . . echo. "tcl$TCLVER: $CUR_PATH/{bin,include,lib}" |
| 653 | echoscip-shell system . . echo. "tk$TKVER: $CUR_PATH/{bin,include,lib}" |
| 654 | echoscip-shell system . . echo. "otcl: $CUR_PATH/otcl-$OTCLVER" |
| 655 | echoscip-shell system . . echo. "tclcl: $CUR_PATH/tclcl-$TCLCLVER" |
| 656 | echoscip-shell system . . echo. "ns: $CUR_PATH/ns-$NSVER/ns" |
| 657 | |
| 658 | if [scip-shell system . . `[`. -x $CUR_PATH/nam-$NAMVER/nam ] |
| 659 | then |
| 660 | echoscip-shell system . . echo. "nam: $CUR_PATH/nam-$NAMVER/nam" |
| 661 | fi |
| 662 | |
| 663 | if [scip-shell system . . `[`. -x $CUR_PATH/xgraph-$XGRAPHVER/xgraph ] |
| 664 | then |
| 665 | echoscip-shell system . . echo. "xgraph: $CUR_PATH/xgraph-$XGRAPHVER" |
| 666 | fi |
| 667 | if [scip-shell system . . `[`. -x $CUR_PATH/gt-itm/bin/sgb2ns ] |
| 668 | then |
| 669 | echoscip-shell system . . echo. "gt-itm: $CUR_PATH/itm, edriver, sgb2alt, sgb2ns, sgb2comns, sgb2hierns" |
| 670 | fi |
| 671 | |
| 672 | echoscip-shell system . . echo. "" |
| 673 | echoscip-shell system . . echo. "----------------------------------------------------------------------------------" |
| 674 | echoscip-shell system . . echo. "" |
| 675 | echoscip-shell system . . echo. "Please put $CUR_PATH/bin:$CUR_PATH/tcl$TCLVER/unix:$CUR_PATH/tk$TKVER/unix" |
| 676 | echoscip-shell system . . echo. "into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph." |
| 677 | echoscip-shell system . . echo. "" |
| 678 | echoscip-shell system . . echo. "IMPORTANT NOTICES:" |
| 679 | echoscip-shell system . . echo. "" |
| 680 | echoscip-shell system . . echo. "(1) You MUST put $CUR_PATH/otcl-$OTCLVER, $CUR_PATH/lib, " |
| 681 | echoscip-shell system . . echo. " into your LD_LIBRARY_PATH environment variable." |
| 682 | echoscip-shell system . . echo. " If it complains about X libraries, add path to your X libraries " |
| 683 | echoscip-shell system . . echo. " into LD_LIBRARY_PATH." |
| 684 | echoscip-shell system . . echo. " If you are using csh, you can set it like:" |
| 685 | echoscip-shell system . . echo. " setenv LD_LIBRARY_PATH <paths>" |
| 686 | echoscip-shell system . . echo. " If you are using sh, you can set it like:" |
| 687 | echoscip-shell system . . echo. " export LD_LIBRARY_PATH=<paths>" |
| 688 | echoscip-shell system . . echo. "" |
| 689 | echoscip-shell system . . echo. "(2) You MUST put $CUR_PATH/tcl$TCLVER/library into your TCL_LIBRARY environmental" |
| 690 | echoscip-shell system . . echo. " variable. Otherwise ns/nam will complain during startup." |
| 691 | echoscip-shell system . . echo. "" |
| 692 | echoscip-shell system . . echo. "" |
| 693 | echoscip-shell system . . echo. "After these steps, you can now run the ns validation suite with" |
| 694 | echoscip-shell system . . echo. "cd ns-$NSVER; ./validate" |
| 695 | echoscip-shell system . . echo. "" |
| 696 | echoscip-shell system . . echo. "For trouble shooting, please first read ns problems page " |
| 697 | echoscip-shell system . . echo. "http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive" |
| 698 | echoscip-shell system . . echo. "for related posts." |
| 699 | echoscip-shell system . . echo. "" |
| 700 | |
| 701 | exit 0 |
| 702 |