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

Revision 21710, 7.4 KB checked in by ghudson, 19 years ago (diff)
Solaris 10 ships with gmake in /usr/sfw/bin. So just use gmake unconditionally; we don't need our own any more.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2# $Id: do.sh,v 1.86 2005-04-07 17:19:07 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.10 sun4"*)
56  ATHENA_SYS=sun4x_510
57  ATHENA_SYS_COMPAT=sun4x_59:sun4x_58:sun4x_57:sun4x_56:sun4x_55:sun4m_54
58  ATHENA_SYS_COMPAT=${ATHENA_SYS_COMPAT}:sun4m_53:sun4m_412
59  ;;
60"SunOS 5.9 sun4"*)
61  ATHENA_SYS=sun4x_59
62  ATHENA_SYS_COMPAT=sun4x_58:sun4x_57:sun4x_56:sun4x_55:sun4m_54:sun4m_53
63  ATHENA_SYS_COMPAT=${ATHENA_SYS_COMPAT}:sun4m_412
64  ;;
65"SunOS 5.8 sun4"*)
66  ATHENA_SYS=sun4x_58
67  ATHENA_SYS_COMPAT=sun4x_57:sun4x_56:sun4x_55:sun4m_54:sun4m_53:sun4m_412
68  ;;
69"SunOS 5.7 sun4"*)
70  ATHENA_SYS=sun4x_57
71  ATHENA_SYS_COMPAT=sun4x_56:sun4x_55:sun4m_54:sun4m_53:sun4m_412
72  ;;
73"SunOS 5.6 sun4"*)
74  ATHENA_SYS=sun4x_56
75  ATHENA_SYS_COMPAT=sun4x_55:sun4m_54:sun4m_53:sun4m_412
76  ;;
77"SunOS 5.5 sun4"*)
78  ATHENA_SYS=sun4x_55
79  ATHENA_SYS_COMPAT=sun4m_54:sun4m_53:sun4m_412
80  ;;
81"SunOS 5.4 sun4"*)
82  ATHENA_SYS=sun4m_54
83  ATHENA_SYS_COMPAT=sun4m_53:sun4m_412
84  ;;
85Linux\ 2.2.*\ i?86)
86  ATHENA_SYS=i386_linux22
87  ATHENA_SYS_COMPAT=i386_linux3:i386_linux2:i386_linux1
88  ;;
89Linux\ 2.4.*\ i?86)
90  case `cat /etc/redhat-release` in
91  "Red Hat Linux release 7.3 "*)
92    ATHENA_SYS=i386_linux24
93    ATHENA_SYS_COMPAT=i386_linux22:i386_linux3:i386_linux2:i386_linux1
94    ;;
95  "Red Hat Linux release 9 "*)
96    ATHENA_SYS=i386_rh9
97    ATHENA_SYS_COMPAT=i386_linux24:i386_linux22:i386_linux3:i386_linux2
98    ATHENA_SYS_COMPAT=${ATHENA_SYS_COMPAT}:i386_linux1
99    ;;
100  "Red Hat Enterprise Linux"*"release 3"*)
101    ATHENA_SYS=i386_rhel3
102    ATHENA_SYS_COMPAT=i386_rh9:i386_linux24:i386_linux22:i386_linux3
103    ATHENA_SYS_COMPAT=${ATHENA_SYS_COMPAT}:i386_linux2:i386_linux1
104    ;;
105  *)
106    echo "Unrecognized Red Hat release, aborting." 1>&2
107    exit 1
108    ;;
109  esac
110  ;;
111Linux\ 2.6.*\ i?86)
112  ATHENA_SYS=i386_rhel4
113  ATHENA_SYS_COMPAT=i386_rhel3:i386_rh9:i386_linux24:i386_linux22:i386_linux3
114  ATHENA_SYS_COMPAT=${ATHENA_SYS_COMPAT}:i386_linux2:i386_linux1
115  ;;
116*)
117  echo "Unrecognized system type, aborting." 1>&2
118  exit 1
119  ;;
120esac
121
122# Determine platform name.
123case `uname -sm` in
124"SunOS sun4"*)
125  ATHENA_HOSTTYPE=sun4
126  ;;
127"Linux "i?86)
128  ATHENA_HOSTTYPE=linux
129  ;;
130esac
131
132savepath=$PATH
133
134# Determine operating system, appropriate path, and compiler for use
135# with plain Makefiles and some third-party packages.
136case `uname -s` in
137SunOS)
138  OS=solaris
139  LD_LIBRARY_PATH=/usr/openwin/lib export LD_LIBRARY_PATH
140  PATH=/usr/ccs/bin:/usr/bin:/usr/sfw/bin:/usr/openwin/bin
141  if [ -d /opt/SUNWspro/bin ]; then
142    sprobin=/opt/SUNWspro/bin
143  else
144    sprobin=/afs/athena.mit.edu/software/sunsoft/SUNWspro/bin
145  fi
146  export sprobin
147  ;;
148Linux)
149  OS=linux
150  LD_RUN_PATH=/usr/athena/lib export LD_RUN_PATH
151  PATH=/usr/bin:/bin:/usr/X11R6/bin
152  ;;
153esac
154CC=gcc
155CXX=g++
156WARN_CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes"
157ERROR_CFLAGS=-Werror
158PATH=/usr/athena/bin:$PATH
159MAKE=gmake
160
161if [ false = "$mungepath" ]; then
162  PATH=$savepath
163fi
164
165if [ dist = "$operation" ]; then
166  # Copy in the version file, for the few packages which need to know
167  # the Athena version.
168  cp $source/packs/build/version athena-version
169
170  # Force all source files to the same timestamp, to prevent third-party
171  # build systems from thinking some are out of date with respect to others.
172  find . ! -type l -exec touch -t `date +%Y%m%d%H%M.%S` {} \;
173fi
174
175# Determine the Athena version and set variables for the build system.
176. ./athena-version
177ATHENA_MAJOR_VERSION=$major
178ATHENA_MINOR_VERSION=$minor
179if [ -z "$ATHENA_PATCH_VERSION" ]; then
180  ATHENA_PATCH_VERSION=$patch
181fi
182export ATHENA_MAJOR_VERSION ATHENA_MINOR_VERSION ATHENA_PATCH_VERSION
183
184export WARN_CFLAGS ERROR_CFLAGS CC CXX MAKE
185
186# GConf schemas need to be installed from RPM %post scriptlets, not
187# make install rules.
188GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
189export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
190
191# On Linux, we use the native pkg-config, which needs to be able to
192# find our libraries.
193PKG_CONFIG_PATH=/usr/athena/lib/pkgconfig
194export PKG_CONFIG_PATH
195
196if [ -r Makefile.athena ]; then
197  export SRVD SOURCE COMPILER
198  SRVD=$srvd
199  SOURCE=$source
200  COMPILER=$CC
201  if [ dist = "$operation" ]; then
202    export CONFIG_SITE XCONFIGDIR
203    CONFIG_SITE=$source/packs/build/config.site
204    XCONFIGDIR=$source/packs/build/xconfig
205  fi
206  $MAKE $n -f Makefile.athena "$operation"
207elif [ -f configure.in -o -f configure.ac -o -f configure ]; then
208  if [ -f configure.athena ]; then
209    configure=configure.athena
210  else
211    configure=configure
212  fi
213  case $operation in
214  dist)
215    # Copy in support files and run autoconf if this is a directory using the
216    # Athena build system.
217    if [ -f config.do -o ! -f configure ]; then
218      $maybe touch config.do
219      $maybe rm -f mkinstalldirs install-sh config.guess
220      $maybe rm -f config.sub aclocal.m4
221      $maybe cp "$source/packs/build/autoconf/mkinstalldirs" .
222      $maybe cp "$source/packs/build/autoconf/install-sh" .
223      $maybe cp "$source/packs/build/autoconf/config.guess" .
224      $maybe cp "$source/packs/build/autoconf/config.sub" .
225      $maybe cp "$source/packs/build/aclocal.m4" .
226      $maybe cat "$source/packs/build/libtool/libtool.m4" >> aclocal.m4
227      $maybe cp "$source/packs/build/libtool/ltmain.sh" .
228      $maybe autoconf || exit 1
229    fi
230    $maybe cp "$source/packs/build/config.site" config.site.athena
231    ;;
232  prepare)
233    $maybe rm -f config.cache
234    CONFIG_SITE=`pwd`/config.site.athena $maybe "./$configure"
235  ;;
236  clean)
237    $MAKE $n clean
238    ;;
239  all)
240    $MAKE $n all
241    ;;
242  check)
243    $MAKE -n check >/dev/null 2>&1 && $MAKE $n check || true
244    ;;
245  install)
246    $MAKE $n install "DESTDIR=$srvd"
247    ;;
248  esac
249elif [ -r Imakefile ]; then
250  case $operation in
251  dist)
252    $maybe mkdir -p config
253    $maybe cp $source/packs/build/xconfig/README config
254    $maybe cp $source/packs/build/xconfig/mkdirhier.sh config
255    $maybe cp $source/packs/build/xconfig/rtcchack.bac config
256    $maybe cp $source/packs/build/xconfig/site.def config
257    $maybe cp $source/packs/build/xconfig/*.cf config
258    $maybe cp $source/packs/build/xconfig/*.rules config
259    $maybe cp $source/packs/build/xconfig/*.tmpl config
260    ;;
261  prepare)
262    $maybe imake "-Iconfig" -DUseInstalled "-DTOPDIR=`pwd`" \
263      "-DXCONFIGDIR=`pwd`/config"
264    $maybe $MAKE Makefiles
265    ;;
266  clean)
267    $MAKE $n clean
268    ;;
269  all)
270    $MAKE $n includes depend all TOP=`pwd` MAKE="$MAKE TOP=`pwd`"
271    ;;
272  check)
273    ;;
274  install)
275    $MAKE $n install install.man "DESTDIR=$srvd" TOP=`pwd` \
276      MAKE="$MAKE TOP=`pwd`"
277    ;;
278  esac
279elif [ -r Makefile ]; then
280  case $operation in
281  dist|prepare)
282    ;;
283  clean)
284    $MAKE $n clean
285    ;;
286  all)
287    $MAKE $n all CC="$CC"
288    ;;
289  check)
290    $MAKE $n check
291    ;;
292  install)
293    $MAKE $n install "DESTDIR=$srvd"
294    ;;
295  esac
296else
297  echo Nothing to do in `pwd` 1>&2
298  exit 1
299fi
Note: See TracBrowser for help on using the repository browser.