#!/bin/sh

. config/options

$SCRIPTS/build toolchain

# sqlite fails to compile with fast-math link time optimization.
  CFLAGS=`echo $CFLAGS | sed -e "s|-ffast-math||"`

export config_BUILD_CC="$HOST_CC"
export config_BUILD_CFLAGS="$HOST_CFLAGS"
export config_BUILD_LIBS="$HOST_LDFLAGS"
export config_TARGET_CC="$CC"
export config_TARGET_LINK="$LD"
export config_TARGET_CFLAGS="$CFLAGS"
export config_TARGET_LFLAGS="$LDFLAGS -ldl"

cd $PKG_BUILD
./configure --host=$TARGET_NAME \
            --build=$HOST_NAME \
            --prefix=/usr \
            --sysconfdir=/etc \
            --disable-static \
            --enable-shared \
            --disable-readline \
            --enable-threadsafe \

make

$STRIP .libs/sqlite3

$MAKEINSTALL