source: trunk/packs/build/do.sh @ 18490

Revision 18490, 6.0 KB checked in by ghudson, 21 years ago (diff)
Remove references to /usr/gcc and in some cases to IRIX.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2# $Id: do.sh,v 1.76 2003-01-24 19:45:01 ghudson Exp $
3
4source=/mit/source
5srvd=/.srvd
6contained=false
7mungepath=true
8n=""
9maybe=""
10
11usage() {
12  echo "Usage: do [-np] [-s srcdir] [-d destdir]" 1>&2
13  echo "        [dist|prepare|clean|all|check|install]" 1>&2
14  exit 1
15}
16
17while getopts pd:ns: opt; do
18  case "$opt" in
19  p)
20    mungepath=false
21    ;;
22  d)
23    srvd=$OPTARG
24    ;;
25  n)
26    n=-n
27    maybe=echo
28    ;;
29  s)
30    source=$OPTARG
31    ;;
32  \?)
33    usage
34    ;;
35  esac
36done
37shift `expr "$OPTIND" - 1`
38operation=${1-all}
39
40case "$operation" in
41dist|prepare|clean|all|check|install)
42  ;;
43*)
44  echo Unknown operation \"$operation\" 1>&2
45  usage
46  ;;
47esac
48
49# Set up the build environment.
50umask 022
51export ATHENA_SYS ATHENA_SYS_COMPAT ATHENA_HOSTTYPE OS PATH
52
53# Determine proper ATHENA_SYS and ATHENA_SYS_COMPAT value.
54case `uname -srm` in
55"SunOS 5.8 sun4"*)
56  ATHENA_SYS=sun4x_58
57  ATHENA_SYS_COMPAT=sun4x_57:sun4x_56:sun4x_55:sun4m_54:sun4m_53:sun4m_412
58  ;;
59"SunOS 5.7 sun4"*)
60  ATHENA_SYS=sun4x_57
61  ATHENA_SYS_COMPAT=sun4x_56:sun4x_55:sun4m_54:sun4m_53:sun4m_412
62  ;;
63"SunOS 5.6 sun4"*)
64  ATHENA_SYS=sun4x_56
65  ATHENA_SYS_COMPAT=sun4x_55:sun4m_54:sun4m_53:sun4m_412
66  ;;
67"SunOS 5.5 sun4"*)
68  ATHENA_SYS=sun4x_55
69  ATHENA_SYS_COMPAT=sun4m_54:sun4m_53:sun4m_412
70  ;;
71"SunOS 5.4 sun4"*)
72  ATHENA_SYS=sun4m_54
73  ATHENA_SYS_COMPAT=sun4m_53:sun4m_412
74  ;;
75Linux\ 2.2.*\ i?86)
76  ATHENA_SYS=i386_linux22
77  ATHENA_SYS_COMPAT=i386_linux3:i386_linux2:i386_linux1
78  ;;
79Linux\ 2.4.*\ i?86)
80  ATHENA_SYS=i386_linux24
81  ATHENA_SYS_COMPAT=i386_linux22:i386_linux3:i386_linux2:i386_linux1
82  ;;
83*)
84  echo "Unrecognized system type, aborting." 1>&2
85  exit 1
86  ;;
87esac
88
89# Determine platform name.
90case `uname -sm` in
91"SunOS sun4"*)
92  ATHENA_HOSTTYPE=sun4
93  ;;
94"Linux "i?86)
95  ATHENA_HOSTTYPE=linux
96  ;;
97esac
98
99savepath=$PATH
100
101# Determine operating system, appropriate path, and compiler for use
102# with plain Makefiles and some third-party packages.
103case `uname -s` in
104SunOS)
105  OS=solaris
106  LD_LIBRARY_PATH=/usr/openwin/lib export LD_LIBRARY_PATH
107  LD_RUN_PATH=/usr/athena/lib:/usr/openwin/lib export LD_RUN_PATH
108  PATH=/usr/ccs/bin:/usr/bin:/usr/ucb:/usr/openwin/bin
109  ;;
110Linux)
111  OS=linux
112  LD_RUN_PATH=/usr/athena/lib export LD_RUN_PATH
113  PATH=/usr/bin:/bin:/usr/X11R6/bin
114  ;;
115esac
116CC=gcc
117CXX=g++
118WARN_CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes"
119ERROR_CFLAGS=-Werror
120PATH=/usr/athena/bin:$PATH
121
122if [ false = "$mungepath" ]; then
123  PATH=$savepath
124fi
125
126if [ dist = "$operation" ]; then
127  # Copy in the version file, for the few packages which need to know
128  # the Athena version.
129  cp $source/packs/build/version athena-version
130
131  # Force all source files to the same timestamp, to prevent third-party
132  # build systems from thinking some are out of date with respect to others.
133  find . ! -type l -exec touch -t `date +%Y%m%d%H%M.%S` {} \;
134fi
135
136# Determine the Athena version and set variables for the build system.
137. ./athena-version
138ATHENA_MAJOR_VERSION=$major
139ATHENA_MINOR_VERSION=$minor
140if [ -z "$ATHENA_PATCH_VERSION" ]; then
141  ATHENA_PATCH_VERSION=$patch
142fi
143export ATHENA_MAJOR_VERSION ATHENA_MINOR_VERSION ATHENA_PATCH_VERSION
144
145# Determine if gmake is available. (It should be, unless this is a
146# full build and we haven't built it yet.)
147if [ -x /usr/athena/bin/gmake ]; then
148  MAKE=gmake
149else
150  MAKE=make
151fi
152
153export WARN_CFLAGS ERROR_CFLAGS CC CXX MAKE
154
155if [ -r Makefile.athena ]; then
156  export SRVD SOURCE COMPILER
157  SRVD=$srvd
158  SOURCE=$source
159  COMPILER=$CC
160  if [ dist = "$operation" ]; then
161    export CONFIG_SITE XCONFIGDIR
162    CONFIG_SITE=$source/packs/build/config.site
163    XCONFIGDIR=$source/packs/build/xconfig
164  fi
165  $MAKE $n -f Makefile.athena "$operation"
166elif [ -f configure.in -o -f configure.ac -o -f configure ]; then
167  if [ -f configure.athena ]; then
168    configure=configure.athena
169  else
170    configure=configure
171  fi
172  case $operation in
173  dist)
174    # Copy in support files and run autoconf if this is a directory using the
175    # Athena build system.
176    if [ -f config.do -o ! -f configure ]; then
177      $maybe touch config.do
178      $maybe rm -f mkinstalldirs install-sh config.guess
179      $maybe rm -f config.sub aclocal.m4
180      $maybe cp "$source/packs/build/autoconf/mkinstalldirs" .
181      $maybe cp "$source/packs/build/autoconf/install-sh" .
182      $maybe cp "$source/packs/build/autoconf/config.guess" .
183      $maybe cp "$source/packs/build/autoconf/config.sub" .
184      $maybe cp "$source/packs/build/aclocal.m4" .
185      $maybe cat "$source/packs/build/libtool/libtool.m4" >> aclocal.m4
186      $maybe cp "$source/packs/build/libtool/ltmain.sh" .
187      $maybe autoconf || exit 1
188    fi
189    $maybe cp "$source/packs/build/config.site" config.site.athena
190    ;;
191  prepare)
192    $maybe rm -f config.cache
193    CONFIG_SITE=`pwd`/config.site.athena $maybe "./$configure"
194  ;;
195  clean)
196    $MAKE $n clean
197    ;;
198  all)
199    $MAKE $n all
200    ;;
201  check)
202    $MAKE -n check >/dev/null 2>&1 && $MAKE $n check || true
203    ;;
204  install)
205    $MAKE $n install "DESTDIR=$srvd"
206    ;;
207  esac
208elif [ -r Imakefile ]; then
209  case $operation in
210  dist)
211    $maybe mkdir -p config
212    $maybe cp $source/packs/build/xconfig/README config
213    $maybe cp $source/packs/build/xconfig/mkdirhier.sh config
214    $maybe cp $source/packs/build/xconfig/rtcchack.bac config
215    $maybe cp $source/packs/build/xconfig/site.def config
216    $maybe cp $source/packs/build/xconfig/*.cf config
217    $maybe cp $source/packs/build/xconfig/*.rules config
218    $maybe cp $source/packs/build/xconfig/*.tmpl config
219    ;;
220  prepare)
221    $maybe imake "-Iconfig" -DUseInstalled "-DTOPDIR=`pwd`" \
222      "-DXCONFIGDIR=`pwd`/config"
223    $maybe $MAKE Makefiles
224    ;;
225  clean)
226    $MAKE $n clean
227    ;;
228  all)
229    $MAKE $n includes depend all TOP=`pwd` MAKE="$MAKE TOP=`pwd`"
230    ;;
231  check)
232    ;;
233  install)
234    $MAKE $n install install.man "DESTDIR=$srvd" TOP=`pwd` \
235      MAKE="$MAKE TOP=`pwd`"
236    ;;
237  esac
238elif [ -r Makefile ]; then
239  case $operation in
240  dist|prepare)
241    ;;
242  clean)
243    $MAKE $n clean
244    ;;
245  all)
246    $MAKE $n all CC="$CC"
247    ;;
248  check)
249    $MAKE $n check
250    ;;
251  install)
252    $MAKE $n install "DESTDIR=$srvd"
253    ;;
254  esac
255else
256  echo Nothing to do in `pwd` 1>&2
257  exit 1
258fi
Note: See TracBrowser for help on using the repository browser.