#!/bin/sh

. config/options

$SCRIPTS/build toolchain
$SCRIPTS/build freetype
$SCRIPTS/build libxml2
$SCRIPTS/build zlib

cd $PKG_BUILD
./configure --host=$TARGET_NAME \
            --build=$HOST_NAME \
            --prefix=/usr \
            --sysconfdir=/etc \
            --localstatedir=/var \
            --disable-static \
            --enable-shared \
            --with-arch=$TARGET_ARCH \
            --with-freetype-config=$ROOT/$TOOLCHAIN/bin/freetype-config \
            --with-default-fonts=$XORG_PATH_FONTS/liberation \
            --without-add-fonts \
            --disable-dependency-tracking \
            --disable-docs

for m in fc-case fc-glyphname fc-lang fc-arch; do
  sed -i "s|LDFLAGS =.*|LDFLAGS =|" $m/Makefile
  sed -i "s|CFLAGS =.*|CFLAGS =${HOST_CFLAGS}|" $m/Makefile
done

make

$MAKEINSTALL
