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

Revision 20256, 7.1 KB checked in by ghudson, 20 years ago (diff)
Add system type for RHEL 3. Tighten up match strings for RH 7.3 and RH 9. Actually abort on unrecognized Red Hat releases.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2# $Id: do.sh,v 1.81 2004-03-09 18:24:04 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.9 sun4"*)
56  ATHENA_SYS=sun4x_59
57  ATHENA_SYS_COMPAT=sun4x_58:sun4x_57:sun4x_56:sun4x_55:sun4m_54:sun4m_53
58  ATHENA_SYS_COMPAT=${ATHENA_SYS_COMPAT}:sun4m_412
59  ;;
60"SunOS 5.8 sun4"*)
61  ATHENA_SYS=sun4x_58
62  ATHENA_SYS_COMPAT=sun4x_57:sun4x_56:sun4x_55:sun4m_54:sun4m_53:sun4m_412
63  ;;
64"SunOS 5.7 sun4"*)
65  ATHENA_SYS=sun4x_57
66  ATHENA_SYS_COMPAT=sun4x_56:sun4x_55:sun4m_54:sun4m_53:sun4m_412
67  ;;
68"SunOS 5.6 sun4"*)
69  ATHENA_SYS=sun4x_56
70  ATHENA_SYS_COMPAT=sun4x_55:sun4m_54:sun4m_53:sun4m_412
71  ;;
72"SunOS 5.5 sun4"*)
73  ATHENA_SYS=sun4x_55
74  ATHENA_SYS_COMPAT=sun4m_54:sun4m_53:sun4m_412
75  ;;
76"SunOS 5.4 sun4"*)
77  ATHENA_SYS=sun4m_54
78  ATHENA_SYS_COMPAT=sun4m_53:sun4m_412
79  ;;
80Linux\ 2.2.*\ i?86)
81  ATHENA_SYS=i386_linux22
82  ATHENA_SYS_COMPAT=i386_linux3:i386_linux2:i386_linux1
83  ;;
84Linux\ 2.4.*\ i?86)
85  case `cat /etc/redhat-release` in
86  "Red Hat Linux release 7.3 "*)
87    ATHENA_SYS=i386_linux24
88    ATHENA_SYS_COMPAT=i386_linux22:i386_linux3:i386_linux2:i386_linux1
89    ;;
90  "Red Hat Linux release 9 "*)
91    ATHENA_SYS=i386_rh9
92    ATHENA_SYS_COMPAT=i386_linux24:i386_linux22:i386_linux3:i386_linux2
93    ATHENA_SYS_COMPAT=${ATHENA_SYS_COMPAT}:i386_linux1
94    ;;
95  "Red Hat Enterprise Linux"*"release 3"*)
96    ATHENA_SYS=i386_rhel3
97    ATHENA_SYS_COMPAT=i386_rh9:i386_linux24:i386_linux22:i386_linux3
98    ATHENA_SYS_COMPAT=${ATHENA_SYS_COMPAT}:i386_linux2:i386_linux1
99    ;;
100  *)
101    echo "Unrecognized Red Hat release, aborting." 1>&2
102    exit 1
103    ;;
104  esac
105  ;;
106*)
107  echo "Unrecognized system type, aborting." 1>&2
108  exit 1
109  ;;
110esac
111
112# Determine platform name.
113case `uname -sm` in
114"SunOS sun4"*)
115  ATHENA_HOSTTYPE=sun4
116  ;;
117"Linux "i?86)
118  ATHENA_HOSTTYPE=linux
119  ;;
120esac
121
122savepath=$PATH
123
124# Determine operating system, appropriate path, and compiler for use
125# with plain Makefiles and some third-party packages.
126case `uname -s` in
127SunOS)
128  OS=solaris
129  LD_LIBRARY_PATH=/usr/openwin/lib export LD_LIBRARY_PATH
130  LD_RUN_PATH=/usr/athena/lib:/usr/openwin/lib export LD_RUN_PATH
131  PATH=/usr/ccs/bin:/usr/bin:/usr/ucb:/usr/openwin/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
178# GConf schemas need to be installed from RPM %post scriptlets, not
179# make install rules.
180GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
181export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
182
183# On Linux, we use the native pkg-config, which needs to be able to
184# find our libraries.
185PKG_CONFIG_PATH=/usr/athena/lib/pkgconfig
186export PKG_CONFIG_PATH
187
188if [ -r Makefile.athena ]; then
189  export SRVD SOURCE COMPILER
190  SRVD=$srvd
191  SOURCE=$source
192  COMPILER=$CC
193  if [ dist = "$operation" ]; then
194    export CONFIG_SITE XCONFIGDIR
195    CONFIG_SITE=$source/packs/build/config.site
196    XCONFIGDIR=$source/packs/build/xconfig
197  fi
198  $MAKE $n -f Makefile.athena "$operation"
199elif [ -f configure.in -o -f configure.ac -o -f configure ]; then
200  if [ -f configure.athena ]; then
201    configure=configure.athena
202  else
203    configure=configure
204  fi
205  case $operation in
206  dist)
207    # Copy in support files and run autoconf if this is a directory using the
208    # Athena build system.
209    if [ -f config.do -o ! -f configure ]; then
210      $maybe touch config.do
211      $maybe rm -f mkinstalldirs install-sh config.guess
212      $maybe rm -f config.sub aclocal.m4
213      $maybe cp "$source/packs/build/autoconf/mkinstalldirs" .
214      $maybe cp "$source/packs/build/autoconf/install-sh" .
215      $maybe cp "$source/packs/build/autoconf/config.guess" .
216      $maybe cp "$source/packs/build/autoconf/config.sub" .
217      $maybe cp "$source/packs/build/aclocal.m4" .
218      $maybe cat "$source/packs/build/libtool/libtool.m4" >> aclocal.m4
219      $maybe cp "$source/packs/build/libtool/ltmain.sh" .
220      $maybe autoconf || exit 1
221    fi
222    $maybe cp "$source/packs/build/config.site" config.site.athena
223    ;;
224  prepare)
225    $maybe rm -f config.cache
226    CONFIG_SITE=`pwd`/config.site.athena $maybe "./$configure"
227  ;;
228  clean)
229    $MAKE $n clean
230    ;;
231  all)
232    $MAKE $n all
233    ;;
234  check)
235    $MAKE -n check >/dev/null 2>&1 && $MAKE $n check || true
236    ;;
237  install)
238    $MAKE $n install "DESTDIR=$srvd"
239    ;;
240  esac
241elif [ -r Imakefile ]; then
242  case $operation in
243  dist)
244    $maybe mkdir -p config
245    $maybe cp $source/packs/build/xconfig/README config
246    $maybe cp $source/packs/build/xconfig/mkdirhier.sh config
247    $maybe cp $source/packs/build/xconfig/rtcchack.bac config
248    $maybe cp $source/packs/build/xconfig/site.def config
249    $maybe cp $source/packs/build/xconfig/*.cf config
250    $maybe cp $source/packs/build/xconfig/*.rules config
251    $maybe cp $source/packs/build/xconfig/*.tmpl config
252    ;;
253  prepare)
254    $maybe imake "-Iconfig" -DUseInstalled "-DTOPDIR=`pwd`" \
255      "-DXCONFIGDIR=`pwd`/config"
256    $maybe $MAKE Makefiles
257    ;;
258  clean)
259    $MAKE $n clean
260    ;;
261  all)
262    $MAKE $n includes depend all TOP=`pwd` MAKE="$MAKE TOP=`pwd`"
263    ;;
264  check)
265    ;;
266  install)
267    $MAKE $n install install.man "DESTDIR=$srvd" TOP=`pwd` \
268      MAKE="$MAKE TOP=`pwd`"
269    ;;
270  esac
271elif [ -r Makefile ]; then
272  case $operation in
273  dist|prepare)
274    ;;
275  clean)
276    $MAKE $n clean
277    ;;
278  all)
279    $MAKE $n all CC="$CC"
280    ;;
281  check)
282    $MAKE $n check
283    ;;
284  install)
285    $MAKE $n install "DESTDIR=$srvd"
286    ;;
287  esac
288else
289  echo Nothing to do in `pwd` 1>&2
290  exit 1
291fi
Note: See TracBrowser for help on using the repository browser.