1 | #!/bin/sh |
---|
2 | # $Id: do.sh,v 1.17 1998-01-17 03:09:47 ghudson Exp $ |
---|
3 | |
---|
4 | source="/mit/source" |
---|
5 | srvd="/srvd" |
---|
6 | contained=false |
---|
7 | n="" |
---|
8 | maybe="" |
---|
9 | usage="do [-cn] [-s srcdir] [-d destdir] [prepare|clean|all|check|install]" |
---|
10 | |
---|
11 | while getopts cd:ns: opt; do |
---|
12 | case "$opt" in |
---|
13 | c) |
---|
14 | contained=true |
---|
15 | ;; |
---|
16 | d) |
---|
17 | srvd="$OPTARG" |
---|
18 | ;; |
---|
19 | n) |
---|
20 | n="-n" |
---|
21 | maybe="echo" |
---|
22 | ;; |
---|
23 | s) |
---|
24 | source="$OPTARG" |
---|
25 | ;; |
---|
26 | \?) |
---|
27 | echo "$usage" |
---|
28 | exit 1 |
---|
29 | ;; |
---|
30 | esac |
---|
31 | done |
---|
32 | shift `expr $OPTIND - 1` |
---|
33 | operation=${1-all} |
---|
34 | |
---|
35 | case "$contained" in |
---|
36 | true) |
---|
37 | athtoolroot="$srvd" |
---|
38 | ;; |
---|
39 | false) |
---|
40 | athtoolroot="" |
---|
41 | ;; |
---|
42 | esac |
---|
43 | |
---|
44 | # Set up the build environment. |
---|
45 | umask 022 |
---|
46 | export ATHENA_SYS HOSTTYPE CONFIG_SITE PATH |
---|
47 | CONFIG_SITE=$source/packs/build/config.site |
---|
48 | |
---|
49 | # Determine proper ATHENA_SYS value. |
---|
50 | case "`uname -srm`" in |
---|
51 | SunOS*5.5*sun4*) ATHENA_SYS=sun4x_55 ;; |
---|
52 | SunOS*5.4*sun4*) ATHENA_SYS=sun4m_54 ;; |
---|
53 | IRIX*5.3*) ATHENA_SYS=sgi_53 ;; |
---|
54 | IRIX*6.2*) ATHENA_SYS=sgi_62 ;; |
---|
55 | IRIX*6.3*) ATHENA_SYS=sgi_63 ;; |
---|
56 | esac |
---|
57 | |
---|
58 | # Determine platform type, appropriate path, and compiler for use with plain |
---|
59 | # Makefiles and some third-party packages. |
---|
60 | case "`uname -sm`" in |
---|
61 | SunOS*sun4*) |
---|
62 | HOSTTYPE=sun4 |
---|
63 | LD_LIBRARY_PATH=/usr/openwin/lib export LD_LIBRARY_PATH |
---|
64 | PATH=/usr/ccs/bin:$athtoolroot/usr/athena/bin:/usr/bin:/usr/ucb |
---|
65 | PATH=${PATH}:/usr/openwin/bin |
---|
66 | compiler="/usr/gcc/bin/gcc -DSOLARIS" |
---|
67 | ;; |
---|
68 | IRIX*) |
---|
69 | HOSTTYPE=sgi |
---|
70 | PATH=$athtoolroot/usr/athena/bin:/usr/bsd:/usr/bin:/usr/bin/X11 |
---|
71 | compiler=cc |
---|
72 | ;; |
---|
73 | esac |
---|
74 | |
---|
75 | if [ -r Makefile.athena ]; then |
---|
76 | export SRVD SOURCE COMPILER CONFIGDIR XCONFIGDIR ATHTOOLROOT |
---|
77 | SRVD="$srvd" |
---|
78 | SOURCE="$source" |
---|
79 | COMPILER="$compiler" |
---|
80 | CONFIGDIR="$source/packs/build/config" |
---|
81 | XCONFIGDIR="$source/packs/build/xconfig" |
---|
82 | ATHTOOLROOT="$athtoolroot" |
---|
83 | make $n -f Makefile.athena "$operation" |
---|
84 | elif [ -x ./configure ]; then |
---|
85 | export ATHTOOLROOT |
---|
86 | ATHTOOLROOT="$athtoolroot" |
---|
87 | case "$operation" in |
---|
88 | prepare) $maybe rm -f config.cache |
---|
89 | $maybe ./configure ;; |
---|
90 | clean) make $n clean ;; |
---|
91 | all) make $n all ;; |
---|
92 | check) ;; |
---|
93 | install) make $n install "DESTDIR=$srvd" ;; |
---|
94 | esac |
---|
95 | elif [ -r Imakefile ]; then |
---|
96 | case "$operation" in |
---|
97 | prepare) |
---|
98 | $maybe imake "-I$source/packs/build/config" \ |
---|
99 | -DUseInstalled "-DTOPDIR=$source/packs/build" \ |
---|
100 | "-DTOOLROOT=$athtoolroot" |
---|
101 | $maybe make Makefiles |
---|
102 | $maybe make depend |
---|
103 | ;; |
---|
104 | clean) make $n clean ;; |
---|
105 | all) make $n all ;; |
---|
106 | check) ;; |
---|
107 | install) make $n install install.man "DESTDIR=$srvd" ;; |
---|
108 | esac |
---|
109 | elif [ -r Makefile ]; then |
---|
110 | case "$operation" in |
---|
111 | prepare) ;; |
---|
112 | clean) make $n clean "ATHTOOLROOT=$athtoolroot";; |
---|
113 | all) make $n all CC="$compiler" \ |
---|
114 | "ATHTOOLROOT=$athtoolroot";; |
---|
115 | check) ;; |
---|
116 | install) make $n install "DESTDIR=$srvd" \ |
---|
117 | "ATHTOOLROOT=$athtoolroot";; |
---|
118 | esac |
---|
119 | fi |
---|