#!/bin/sh

. ./_blfsset.sh

APPNAME=freetype
VER=2.10.3
TARGET=$APPNAME-$VER
TARGETBALL=$DLD/$TARGET.tar.xz
TARGETDIR=$TARGET

echo $TARGET

. $WRK/_checkRequired.sh ""
. $WRK/_checkOptions.sh  \
	which libpng harfbuzz
. $WRK/_checkTarball.sh
. $WRK/_checkExit.sh "$1" || exit $?

cd $SRC
RemoveSrcDir
Extract

TimeStart

cd $TARGETDIR

sed -ri "s:.*(AUX_MODULES.*valid):\1:" modules.cfg
sed -r "s:.*(#.*SUBPIXEL_RENDERING) .*:\1:" \
    -i include/freetype/config/ftoption.h

Configuring
./configure --prefix=/usr \
	--enable-freetype-config \
	--disable-static \
$([ ${OPTION_libpng} -ne "1" ] && echo --without-png) \
	1> $LOG/$TARGET.1_conf.log 2>&1 || exit 1

Making
make -j1 \
	1> $LOG/$TARGET.2_make.log 2>&1 || exit 1

Installing
porg -lp  $TARGET "make install" \
	1> $LOG/$TARGET.3_install.log 2>&1 || exit 1

#porg -lp+ $TARGET "\
#install -v -m755 -d /usr/share/doc/freetype-$VER" \
#	1>> $LOG/$TARGET.3_install.log 2>&1 || exit 1
#porg -lp+ $TARGET "\
#cp -v -R docs/* /usr/share/doc/freetype-$VER" \
#	1>> $LOG/$TARGET.3_install.log 2>&1 || exit 1

TimeEnd

cd ..
RemoveSrcDir
PorgingDone

