#!/bin/sh

. config/options

$SCRIPTS/build toolchain
$SCRIPTS/build zlib
$SCRIPTS/build glib-host

cd $PKG_BUILD

mkdir -p .build-target

cd .build-target
ac_cv_func_posix_getpwuid_r='yes' \
ac_cv_func_posix_getgrgid_r='yes' \
glib_cv_uscore='no' \
glib_cv_stack_grows='no' \
../configure --host=$TARGET_NAME \
             --build=$HOST_NAME \
             --prefix=/usr \
             --sysconfdir=/etc \
             --localstatedir=/var \
             --enable-shared \
             --disable-static \
             --disable-debug \
             --disable-silent-rules \
             --disable-selinux \
             --disable-fam \
             --enable-xattr \
             --enable-regex \
             --with-gnu-ld \
             --with-threads=posix \
             --disable-man \
             --disable-rebuilds \
             --disable-gtk-doc \

make

$MAKEINSTALL

mkdir -p $SYSROOT_PREFIX/usr/include/glib-2.0
  cp glibconfig.h $SYSROOT_PREFIX/usr/include/glib-2.0
mkdir -p $SYSROOT_PREFIX/usr/lib/pkgconfig
  cp g*-2.0.pc $SYSROOT_PREFIX/usr/lib/pkgconfig
