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

Revision 18485, 6.5 KB checked in by ghudson, 21 years ago (diff)
Tweak recognition tests so that hand-written configure scripts are built using the configure rules.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2# $Id: do.sh,v 1.75 2003-01-24 00:53:19 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  ;;
75"IRIX 5.3 "*)
76  ATHENA_SYS=sgi_53
77  ATHENA_SYS_COMPAT=sgi_52
78  ;;
79"IRIX 6.2 "*)
80  ATHENA_SYS=sgi_62
81  ATHENA_SYS_COMPAT=sgi_53:sgi_52
82  ;;
83"IRIX 6.3 "*)
84  ATHENA_SYS=sgi_63
85  ATHENA_SYS_COMPAT=sgi_62:sgi_53:sgi_52
86  ;;
87"IRIX 6.5 "*)
88  ATHENA_SYS=sgi_65
89  ATHENA_SYS_COMPAT=sgi_63:sgi_62:sgi_53:sgi_52
90  ;;
91Linux\ 2.2.*\ i?86)
92  ATHENA_SYS=i386_linux22
93  ATHENA_SYS_COMPAT=i386_linux3:i386_linux2:i386_linux1
94  ;;
95Linux\ 2.4.*\ i?86)
96  ATHENA_SYS=i386_linux24
97  ATHENA_SYS_COMPAT=i386_linux22:i386_linux3:i386_linux2:i386_linux1
98  ;;
99*)
100  echo "Unrecognized system type, aborting." 1>&2
101  exit 1
102  ;;
103esac
104
105# Determine platform name.
106case `uname -sm` in
107"SunOS sun4"*)
108  ATHENA_HOSTTYPE=sun4
109  ;;
110"IRIX "*)
111  ATHENA_HOSTTYPE=sgi
112  ;;
113"Linux "i?86)
114  ATHENA_HOSTTYPE=linux
115  ;;
116esac
117
118savepath=$PATH
119
120# Determine operating system, appropriate path, and compiler for use
121# with plain Makefiles and some third-party packages.
122case `uname -s` in
123SunOS)
124  OS=solaris
125  LD_LIBRARY_PATH=/usr/openwin/lib export LD_LIBRARY_PATH
126  LD_RUN_PATH=/usr/athena/lib:/usr/openwin/lib export LD_RUN_PATH
127  PATH=/usr/ccs/bin:/usr/bin:/usr/ucb:/usr/openwin/bin:/usr/gcc/bin
128  ;;
129IRIX)
130  OS=irix
131  PATH=/usr/bsd:/usr/bin:/usr/bin/X11:/usr/gcc/bin
132  ;;
133Linux)
134  OS=linux
135  LD_RUN_PATH=/usr/athena/lib export LD_RUN_PATH
136  PATH=/usr/bin:/bin:/usr/X11R6/bin
137  ;;
138esac
139CC=gcc
140CXX=g++
141WARN_CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes"
142ERROR_CFLAGS=-Werror
143PATH=/usr/athena/bin:$PATH
144
145if [ false = "$mungepath" ]; then
146  PATH=$savepath
147fi
148
149if [ dist = "$operation" ]; then
150  # Copy in the version file, for the few packages which need to know
151  # the Athena version.
152  cp $source/packs/build/version athena-version
153
154  # Force all source files to the same timestamp, to prevent third-party
155  # build systems from thinking some are out of date with respect to others.
156  find . ! -type l -exec touch -t `date +%Y%m%d%H%M.%S` {} \;
157fi
158
159# Determine the Athena version and set variables for the build system.
160. ./athena-version
161ATHENA_MAJOR_VERSION=$major
162ATHENA_MINOR_VERSION=$minor
163if [ -z "$ATHENA_PATCH_VERSION" ]; then
164  ATHENA_PATCH_VERSION=$patch
165fi
166export ATHENA_MAJOR_VERSION ATHENA_MINOR_VERSION ATHENA_PATCH_VERSION
167
168# Determine if gmake is available. (It should be, unless this is a
169# full build and we haven't built it yet.)
170if [ -x /usr/athena/bin/gmake ]; then
171  MAKE=gmake
172else
173  MAKE=make
174fi
175
176export WARN_CFLAGS ERROR_CFLAGS CC CXX MAKE
177
178if [ -r Makefile.athena ]; then
179  export SRVD SOURCE COMPILER
180  SRVD=$srvd
181  SOURCE=$source
182  COMPILER=$CC
183  if [ dist = "$operation" ]; then
184    export CONFIG_SITE XCONFIGDIR
185    CONFIG_SITE=$source/packs/build/config.site
186    XCONFIGDIR=$source/packs/build/xconfig
187  fi
188  $MAKE $n -f Makefile.athena "$operation"
189elif [ -f configure.in -o -f configure.ac -o -f configure ]; then
190  if [ -f configure.athena ]; then
191    configure=configure.athena
192  else
193    configure=configure
194  fi
195  case $operation in
196  dist)
197    # Copy in support files and run autoconf if this is a directory using the
198    # Athena build system.
199    if [ -f config.do -o ! -f configure ]; then
200      $maybe touch config.do
201      $maybe rm -f mkinstalldirs install-sh config.guess
202      $maybe rm -f config.sub aclocal.m4
203      $maybe cp "$source/packs/build/autoconf/mkinstalldirs" .
204      $maybe cp "$source/packs/build/autoconf/install-sh" .
205      $maybe cp "$source/packs/build/autoconf/config.guess" .
206      $maybe cp "$source/packs/build/autoconf/config.sub" .
207      $maybe cp "$source/packs/build/aclocal.m4" .
208      $maybe cat "$source/packs/build/libtool/libtool.m4" >> aclocal.m4
209      $maybe cp "$source/packs/build/libtool/ltmain.sh" .
210      $maybe autoconf || exit 1
211    fi
212    $maybe cp "$source/packs/build/config.site" config.site.athena
213    ;;
214  prepare)
215    $maybe rm -f config.cache
216    CONFIG_SITE=`pwd`/config.site.athena $maybe "./$configure"
217  ;;
218  clean)
219    $MAKE $n clean
220    ;;
221  all)
222    $MAKE $n all
223    ;;
224  check)
225    $MAKE -n check >/dev/null 2>&1 && $MAKE $n check || true
226    ;;
227  install)
228    $MAKE $n install "DESTDIR=$srvd"
229    ;;
230  esac
231elif [ -r Imakefile ]; then
232  case $operation in
233  dist)
234    $maybe mkdir -p config
235    $maybe cp $source/packs/build/xconfig/README config
236    $maybe cp $source/packs/build/xconfig/mkdirhier.sh config
237    $maybe cp $source/packs/build/xconfig/rtcchack.bac config
238    $maybe cp $source/packs/build/xconfig/site.def config
239    $maybe cp $source/packs/build/xconfig/*.cf config
240    $maybe cp $source/packs/build/xconfig/*.rules config
241    $maybe cp $source/packs/build/xconfig/*.tmpl config
242    ;;
243  prepare)
244    $maybe imake "-Iconfig" -DUseInstalled "-DTOPDIR=`pwd`" \
245      "-DXCONFIGDIR=`pwd`/config"
246    $maybe $MAKE Makefiles
247    ;;
248  clean)
249    $MAKE $n clean
250    ;;
251  all)
252    $MAKE $n includes depend all TOP=`pwd` MAKE="$MAKE TOP=`pwd`"
253    ;;
254  check)
255    ;;
256  install)
257    $MAKE $n install install.man "DESTDIR=$srvd" TOP=`pwd` \
258      MAKE="$MAKE TOP=`pwd`"
259    ;;
260  esac
261elif [ -r Makefile ]; then
262  case $operation in
263  dist|prepare)
264    ;;
265  clean)
266    $MAKE $n clean
267    ;;
268  all)
269    $MAKE $n all CC="$CC"
270    ;;
271  check)
272    $MAKE $n check
273    ;;
274  install)
275    $MAKE $n install "DESTDIR=$srvd"
276    ;;
277  esac
278else
279  echo Nothing to do in `pwd` 1>&2
280  exit 1
281fi
Note: See TracBrowser for help on using the repository browser.