NAME="freetype"
DESC="TrueType font libary"
VERSION="2.13.1"
FILES=(
  "https://downloads.sourceforge.net/freetype/freetype-$VERSION.tar.xz"
  "https://downloads.sourceforge.net/freetype/freetype-doc-$VERSION.tar.xz"
)
HASHES=(
  "e4c3f0d8453a2a7993ae784912d6f19a"
  "9eaaf193b0493297d92cd435cd850598"
)
DEPENDS=()

PACKAGE() {
  tar xf $NAME-$VERSION.tar.xz
  cd $NAME-$VERSION
  
  tar -xf ../freetype-doc-$VERSION.tar.xz --strip-components=2 -C docs
  sed -ri "s:.*(AUX_MODULES.*valid):\1:" modules.cfg

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

  ./configure --prefix=/usr --enable-freetype-config --disable-static
  make && make DESTDIR=$ROOTDIR install

  mkdir -p ${ROOTDIR}/usr/share/doc
  cp -v -R docs -T ${ROOTDIR}/usr/share/doc/freetype-$VERSION
  rm -v ${ROOTDIR}/usr/share/doc/freetype-$VERSION/freetype-config.1

  cd .. && rm -rf $NAME-$VERSION
}
