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