# GraphViz includes a hack that automatically redirects certain font names
# to certain versions of so called URW Postscript fonts. The error that results
# from such redirection is as follows (trailing font name may change):
#   Error: fontconfig: Didn't find expected font family. Perhaps URW Type 1 fonts need installing? : Times-Roman
# This patch removes said hack.
default_pre_build                                      &&
cd $SOURCE_DIRECTORY                                   &&
# fix bug #15881
patch -p1 < $SCRIPT_DIRECTORY/libltdl.patch            &&
# /fix
find -name Makefile.in | while read _LINE; do
  sedit "s|html/info|$SPELL|g" "$_LINE"
done                                                   &&
if ! spell_ok tcl; then
  sedit 's|tclsh|#tclsh|g'      tclpkg/gv/Makefile.in  &&
  sedit 's|\<gv_\w\+\.man\>||g' tclpkg/gv/Makefile.in
fi &&
cd ${SOURCE_DIRECTORY}                                 &&
sedit "s:./configure.*::g"  autogen.sh                 &&
libtoolize -f                                          &&
rm -rf libltdl                                         &&
sedit '/libltdl/d' configure.ac                        &&
sedit 's/AC_LIBLTDL_CONVENIENCE/AC_LIBLTDL_INSTALLABLE/' configure.ac &&
sedit 's:$(top_builddir)/libltdl/libltdlc.la:$(LIBLTDL):' lib/gvc/Makefile.am &&
#
# Remove LIBPOSTFIX so we don't install to lib64 on 64bit archs
#
sed -i '99,108d' configure.ac  &&
aclocal                                                &&
automake --add-missing -f                              &&
autoreconf -f                                          &&
./autogen.sh
