#!/bin/sh

. config/options $1

$SCRIPTS/unpack mysql

setup_toolchain host

cd $BUILD/mysql*
do_autoreconf
mkdir -p .objdir-host && cd .objdir-host
../configure --prefix=/usr \
             --sysconfdir=/etc \
             --libexecdir=/usr/sbin \
             --localstatedir=/var/mysql \

make -C include my_config.h
make -C mysys libmysys.a
make -C strings libmystrings.a

make -C dbug factorial

cp -PR dbug/factorial $ROOT/$TOOLCHAIN/bin/mysql-factorial

make -C vio libvio.a
make -C dbug libdbug.a
make -C regex libregex.a
make -C sql gen_lex_hash

cp -PR sql/gen_lex_hash $ROOT/$TOOLCHAIN/bin/mysql-gen_lex_hash

make -C scripts comp_sql

cp -PR scripts/comp_sql $ROOT/$TOOLCHAIN/bin/mysql-comp_sql

make -C extra comp_err

cp -PR extra/comp_err $ROOT/$TOOLCHAIN/bin/mysql-comp_err
