# audiofile

. ../globals.sh

VERSION=0.2.6
SOURCE_FILE_NAME=audiofile-$VERSION.tar.gz
wd=`pwd`/audiofile-$VERSION
export wd

untar_it()
{
  i=$TARS_DIR/$SOURCE_FILE_NAME
  if [ ! -f $i ] ; then
    echo cannot untar file $i >&2
    return 1
  fi

  if [ -d $wd ] ; then return 0; fi

  gunzip <$i | tar xf -
}


patch_it()
{
  chmod 755 $wd/install-sh
  if [ -f $wd/configure.00 ] ; then
    return 0
  fi

  pfile=$PATCHES_DIR/audiofile-$VERSION-osr6.patch

  cd $wd
  /usr/gnu/bin/patch -p0 -b -z .00 -i $pfile
  cd ..
}

config_it()
{
  if [ -f $wd/config.log ] ; then
    return 0
  fi
  (cd $wd; CFLAGS="$GLOBALCFLAGS" AR=/bin/ar ./configure --prefix=$KDEDIR --build i686-unknown-sysv5uw7 --host i686-unknown-sysv5uw7 2>&1 | tee $LOGDIR/audiofile-configure)
}

build_it()
{
  (cd $wd;  gmake 2>&1 | tee $LOGDIR/audiofile)
}

install_it()
{
  (cd $wd;  gmake install 2>&1 | tee $LOGDIR/audiofile-install)
}

make_patch()
{
  foodir=`basename $wd`
  pfile=audiofile.patch.`date +%y%j%H%M`
  for i in `find $foodir -name '*.00'`; do
    f=`echo $i | sed 's/.00$//'`
    diff -c $f.00 $f
    cp $f /tmp
  done >$pfile

}
