#!/bin/bash

#######################################################################
# HD-Videobench: A Benchmark for High Definition Digital Video Coding
# # http://people.ac.upc.edu/alvarez/hdvideobench
#######################################################################
# Author: Mauricio Alvarez: alvarez@ac.upc.edu
# 15/03/2007. 
# Licence: GPL.
# You have to define the <base-dir> directory in defines.inc
#######################################################################

if [ -e defines.inc ]; then
	source defines.inc
        if [ ! -d $HDBENCH_DIR ]; then
        	echo "$Error: HDBENCH_DIR not defined"
		echo "Please define HDBENCH_DIR in file defines.inc"
		exit 1
        fi		
else
	echo "Error: defines.inc not found"
	echo "Please define the base directories in a file defines.inc"
	exit 1
fi

#########################################################################
# Installation of NASM Assembler
# Note: x264 and Xvid require the nasm assembler on the X86 architecture
#  comment the next lines if you have installed it or if you are in a 
#  different architecture
#########################################################################
cd ${HDBENCH_SRC}
tar xvfj ${HDBENCH_TARBALLS}/nasm-0.98.39.tar.bz2
cd ${HDBENCH_SRC}/nasm-0.98.39
./configure --prefix=${HDBENCH_PREFIX}
make
make install


#############################
# Installation of XVID
#############################
cd ${HDBENCH_SRC}/xvidcore-1.1.2/build/generic/
./configure --prefix=${HDBENCH_PREFIX}
make
make install

##########################################
# Intallation of X264
##########################################
cd ${HDBENCH_SRC}/x264-snapshot-20070314-2245
./configure --prefix=${HDBENCH_PREFIX}
make
make install

##############################
# Intallation of Mplayer
##############################
cd ${HDBENCH_SRC}/MPlayer-1.0rc1
./configure --prefix=${HDBENCH_PREFIX} \
--with-extralibdir=${HDBENCH_PREFIX}/lib \
--with-extraincdir=${HDBENCH_PREFIX}/include 
make
make install


