Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – tendra.SVN – Blame – /trunk/doc/development/historical-installation – Rev 6

Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6 7u83 1
#!/bin/sh
2
#
3
#   		 Crown Copyright (c) 1997, 1998
4
#   
5
#   This TenDRA(r) Computer Program is subject to Copyright
6
#   owned by the United Kingdom Secretary of State for Defence
7
#   acting through the Defence Evaluation and Research Agency
8
#   (DERA).  It is made available to Recipients with a
9
#   royalty-free licence for its use, reproduction, transfer
10
#   to other parties and amendment for any purpose not excluding
11
#   product development provided that any such use et cetera
12
#   shall be deemed to be acceptance of the following conditions:-
13
#   
14
#       (1) Its Recipients shall ensure that this Notice is
15
#       reproduced upon any copies or amended versions of it;
16
#   
17
#       (2) Any amended version of it shall be clearly marked to
18
#       show both the nature of and the organisation responsible
19
#       for the relevant amendment or amendments;
20
#   
21
#       (3) Its onward transfer from a recipient to another
22
#       party shall be deemed to be that party's acceptance of
23
#       these conditions;
24
#   
25
#       (4) DERA gives no warranty or assurance as to its
26
#       quality or suitability for any purpose and DERA accepts
27
#       no liability whatsoever in relation to any use to which
28
#       it may be put.
29
#
30
 
31
echo "Use the provided makefiles!"
32
exit
33
 
34
#
35
# STANDARD DIRECTORIES
36
#
37
# These directories are used to configure where the release is to be
38
# installed:
39
#
40
#	BASE_DIR	gives the directory in which the source has been
41
#			installed (i.e. the directory containing this script).
42
#
43
#	PUBLIC_BIN	gives the directory in which the public executables
44
#			(tcc, tchk and tspec) are to be installed.  If
45
#			PUBLIC_BIN is left blank then the public executables
46
#			will be installed in the private executables
47
#			directory.
48
#
49
#	INSTALL_DIR	gives the directory in which the configuration files,
50
#			include files, private executables, libraries etc.
51
#			are to be installed.
52
#
53
#	COMMON_DIR	gives the sub-directory of INSTALL_DIR in which the
54
#			target independent components are to be installed.
55
#
56
#	MACH_DIR	gives the sub-directory of INSTALL_DIR in which the
57
#			target dependent components are to be installed.
58
#
59
#	MAN_DIR		gives the directory in which the manual pages are
60
#			to be installed.
61
#
62
#	WORK_DIR	gives the working directory in which binary object
63
#			files etc. created during the build process will
64
#			be stored.
65
#
66
#	TMP_DIR		gives a temporary directory, used both by this
67
#			script and by tcc (so make sure that there is
68
#			plenty of free space).
69
#
70
 
71
BASE_DIR=/usr/local/src/TenDRA-4.1.2
72
PUBLIC_BIN=/usr/local/bin
73
INSTALL_DIR=/usr/local/lib/TenDRA
74
COMMON_DIR=${INSTALL_DIR}/lib
75
MACH_DIR=${INSTALL_DIR}/machines
76
MAN_DIR=/usr/local/man
77
WORK_DIR=${BASE_DIR}/work
78
TEMP_DIR=/var/tmp
79
 
80
 
81
#
82
# BUILD OPTIONS
83
#
84
# These flags control which components of the release should be installed.
85
#
86
# If BUILD_UPDATE is true then the public executables and their configuration
87
# files will be installed (this has to be done on every target platform).
88
#
89
# If BUILD_MACHINE is true then all the other target dependent components
90
# will be installed (this also has to be done on every target platform).
91
#
92
# If BUILD_COMMON is true then the target independent components will be
93
# installed (this only has to be done once, indeed if the release is being
94
# built simultaneously on several platforms then the builds can conflict
95
# with each other, so start the quickest machine off first to install
96
# the complete release, and get the other machines to only install the
97
# target dependent sections).
98
#
99
# BUILD_OK is set to false if an error occurs.
100
#
101
# COMMENT controls whether or not this script prints comments as it goes
102
# along.
103
#
104
 
105
BUILD_UPDATE=true
106
BUILD_MACHINE=true
107
BUILD_COMMON=true
108
BUILD_OK=true
109
COMMENT=echo
110
 
111
 
112
#
113
# COMPILER INFORMATION
114
#
115
# These variables give information on the compiler to be used to install
116
# the release.  CC gives the compiler. CCOPTS and LIBOPTS give any target
117
# specific options required by the build, and are set by this script.  It
118
# is recommended that any extra flags which the user requires are made
119
# part of the definition of CC, so CC="gcc -O" would install using gcc
120
# in optimising mode.  TCCOPTS controls the extra configuration options
121
# required when bootstrapping the system using tcc.  It should be set to:
122
#
123
#	TCCOPTS=			for tcc,
124
#	TCCOPTS="TCCOPTS="		for other compilers.
125
#
126
# To install the bootstrapped compiler, install first using cc or gcc.
127
# Then remove the work directory (WORK_DIR), change the compiler to tcc,
128
# and install again.  Bootstrapping is recommended (all our testing is
129
# on the bootstrapped compiler).
130
#
131
# SYS_INCLUDES gives a list of include file directories to be searched
132
# when building the TDF API libraries.
133
#
134
# STRIP may be set to "strip" in order to ensure that the installed
135
# executables are stripped.
136
#
137
# RANLIB is used on those platforms on which system libraries need to be
138
# ranlib-ed.
139
#
140
# EXEC_SUFFIX is used on those platforms where executable names need to
141
# have a particular suffix, for example it may be set to ".exe".
142
#
143
 
144
CC=cc
145
CCOPTS=
146
LIBOPTS=
147
TCCOPTS="TCCOPTS="
148
SYS_INCLUDES="-I/usr/include"
149
STRIP=:
150
RANLIB=ranlib
151
EXEC_SUFFIX=
152
 
153
 
154
#
155
# COMMAND LINE ARGUMENTS
156
#
157
# The easiest way of configuring this installation script is by direct
158
# editing, however these command line options may be used to make minor
159
# alterations.
160
#
161
 
162
for ARG in $*
163
do
164
    case ${ARG} in
165
    -cc)		CC=cc ; TCCOPTS="TCCOPTS=" ;;
166
    -gcc)		CC=gcc ; TCCOPTS="TCCOPTS=" ;;
167
    -tcc)		CC=tcc ; TCCOPTS="" ;;
168
    -g)			CC="${CC} -g" ;;
169
    -O)			CC="${CC} -O" ;;
170
    -exe)		EXEC_SUFFIX=".exe" ;;
171
    -quiet)		COMMENT=":" ;;
172
    -strip)		STRIP=strip ;;
173
    -target)		BUILD_COMMON=false ;;
174
    -update)		BUILD_COMMON=false ; BUILD_MACHINE=false ;;
175
    *)			${COMMENT} "Unknown option, ${ARG}" ;;
176
    esac
177
done
178
 
179
 
180
#
181
# PRINT THE COPYRIGHT NOTICE
182
#
183
# The copyright notice is printed.  This also checks for the most common
184
# error, running INSTALL before configuring it to the system.
185
#
186
 
187
if [ ! -f ${BASE_DIR}/COPYRIGHT ]
188
then
189
    ${COMMENT} "Please set BASE_DIR in the INSTALL script"
190
    exit 1
191
fi
192
 
193
cat ${BASE_DIR}/COPYRIGHT
194
 
195
 
196
#
197
# FIND HOST TYPE
198
#
199
# The method for finding the operating system type, operating system version
200
# and CPU type is decidedly dirty.  A program tuname, similar to uname, but
201
# more uniform across platforms, is installed.  Feel free to hack tuname
202
# around if it doesn't work properly.
203
#
204
 
205
${COMMENT} building host type determiner, tuname ...
206
TUNAME=${TEMP_DIR}/tuname_$$${EXEC_SUFFIX}
207
MACH_HEADER=${TEMP_DIR}/mach_$$.h
208
SRC=${BASE_DIR}/src/utilities/tuname
209
cd ${TEMP_DIR} || exit 1
210
make -f ${SRC}/Makefile CC="${CC}" ${TCCOPTS}\
211
    BASE=${BASE_DIR} NAME=${TUNAME} all
212
if [ -f ${TUNAME} ]
213
then
214
    MACH_OS=`${TUNAME} -s`
215
    MACH_VERS=`${TUNAME} -r`
216
    MACH_CPU=`${TUNAME} -m`
217
    MACH_EXEC=`${TUNAME} -e`
218
    ${TUNAME} -D > ${MACH_HEADER}
219
    rm -f ${TUNAME}
220
    if [ "X${MACH_OS}X" = "XunknownX" ]
221
    then
222
	${COMMENT} Unknown machine type
223
	exit 1
224
    fi
225
else
226
    ${COMMENT} Unknown machine type
227
    exit 1
228
fi
229
 
230
${COMMENT}
231
${COMMENT} Operating system = ${MACH_OS}
232
${COMMENT} Operating system version = ${MACH_VERS}
233
${COMMENT} Processor type = ${MACH_CPU}
234
${COMMENT} Executable type = ${MACH_EXEC}
235
 
236
 
237
#
238
# FIND MACHINE DEPENDENT FLAGS
239
#
240
# The target specific options required to build the system on the various
241
# platforms are stored in separate configuration files.  Feel free to add
242
# or modify these files as necessary.
243
#
244
 
245
MACH_OPTS=${BASE_DIR}/src/build/${MACH_OS}.opt
246
if [ -f ${MACH_OPTS} ]
247
then
248
    . ${MACH_OPTS}
249
fi
250
 
251
 
252
#
253
# CREATE DIRECTORIES
254
#
255
# All the directories required for the installation are created.  The PATH
256
# is also set to pick up the private and public executables during
257
# installation.
258
#
259
 
260
MACH_BASE=${MACH_DIR}/${MACH_OS}/${MACH_VERS}/${MACH_CPU}
261
MACH_WORK=${WORK_DIR}/${MACH_OS}/${MACH_VERS}/${MACH_CPU}
262
 
263
if [ "X${PUBLIC_BIN}X" = "XX" ]
264
then
265
	PUBLIC_BIN=${MACH_BASE}/bin
266
fi
267
 
268
PATH=${MACH_BASE}/bin:${PUBLIC_BIN}:/usr/ccs/bin:${PATH}
269
export PATH
270
 
271
if ${BUILD_UPDATE}
272
then
273
    CREATE_DIRS="${MACH_DIR}\
274
		 ${MACH_DIR}/${MACH_OS}\
275
		 ${MACH_DIR}/${MACH_OS}/${MACH_VERS}\
276
		 ${MACH_BASE}\
277
		 ${MACH_BASE}/bin\
278
		 ${MACH_BASE}/env\
279
		 ${MACH_BASE}/lib\
280
		 ${MACH_BASE}/lib/diag\
281
		 ${MACH_BASE}/lib/sys\
282
		 ${PUBLIC_BIN}"
283
else
284
    CREATE_DIRS=
285
fi
286
 
287
if ${BUILD_MACHINE}
288
then
289
    MACH_DIRS="${WORK_DIR} ${WORK_DIR}/${MACH_OS}\
290
	       ${WORK_DIR}/${MACH_OS}/${MACH_VERS}\
291
	       ${MACH_WORK}"
292
else
293
    MACH_DIRS=
294
fi
295
 
296
if ${BUILD_COMMON}
297
then
298
    COMMON_DIRS="${INSTALL_DIR}\
299
		 ${COMMON_DIR}\
300
		 ${MAN_DIR}\
301
		 ${MAN_DIR}/man1\
302
		 ${MAN_DIR}/man5"
303
else
304
    COMMON_DIRS=
305
fi
306
 
307
for DIR in ${COMMON_DIRS} ${CREATE_DIRS} ${MACH_DIRS}
308
do
309
    if [ ! -d ${DIR} ]
310
    then
311
	${COMMENT} creating ${DIR} ...
312
	mkdir ${DIR} || exit 1
313
    fi
314
done
315
 
316
${COMMENT}
317
 
318
 
319
#
320
# BUILD PROGRAMS
321
#
322
# The various program executables are now built.  The list of executables
323
# is stored in the PROGRAMS file.  Note that each executable has its own
324
# Makefile which can be used to install the executable in isolation, or
325
# during development work.
326
#
327
 
328
MACH_SED=${TEMP_DIR}/mach$$.sed
329
cat > ${MACH_SED} << EOF
330
1,\$s/MACH_OS/${MACH_OS}/g
331
1,\$s/MACH_CPU/${MACH_CPU}/g
332
EOF
333
 
334
for PROG in `sed -f ${MACH_SED} ${BASE_DIR}/src/build/PROGRAMS`
335
do
336
    NAME=`echo ${PROG} | sed -e 's/:.*//'`
337
    SRC=${BASE_DIR}/src/`echo ${PROG} | sed -e 's/.*://'`
338
 
339
    #
340
    # Build program
341
    #
342
 
343
    if ${BUILD_MACHINE}
344
    then
345
	${COMMENT} building ${NAME} ...
346
	if [ ! -d ${MACH_WORK}/${NAME} ]
347
	then
348
	    ${COMMENT} creating ${MACH_WORK}/${NAME} ...
349
	    mkdir ${MACH_WORK}/${NAME} || exit 1
350
	fi
351
	cd ${MACH_WORK}/${NAME} || exit 1
352
	EXEC=${MACH_BASE}/bin/${NAME}${EXEC_SUFFIX}
353
	make -f ${SRC}/Makefile CC="${CC} ${CCOPTS}" ${TCCOPTS}\
354
	    BASE=${BASE_DIR} NAME=${EXEC} all || BUILD_OK=false
355
	if [ -f ${EXEC} ]
356
	then
357
	    ${STRIP} ${EXEC}
358
	else
359
	    ${COMMENT} compilation failed ...
360
	    BUILD_OK=false
361
	fi
362
	${COMMENT}
363
    fi
364
 
365
    #
366
    # Copy manual pages
367
    #
368
 
369
    if ${BUILD_COMMON}
370
    then
371
	for SUFFIX in 1 5
372
	do
373
	    for MANPAGE in ${SRC}/*.${SUFFIX}
374
	    do
375
		if [ -f ${MANPAGE} ]
376
		then
377
		    NEWPAGE=${MAN_DIR}/man${SUFFIX}/`basename ${MANPAGE}`
378
		    rm -f ${NEWPAGE}
379
		    cp ${MANPAGE} ${NEWPAGE}
380
		fi
381
	    done
382
	done
383
    fi
384
done
385
 
386
rm -f ${MACH_SED}
387
 
388
 
389
#
390
# BUILD DYNAMIC LINKER
391
#
392
# On some platforms a dynamic linker is required to handle the TDF
393
# initial_value construct (used by C++'s non-constant initialisation etc.).
394
# This is built at this stage.
395
#
396
 
397
if ${BUILD_MACHINE}
398
then
399
    ${COMMENT} building machine dependent components ...
400
    SRC=${BASE_DIR}/src/lib/machines/${MACH_OS}/${MACH_CPU}/src
401
    if [ -f ${SRC}/Makefile ]
402
    then
403
	cd ${MACH_BASE}/lib/sys || exit 1
404
	make -f ${SRC}/Makefile CC="${CC} ${CCOPTS}" ${TCCOPTS}\
405
	    BASE=${BASE_DIR} pre || BUILD_OK=false
406
	${COMMENT}
407
    fi
408
fi
409
 
410
 
411
#
412
# INSTALL ENVIRONMENTS
413
#
414
# The user interfaces to the TenDRA compiler, tcc and tchk, use configuration
415
# files called environments to configure them to the particular details of
416
# the platform on which they are installed (including where the private
417
# executables, libraries etc. are to be found).  If the release is moved
418
# then only the environments need to be re-installed, by setting BUILD_UPDATE
419
# to true, but BUILD_COMMON and BUILD_MACHINE to false.
420
#
421
 
422
if ${BUILD_UPDATE}
423
then
424
    ${COMMENT} installing tcc environments ...
425
 
426
    ENV_SED=${TEMP_DIR}/env$$.sed
427
    cat > ${ENV_SED} << EOF
428
1,\$s%-MACH-%${MACH_OS}/${MACH_CPU}%g
429
1,\$s%-MACHDIR-%${MACH_BASE}%g
430
1,\$s%-BINDIR-%${MACH_BASE}/bin%g
431
1,\$s%-ENVDIR-%${MACH_BASE}/env%g
432
1,\$s%-LIBDIR-%${MACH_BASE}/lib%g
433
1,\$s%-INCLDIR-%${COMMON_DIR}/include%g
434
1,\$s%-STARTUPDIR-%${COMMON_DIR}/startup%g
435
1,\$s%-TMPDIR-%${TEMP_DIR}%g
436
EOF
437
 
438
    cd ${MACH_BASE}/env || exit 1
439
    SRC=${BASE_DIR}/src/lib/env
440
    ENVIRON_DIRS="${SRC}/common\
441
		  ${SRC}/${MACH_OS}/common/common\
442
		  ${SRC}/${MACH_OS}/common/${MACH_CPU}\
443
		  ${SRC}/${MACH_OS}/${MACH_EXEC}/common\
444
		  ${SRC}/${MACH_OS}/${MACH_EXEC}/${MACH_CPU}\
445
		  ${SRC}/${MACH_OS}/${MACH_VERS}/common\
446
		  ${SRC}/${MACH_OS}/${MACH_VERS}/${MACH_CPU}"
447
 
448
    for DIR in ${ENVIRON_DIRS}
449
    do
450
	if [ -d ${DIR} ]
451
	then
452
	    for ENVFILE in ${DIR}/*
453
	    do
454
		if [ -f ${ENVFILE} ]
455
		then
456
		    NEWFILE=`basename ${ENVFILE}`
457
		    ${COMMENT} ${ENVFILE} '->' ${NEWFILE}
458
		    rm -f ${NEWFILE}
459
		    sed -f ${ENV_SED} ${ENVFILE} > ${NEWFILE}
460
		fi
461
	    done
462
	fi
463
    done
464
 
465
    ${COMMENT} default.extra '>>' default
466
    rm -f default.new
467
    cat default default.extra > default.new
468
    rm -f default
469
    mv default.new default
470
    rm -f ${ENV_SED}
471
    ${COMMENT}
472
fi
473
 
474
 
475
#
476
# INSTALL WRAPPER FUNCTIONS
477
#
478
# The public executables are actually wrapper scripts which call the
479
# actual programs from the private executables directory with the appropriate
480
# configuration options.
481
#
482
 
483
if ${BUILD_UPDATE}
484
then
485
    ${COMMENT} installing tcc ...
486
    rm -f ${PUBLIC_BIN}/tcc
487
    cat > ${PUBLIC_BIN}/tcc << EOF
488
#!/bin/sh
489
exec ${MACH_BASE}/bin/tcc1${EXEC_SUFFIX} -Y${MACH_BASE}/env/default \${@+"\$@"}
490
EOF
491
    chmod +x ${PUBLIC_BIN}/tcc
492
    ${COMMENT}
493
 
494
    ${COMMENT} installing tchk ...
495
    rm -f ${PUBLIC_BIN}/tchk
496
    cat > ${PUBLIC_BIN}/tchk << EOF
497
#!/bin/sh
498
exec ${MACH_BASE}/bin/tcc1${EXEC_SUFFIX} -Y${MACH_BASE}/env/default -ch \${@+"\$@"}
499
EOF
500
    chmod +x ${PUBLIC_BIN}/tchk
501
    ${COMMENT}
502
 
503
    ${COMMENT} installing tspec ...
504
    rm -f ${PUBLIC_BIN}/tspec
505
    cat > ${PUBLIC_BIN}/tspec << EOF
506
#!/bin/sh
507
TSPEC_INPUT=${BASE_DIR}/src/lib/apis
508
TSPEC_INCL_OUTPUT=${COMMON_DIR}/include
509
TSPEC_SRC_OUTPUT=${COMMON_DIR}/building
510
export TSPEC_INPUT TSPEC_INCL_OUTPUT TSPEC_SRC_OUTPUT
511
exec ${MACH_BASE}/bin/tspec1${EXEC_SUFFIX} \${@+"\$@"}
512
EOF
513
    chmod +x ${PUBLIC_BIN}/tspec
514
    ${COMMENT}
515
fi
516
 
517
 
518
#
519
# INSTALL START-UP FILES
520
#
521
# The machine independent compiler configuration files are installed
522
# (cp -r would do as well as tar, but not all machines support it).
523
#
524
 
525
if ${BUILD_COMMON}
526
then
527
    ${COMMENT} installing start-up files ...
528
    cd ${BASE_DIR}/src/lib || exit 1
529
    rm -f ${MACH_WORK}/startup.tar
530
    tar cvf ${MACH_WORK}/startup.tar startup
531
    cd ${COMMON_DIR} || exit 1
532
    rm -rf startup
533
    tar xvf ${MACH_WORK}/startup.tar
534
    rm -f ${MACH_WORK}/startup.tar
535
    ${COMMENT}
536
fi
537
 
538
 
539
#
540
# INSTALL API DESCRIPTIONS
541
#
542
# The TenDRA API descriptions for the various supported APIs are installed
543
# using the tspec executable built above.  The list of APIs is given in a
544
# separate file, APIS.
545
#
546
 
547
if ${BUILD_COMMON}
548
then
549
    for API in `cat ${BASE_DIR}/src/build/APIS`
550
    do
551
	${COMMENT} installing API ${API} ...
552
	${PUBLIC_BIN}/tspec -w -v ${API}
553
	${COMMENT} all done
554
	${COMMENT}
555
    done
556
fi
557
 
558
 
559
#
560
# INSTALL MACHINE DEPENDENT HEADERS
561
#
562
# The machine dependent include files and configuration files are now
563
# installed.  These are used in particular during TDF API library building
564
# and when the compiler is configured to use the system headers.
565
#
566
 
567
if ${BUILD_MACHINE}
568
then
569
    ${COMMENT} installing machine dependent headers ...
570
    SRC=${BASE_DIR}/src/lib/machines/${MACH_OS}/${MACH_CPU}
571
    if [ -d ${SRC} ]
572
    then
573
	cd ${SRC} || exit 1
574
	rm -f ${MACH_WORK}/machine.tar
575
	tar cvf ${MACH_WORK}/machine.tar include startup
576
	cd ${MACH_BASE} || exit 1
577
	rm -rf include
578
	rm -rf startup
579
	tar xvf ${MACH_WORK}/machine.tar
580
	rm -f ${MACH_WORK}/machine.tar
581
	cp ${MACH_HEADER} startup/machine.h
582
    fi
583
    ${COMMENT}
584
fi
585
rm -f ${MACH_HEADER}
586
 
587
 
588
#
589
# BUILD MACHINE DEPENDENT COMPONENTS
590
#
591
# Any machine dependent libraries etc. are now built.  This includes the
592
# basic TDF token definitions which describe the machine to the compiler.
593
#
594
 
595
if ${BUILD_MACHINE}
596
then
597
    ${COMMENT} building machine dependent components ...
598
    SRC=${BASE_DIR}/src/lib/machines/${MACH_OS}/${MACH_CPU}/src
599
    if [ -f ${SRC}/Makefile ]
600
    then
601
	cd ${MACH_BASE}/lib/sys || exit 1
602
	make -f ${SRC}/Makefile CC="${CC} ${CCOPTS}" ${TCCOPTS}\
603
	    BASE=${BASE_DIR} all || BUILD_OK=false
604
    fi
605
    ${COMMENT}
606
fi
607
 
608
 
609
#
610
# BUILD API LIBRARIES
611
#
612
# And now the tricky bit.  The TDF API libraries are built from the TenDRA
613
# API descriptions and the implementation of the API as described in the
614
# system headers.
615
#
616
# Although this has been tested to the operating system versions listed
617
# in the supported platforms section of the release notes, it is possible
618
# that it may fail for other operating system versions.  Provided the
619
# ansi library builds, you have enough to play with, but to get other
620
# libraries through, you may need to modify the machine dependent include
621
# and start-up files in src/lib/machines/<os>/<cpu>, using the existing
622
# files as a template.  If you get really stuck; you've read all the
623
# documentation, and looked at all what I've done in similar circumstances,
624
# you can email me (Rob) at the address on the web page, but make this a
625
# last resort - I do have other things to do.
626
#
627
# Note that each library is built twice, firstly without diagnostic
628
# information and secondly with.  Really only the ones with diagnostics
629
# are required (the diagnostic information is ignored if not needed),
630
# but building both is traditional.
631
#
632
 
633
DIAG_MSG=
634
DIAG_CC=tcc
635
 
636
for LIBDIR in lib lib/diag
637
do
638
 
639
    #
640
    # Build basic token definitions
641
    #
642
 
643
    if ${BUILD_MACHINE}
644
    then
645
	${COMMENT} building basic C token definitions${DIAG_MSG} ...
646
	if [ ! -d ${MACH_WORK}/${LIBDIR} ]
647
	then
648
	    ${COMMENT} creating ${MACH_WORK}/${LIBDIR} ...
649
	    mkdir ${MACH_WORK}/${LIBDIR} || exit 1
650
	fi
651
	for API in `cat ${BASE_DIR}/src/build/APIS` ansi cpp
652
	do
653
	    API_NAME=`echo ${API} | sed -e 's%/%_%g'`
654
	    if [ ! -d ${MACH_WORK}/${LIBDIR}/${API_NAME} ]
655
	    then
656
		${COMMENT} creating ${MACH_WORK}/${LIBDIR}/${API_NAME} ...
657
		mkdir ${MACH_WORK}/${LIBDIR}/${API_NAME} || exit 1
658
	    fi
659
	done
660
 
661
	SRC=${BASE_DIR}/src/lib/machines/${MACH_OS}/${MACH_CPU}/tokens
662
	if [ -d ${SRC} ]
663
	then
664
	    cd ${MACH_WORK}/${LIBDIR}/ansi || exit 1
665
	    make -f ${SRC}/Makefile TCC="${DIAG_CC}" BASE=${BASE_DIR}\
666
		basic || BUILD_OK=false
667
	fi
668
	${COMMENT}
669
 
670
	SRC=${BASE_DIR}/src/lib/cpp/tokens
671
	if [ -d ${SRC} ]
672
	then
673
	    ${COMMENT} building basic C++ token definitions${DIAG_MSG} ...
674
	    cd ${MACH_WORK}/${LIBDIR}/cpp || exit 1
675
	    make -f ${SRC}/Makefile TCC="${DIAG_CC}" BASE=${BASE_DIR}\
676
		all || BUILD_OK=false
677
	    ${COMMENT}
678
	fi
679
    fi
680
 
681
 
682
    #
683
    # Build API token libraries
684
    #
685
 
686
    if ${BUILD_MACHINE}
687
    then
688
	cd ${MACH_WORK}/${LIBDIR} || exit 1
689
	for API in `cat ${BASE_DIR}/src/build/APIS`
690
	do
691
	    API_NAME=`echo ${API} | sed -e 's%/%_%g'`
692
	    SRC=${COMMON_DIR}/building/${API}.api
693
	    if [ -d ${SRC} ]
694
	    then
695
		${COMMENT} building ${API} API token library${DIAG_MSG} ...
696
		rm -f ${API_NAME}/Makefile
697
		cat > ${API_NAME}/Makefile << EOF
698
BASE=${MACH_BASE}
699
LIB=\${BASE}/${LIBDIR}/${API_NAME}.tl
700
SRC=${COMMON_DIR}/building
701
STARTUP=\${BASE}/startup
702
WORK=.
703
TLIB=tld -mc
704
TDI=${DIAG_CC} -Fj -Ybuilding -Y32bit -I\${BASE}/include ${SYS_INCLUDES}
705
TDP=echo
706
EOF
707
		cat ${SRC}/Makefile >> ${API_NAME}/Makefile
708
		if [ -f ${MACH_BASE}/startup/${API_NAME}.h ]
709
		then
710
		    make -f ${API_NAME}/Makefile all || BUILD_OK=false
711
		else
712
		    ${COMMENT} skipped
713
		fi
714
		${COMMENT}
715
	    fi
716
	done
717
    fi
718
 
719
 
720
    #
721
    # Build TDF standard token library
722
    #
723
 
724
    if ${BUILD_MACHINE}
725
    then
726
	SRC=${BASE_DIR}/src/lib/machines/${MACH_OS}/${MACH_CPU}/tokens
727
	if [ -d ${SRC} ]
728
	then
729
	    ${COMMENT} building TDF standard token library${DIAG_MSG} ...
730
	    LIB=${MACH_BASE}/${LIBDIR}/target_tok.tl
731
	    cd ${MACH_WORK}/${LIBDIR}/ansi || exit 1
732
	    make -f ${SRC}/Makefile LIB=${LIB} TCC="${DIAG_CC}"\
733
		BASE=${BASE_DIR} all || BUILD_OK=false
734
	    ${COMMENT}
735
	fi
736
    fi
737
 
738
 
739
    #
740
    # Now build with diagnostics
741
    #
742
 
743
    DIAG_MSG=" (with diagnostics)"
744
    DIAG_CC="tcc -g"
745
done
746
 
747
 
748
#
749
# BUILD SUPPORT LIBRARIES
750
#
751
# The support libraries are now built.  The list of libraries to be built
752
# is stored in a separate file, LIBRARIES.  It bears repeating that the
753
# C++ support library only contains the minimum language support features.
754
#
755
 
756
if ${BUILD_MACHINE}
757
then
758
    SRC=${BASE_DIR}/src/lib/machines/common/src
759
    if [ -f ${SRC}/Makefile ]
760
    then
761
	${COMMENT} building crtp_n.o ...
762
	cd ${MACH_BASE}/lib/sys || exit 1
763
	make -f ${SRC}/Makefile BASE=${BASE_DIR} all || BUILD_OK=false
764
	${COMMENT}
765
    fi
766
    for PROG in `cat ${BASE_DIR}/src/build/LIBRARIES`
767
    do
768
	NAME=`echo ${PROG} | sed -e 's/:.*//'`
769
	SRC=${BASE_DIR}/src/`echo ${PROG} | sed -e 's/.*://'`
770
	if [ -f ${SRC}/Makefile ]
771
	then
772
	    ${COMMENT} building ${NAME} ...
773
	    if [ ! -d ${MACH_WORK}/${NAME} ]
774
	    then
775
		${COMMENT} creating ${MACH_WORK}/${NAME} ...
776
		mkdir ${MACH_WORK}/${NAME} || exit 1
777
	    fi
778
	    cd ${MACH_WORK}/${NAME} || exit 1
779
	    LIB=${MACH_BASE}/lib/sys/lib${NAME}.a
780
	    make -f ${SRC}/Makefile BASE=${BASE_DIR} NAME=${LIB}\
781
		MACHOPTS="${LIBOPTS}" RANLIB="${RANLIB}" all || BUILD_OK=false
782
	    if [ ! -f ${LIB} ]
783
	    then
784
		${COMMENT} compilation failed ...
785
		BUILD_OK=false
786
	    fi
787
	    ${COMMENT}
788
	fi
789
    done
790
fi
791
 
792
 
793
#
794
# END OF INSTALLATION SCRIPT
795
#
796
# Phew!
797
#
798
 
799
if ${BUILD_OK}
800
then
801
    ${COMMENT} installation completed successfully
802
else
803
    ${COMMENT} installation completed with errors
804
fi
805
exit 0