#! /bin/sh
# file: install-wave32		G. Moody		7 October 2008
#
# Build and install WAVE on 64-bit Linux
#
# This script has been tested on 64-bit Fedora 9 running on an Intel Core2
# CPU.  The methods used here (but not this script itself) have also been
# tested on 64-bit Fedora 7 and 8 running on both AMD and Intel 64-bit CPUs.
# It requires root (superuser) permissions and must be run from within the
# top-level WFDB source directory (the directory that also contains the
# 'configure' script).
#
# WAVE must be compiled as a 32-bit application, because it depends on the
# XView toolkit, which does not support 64-bit mode (and most likely, never
# will), and 64-bit applications cannot use 32-bit libraries.  Furthermore,
# 32-bit applications cannot use 64-bit libraries, so it is necessary to
# install 32-bit versions of all of the libraries needed by WAVE, as well as
# the .h ("include") files associated with these libraries.  These components
# fall into three categories:
#
#  1. 32-bit libraries an available from Fedora repositories
#     These include the standard C library, the X11 client libraries, the X11
#     pixmap libraries, the libcurl (HTTP client) libraries, and their
#     respective developer's toolkits.  The easiest way to install these on
#     Fedora is using the yum commands below.  These packages may have different
#     names in other Linux distributions, and "yum" itself may not be available
#     as a package manager in some distributions.  These commands are safe to run
#     even if any or all of these packages are already installed.

yum -y update glibc-devel.i386 libX11-devel.i386 libXpm-devel.i386 libcurl-devel.i386
yum -y install glibc-devel.i386 libX11-devel.i386 libXpm-devel.i386 libcurl-devel.i386

#  2. XView libraries available from PhysioNet
#     These are available as RPMs for Fedora and other RPM-based distributions,
#     and in binary and source tarballs for other distributions.  By far the
#     easiest way to install them on Fedora is using the RPM command below.
#     Again, this command is safe even if any or all of these are already
#     installed.

rpm -ivh http://physionet.org/physiotools/xview/i386-Fedora/xview-3.2p1.4-21.1.fc8.i386.rpm \
 http://physionet.org/physiotools/xview/i386-Fedora/xview-clients-3.2p1.4-21.1.fc8.i386.rpm \
 http://physionet.org/physiotools/xview/i386-Fedora/xview-devel-3.2p1.4-21.1.fc8.i386.rpm

#  3. the 32-bit version of the WFDB library
#     This is easily compiled and installed by the following commands:

make clean
./configure -m32
cd lib
make install

# Now all of the prerequisites are in place, and we can compile and install
# WAVE itself:

cd ../wave
make install

# Compile and install applications for remote control of WAVE.
cd ../waverc
make install
