#!/bin/sh

PREFIX=/opt/arm/arm-pnx8400-linux-uclibcgnueabi/arm-pnx8400-linux-uclibcgnueabi/sys-root/usr
CCPATH=
HOST=arm-pnx8400-linux-uclibcgnueabi

export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
export CC=$CCPATH$HOST-gcc
export AR=$CCPATH$HOST-ar
export NM=$CCPATH$HOST-nm
export RANLIB=$CCPATH$HOST-ranlib
export OBJDUMP=$CCPATH$HOST-objdump
export STRIP=$CCPATH$HOST-strip

export CFLAGS="-Wall -Wextra -Wshadow -g -ggdb3 \
	-mcpu=cortex-a9 -mfpu=vfpv3-d16 -mfloat-abi=hard \
	 -D__KERNEL_STRICT_NAMES -DFB_HW_ACCELERATION \
	-I"$PWD"/include -I"$PWD"/include/linux/dvb -I"$PREFIX"/include/freetype2"

export CXXFLAGS="-Wall -Wextra -Wshadow -g -ggdb3 \
	-mcpu=cortex-a9 -mfpu=vfpv3-d16 -mfloat-abi=hard \
	 -D__KERNEL_STRICT_NAMES -DFB_HW_ACCELERATION \
	-I"$PWD"/include -I"$PWD"/include/linux/dvb -I"$PREFIX"/include/freetype2"

export LDFLAGS="-L"$PREFIX"/lib -lcurl -lssl -lcrypto -ldl"

export DVB_API_VERSION=3
export FREETYPE_CONFIG=$PREFIX/bin/freetype-config
export CURL_CONFIG=$PREFIX/bin/curl-config

./autogen.sh
./configure --prefix=${PREFIX} --build=i386-pc-linux-gnu --host=$HOST --enable-flac --with-target=cdk --with-targetprefix="" --with-boxmodel=apollo --enable-mdev --enable-pip --enable-ffmpegdec --enable-lua "$@"

