Subversion Repositories wimsdev

Rev

Rev 2841 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#! /bin/sh

if [ "$UID" = 0 ]; then
 cat <<@

You are trying to compile WIMS as 'root'!

You should not do that. Compile as 'wims', please.

@
 exit
fi

distro=default
[ -f /etc/debian_version ] && distro=debian

cd `dirname $0`
cd src

# how do we suppress \n from 'echo' output ?
if (echo "hi\c"; echo " ") | grep c >/dev/null 2>&1 ; then
  n=-n; c=
else
  n=; c='\c'
fi


clear
cat <<@

Welcome to the compilation of WIMS (WWW Interactive Multipurpose Server)!

This utility guides you interactively through the choice of options,
then launches the compilation.

To compile WIMS with default options, just press [Enter].

To customize the compilation options, type 'y' and press [Enter].
(Now you no longer need this because failure of the optional compilations
will not block the compilation of the whole.)

To abort now, press Ctrl-C.

@
options=
echo $n "Interactive options (y/n)? [n] " $c
read ans
if [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then
 cat <<@

--------------------------------------------------------------------------

   WIMS compile options (the letter in the bracket is the default)

1. This package includes an independent program, 'units-filter',
   which is used in physics/chemistry exercises for unit recognition.
   Its compilation requires flex.
@
 echo $n "   -- Compile units-filter (y/n)? [y] " $c
 read ans
 if [ "$ans" = "n" ] || [ "$ans" = "N" ]; then
  options="$options --without-units"
 else
  options="$options --with-units"
 fi
 cat <<@

2. This package includes an independent program, 'chemeq',
   which is used in physics/chemistry exercises for checking balancing
   conditions in chemical equations.
   Its compilation requires GNU C++ compiler and flex.
@
 echo $n "   -- Compile chemeq (y/n)? [y] " $c
 read ans
 if [ "$ans" = "n" ] || [ "$ans" = "N" ]; then
  options="$options --without-chemeq"
 else
  options="$options --with-chemeq"
 fi
 cat <<@

3. This package includes a stand-alone http server, 'wimsd',
   which is known to have compatibility problems on some architectures
@
 echo $n "   -- Compile wimsd (y/n)? [y] " $c
 read ans
 if [ "$ans" = "n" ] || [ "$ans" = "N" ]; then
  options="$options --without-wimsd"
 else
  options="$options --with-wimsd"
 fi
 cat <<@

-----------------------------------------------------------------------

   Options: $options

@
 echo $n "   Now press [Enter] to start compilation, or Ctrl-C to abort. " $c
 read ans
fi

./configure $options || exit
if [ ! -f Makefile ]; then exit; fi
make clean || exit
make all || exit
cd ..
bin/mkindex

echo Please give the root password to setup WIMS.
uname=`uname | tr '[A-Z]' '[a-z]'`
case "$uname" in
  darwin) sudo=sudo;;
  *)      sudo="su root -c";;
esac
$sudo bin/wrapuid || exit
cat <<@

WIMS is successfully compiled and installed.

@