#!/bin/bash
# This script will build expat. 
# It will also copy the header files and the library to the current directory
# in a Vatics conventional way, i.e., ./lib and ./src. 
PATH=/usr/bin:/bin:$PATH
APP_NAME=boa
VERSION=1.95.8
SOVERSION=0.5.0
TARBALL=$APP_NAME-$VERSION.tar.bz2
PACKAGE_DIR=$APP_NAME-orig
UNTAR_ARG='-jxf'
HOST='arm-linux-'
CC=${HOST}gcc

# check if you have the proper gcc
which $CC > /dev/null || exit 1 

#tar $UNTAR_ARG $TARBALL

[ -d "$PACKAGE_DIR" ] || exit 1

cd $PACKAGE_DIR

# configure it for $HOST
[ -f "Makefile" ] || ./configure --host=${HOST%-} &> /dev/null

# simply make it
#make --quiet MAKEFLAGS= 
MAKEFLAGS=
make --quiet

cd - > /dev/null


# if i have the shared stripped library and it is newer than the original one, 
# ignore it. 
[ -f "${APP_NAME}" ] && [ "${PACKAGE_DIR}/src/${APP_NAME}" -ot "${APP_NAME}" ] && exit 0

${HOST}strip -o ${APP_NAME} $PACKAGE_DIR/src/${APP_NAME}

