#!/bin/sh
BUILD_DATE=`LANG=en_US LC_ALL=en_US LOCALE=en_US date`
BUILD_ARCH="`uname -sr` `uname -m`"
BUILD_USER=""
if [ "x$BUILD_USER_CUSTOM" != "x" ]; then
  BUILD_USER=$BUILD_USER_CUSTOM
else
  BUILD_USER="$LOGNAME""@"`hostname`
fi

PWD_SAVE=`pwd`
cd $1
echo Generating build.h
cat $1/build.h.in | sed s/@BUILD_DATE@/"$BUILD_DATE"/g  \
                  | sed s/@BUILD_ARCH@/"$BUILD_ARCH"/g  \
                  | sed s/@BUILD_USER@/"$BUILD_USER"/g \
    > $2/build.h 
cd $PWD_SAVE
