#!/bin/bash

cd $BLDDIR
rm -rf tar-$TAR_VER
tar -xf $SRCDIR/tar-$TAR_VER.tar.gz
cd tar-$TAR_VER

cat > config.cache << EOF
gl_cv_func_wcwidth_works=yes
gl_cv_func_btowc_eof=yes
ac_cv_func_malloc_0_nonnull=yes
ac_cv_func_realloc_0_nonnull=yes
gl_cv_func_mbrtowc_incomplete_state=yes
gl_cv_func_mbrtowc_nul_retval=yes
gl_cv_func_mbrtowc_null_arg=yes
gl_cv_func_mbrtowc_retval=yes
gl_cv_func_wcrtomb_retval=yes
EOF
./configure --prefix=/tools \
    --build=${CHFS_HOST} --host=${CHFS_TARGET} \
    --cache-file=config.cache
make
make install

cd $ROOT
