#!/bin/sh

. config/options $1

setup_toolchain host

cd $BUILD/$PKG_NAME

EMACS="no" \
ac_cv_path_M4=$ROOT/$TOOLCHAIN/bin/m4 \
ac_cv_prog_gnu_m4_gnu=no \
./configure --host=$HOST_NAME \
            --build=$HOST_NAME \
            --target=$TARGET_NAME \
            --prefix=$ROOT/$TOOLCHAIN \
            --program-suffix="-2.64" \

make install \
     prefix=$ROOT/$TOOLCHAIN \
     pkgdatadir=$ROOT/$TOOLCHAIN/share/$PKG_NAME \
     pkgdatadir=$ROOT/$TOOLCHAIN/lib/$PKG_NAME \
     pkgdatadir=$ROOT/$TOOLCHAIN/include/$PKG_NAME \
     install

make clean
make install \
     prefix=$SYSROOT_PREFIX/usr \
     pkgdatadir=$SYSROOT_PREFIX/usr/share/$PKG_NAME \
     pkgdatadir=$SYSROOT_PREFIX/usr/lib/$PKG_NAME \
     pkgdatadir=$SYSROOT_PREFIX/usr/include/$PKG_NAME \
     install

