#! /bin/sh # file: install-wave32 G. Moody 7 October 2008 # Last revised: 16 May 2022 # Build and install WAVE on 64-bit GNU/Linux platforms # ***************************************************************************** # This script builds and installs 'wave' as a 32-bit application on GNU/Linux. # It has been tested on x86_64 (AMD/Intel 64-bit) Fedora and Debian platforms, # and may work on similar platforms such as Ubuntu and CentOS. # # Part 1 of this script automates installation of prerequisite 32-bit libraries # and *.h files on supported platforms. It is harmless to rerun this script if # some or all of these prerequisites have been installed already. # # If you use another GNU/Linux platform, you will need to install these # prerequisites in some other way, then run this script using the -q option. # ***************************************************************************** set -e echo echo "If this script fails, read it for troubleshooting hints." distro=unknown host_arch=unknown prereqs=yes while [ "$#" != 0 ]; do arg=$1 shift case $arg in -q) prereqs=no ;; -d) distro=$1; shift ;; -a) host_arch=$1; shift ;; *) echo "Usage: $0 [-q] [-d DISTRIBUTION] [-a HOST-ARCHITECTURE]" >&2 exit 1 ;; esac done if [ "x$distro" = "xunknown" ]; then if [ -x "$(command -v apt-get)" ]; then distro=debian if [ "x$host_arch" = "xunknown" ]; then host_arch=$(dpkg --print-architecture) fi elif [ -x "$(command -v dnf)" ] || [ -x "$(command -v yum)" ]; then distro=fedora if [ "x$host_arch" = "xunknown" ]; then host_arch=$(rpm -q rpm | tr . \\n | tail -1) fi fi fi configure_args=-m32 case $distro-$host_arch in fedora-i686) arch=i686; pn_arch=i386;; fedora-x86_64) arch=i686; pn_arch=i386;; debian-amd64) arch=i386; gcc_package=gcc-multilib;; debian-arm64) arch=armhf; gcc_package=gcc-arm-linux-gnueabihf; configure_args="--host=arm-linux-gnueabihf --with-xview=/usr --libdir=/usr/local/lib32";; debian-armel) arch=armel; gcc_package=gcc;; debian-armhf) arch=armhf; gcc_package=gcc;; debian-i386) arch=i386; gcc_package=gcc;; debian-mips) arch=mips; gcc_package=gcc;; debian-mips64el) arch=mipsel; gcc_package=gcc-multilib;; debian-mipsel) arch=mipsel; gcc_package=gcc;; debian-powerpc) arch=powerpc; gcc_package=gcc;; *) echo "This OS or architecture is not recognized." if [ "$prereqs" = "yes" ]; then exit 1 fi ;; esac # Part 1: install prerequisites (unless skipped using -q option) if [ "$prereqs" = "yes" ]; then if [ "$(id -u)" != 0 ]; then echo "You do not have root (superuser) permissions, so this script may fail" echo "if it needs to install missing libraries. If this happens, rerun it" echo "as root (e.g., using su or sudo)." fi case $distro in fedora) if [ -x "$(command -v dnf)" ]; then dnf=dnf; else dnf=yum; fi # Install fonts and 32-bit libraries from Fedora repositories $dnf -y install \ make gcc \ glibc-devel glibc-devel.$arch libtirpc-devel \ libX11-devel libX11-devel.$arch \ libXpm-devel libXpm-devel.$arch \ libcurl-devel libcurl-devel.$arch \ flac-devel flac-devel.$arch \ xorg-x11-fonts-100dpi xorg-x11-fonts-ISO8859-1-100dpi \ xorg-x11-fonts-75dpi xorg-x11-fonts-ISO8859-1-75dpi \ xorg-x11-fonts-misc \ xset # Install XView libraries and development toolkit from PhysioNet PKGURL=http://archive.physionet.org/physiotools/xview/$pn_arch-Fedora PACKAGES="xview-3.2p1.4-21.1.fc8.$pn_arch.rpm xview-clients-3.2p1.4-21.1.fc8.$pn_arch.rpm xview-devel-3.2p1.4-21.1.fc8.$pn_arch.rpm" for pkg in $PACKAGES; do wget -O $pkg $PKGURL/$pkg done if ! sha256sum -c - <