#!/bin/bash
###SHELLPACK preamble hackbench-install 0
WEB_LOCATION="http://people.redhat.com/mingo/cfs-scheduler/tools/hackbench.c"
MIRROR_LOCATION="$WEBROOT/hackbench/hackbench.c"

###SHELLPACK parseargBegin
###SHELLPACK parseargEnd

cd $SHELLPACK_SOURCES || die Sources directory does not exist
rm -rf hackbench-${VERSION}-installed
mkdir -p hackbench-${VERSION}-installed

sources_fetch $WEB_LOCATION $MIRROR_LOCATION $SHELLPACK_SOURCES/hackbench-${VERSION}-installed/hackbench.c
cd $SHELLPACK_SOURCES/hackbench-${VERSION}-installed
gcc -O2 -lpthread hackbench.c -o hackbench
if [ $? -ne 0 ]; then
	die "$P: Failed to build hackbench"
fi

exit $SHELLPACK_SUCCESS
