summaryrefslogtreecommitdiff
path: root/ipl/CheckAll
blob: 0a3da3815abb5cac53a0f9da92f839dadacb4467 (plain)
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
#!/bin/ksh -p
#
#  CheckAll -- Test-build all IPL components and run other sanity checks
#
#  Assumes that there are binaries of Icon in ../bin


#  Combine stderr with stdout so both can be redirected together.
exec 2>&1

#  Set POSIX locale for expected behavior
export LC_ALL=POSIX

#  Move library directory of out implicit search path
#  (and arrange to move it back on exit)
V9=`cd ..; pwd`
mv $V9/lib $V9/libsave
trap 'mv $V9/libsave $V9/lib; exit' 0 1 2 15

#  Set minimal path needed.  (Not all systems have all these directories.)
export PATH=$V9/bin:/usr/xpg4/bin:/usr/ccs/bin:/bin:/usr/bin

#  List timestamp of icont we'll be using
ls -l $V9/bin/icont || exit

#  Use default Icon options
unset BLKSIZE STRSIZE MSTKSIZE COEXPSIZE TRACE NOERRBUF FPATH IPATH LPATH

#  Clean out old versions of compiled procedures
rm -f */*.u[12]

#  Diagnose duplicate filenames among procs and among progs.
#  (We allow one proc and one prog to have the same filename.)
for t in procs progs; do
    ls *$t/*.icn |
    sed 's=.*/==' |
    sort |
    uniq -c |
    grep -v ' 1' |
    while read n f; do
        echo "   DUPLICATE NAME:" *$t/$f
    done
done


#  Start by building procedures, including cfuncs, needed by programs
#  Use only include-files guaranteed to be present with each part of library

(echo cfuncs:; cd cfuncs; LPATH=                            make -s cfunc.u2)
(echo procs:;  cd procs;  LPATH="../incl"                   icont -usc *icn)
(echo gprocs:; cd gprocs; LPATH="../incl ../gincl"          icont -usc *icn)
# (echo mprocs:; cd mprocs; LPATH="../incl ../gincl ../mincl" icont -usc *icn)


#  Check for undeclared identifiers or insufficient links in the core modules.
echo core modules:
(cd procs;  IPATH=         icont -o ../xxx -us -fs core.u2)
(cd gprocs; IPATH=../procs icont -o ../xxx -us -fs graphics.u2)

#  Check linkages for procedure files, ignoring most undeclared identifiers.

IPATH=./cfuncs
rm -f xxx
for d in procs gprocs; do
    export IPATH="$IPATH ./$d"
    echo $d linkage:
    for f in `cd $d; ls *.icn`; do
	b=${f%.icn}
	# allow undeclared identifiers in main() for use with code generators
	(icont -o xxx -us -fs $b.u2 2>&1  ||  echo "   -- failed in $b.u2") |
	    grep -v ': undeclared identifier, procedure main'
    done
done
rm -f xxx


#  Define function for silent compilation, echoing name only on error
function compile {  icont -us $1  ||  echo "   -- failed in $1";  }

#  Build programs from "bipl" portion, using only "bipl" library.
#  (For a better check, should really build using non-graphics version of Icon.)
export LPATH="../incl"
export IPATH="../procs ../cfuncs"
(echo progs:; cd progs;  for f in *.icn; do compile $f; done)

#  Build programs from "gipl" portion of distribution
export LPATH="../incl  ../gincl"
export IPATH="../procs ../cfuncs ../gprocs"
(echo gprogs:; cd gprogs;  for f in *.icn; do compile $f; done)

# Skip mprogs, which requires a specially build MT-Icon version 
# export LPATH="../incl  ../gincl  ../mincl"
# export IPATH="../procs ../cfuncs ../gprocs ../mprocs"
# (echo mprogs:; cd mprogs;  for f in *.icn; do compile $f; done)


#  Test-build all the packages
#  Allow use of graphics within packs, because one loadfunc example needs it

export LPATH="../../incl ../../gincl"
export IPATH="../../cfuncs ../../procs ../../gprocs"
for d in *packs/[a-z]*; do
    echo $d:
    (cd $d; make -s Clean; make -s)
done