test-make-manual 2.88 KB
Newer Older
1 2
#!/bin/sh

unknown's avatar
unknown committed
3 4 5 6 7
needed_flags=0
needed_texi2html=0
needed_texinfo_tex=0
needed_include_texi=0

unknown's avatar
unknown committed
8 9 10 11 12
if [ -z $BROWSER ]; then
    BROWSER=netscape 
    echo "BROWSER not set, using $BROWSER"
fi

13
die ()
unknown's avatar
unknown committed
14 15 16 17 18 19 20
{
    echo
    echo $1
    cleanup
    exit 1
}

21
cleanup ()
unknown's avatar
unknown committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
{
    echo "Cleaning up..."
    if [ $needed_flags ]; then
        bk clean Flags
    fi

    if [ $needed_texi2html ]; then
        bk clean Support/texi2html
    fi

    if [ $needed_texinfo_tex ]; then
        bk clean Support/texinfo.tex
    fi

    if [ $needed_include_texi ]; then
        rm -f include.texi
    fi

    for file in \
        manual.aux manual.cp  manual.cps manual.dvi  \
        manual.fn  manual.fns manual.ky  manual.html \
        manual.pg  manual.toc manual.tp  manual.vr   \
        mysql.info manual_toc.html                   ;
    do
        rm -f $file
    done
        
}


unknown's avatar
unknown committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
if [ -e Flags/usa.txt ]; then
    echo "Good, Flags are there."
else
    echo -n "Checking out Flags..."
    bk edit Flags >/dev/null 2>&1
    echo " Done."
    needed_flags=1
fi

if [ -e Support/texi2html ]; then
    echo "Good, texi2html is there."
else
    echo -n "Checking out texi2html..."
    bk edit Support/texi2html >/dev/null 2>&1
    echo " Done."
    needed_texi2html=1
fi

if [ -e Support/texinfo.tex ]; then
    echo "Good, texinfo.tex is there."
else
    echo -n "Checking out texinfo.tex..."
    bk edit Support/texinfo.tex >/dev/null 2>&1
    echo " Done."
    needed_texinfo_tex=1
fi

if [ -e include.texi ]; then
    echo "Good, include.texi is there."
else
    echo -n "Creating include.texi..."
    bk edit ../configure.in >/dev/null 2>&1
    echo "@c This file was generated by test-make-manual" > include.texi
    echo -n "@set mysql_version " >> include.texi
    grep "AM_INIT_AUTOMAKE(mysql, " ../configure.in | \
    sed -e 's;AM_INIT_AUTOMAKE(mysql, ;;' -e 's;);;' >> include.texi
    echo -n "@set default_port " >> include.texi
    grep "MYSQL_TCP_PORT_DEFAULT=" ../configure.in | \
    sed -e 's;MYSQL_TCP_PORT_DEFAULT=;;' >> include.texi
    echo " Done."
    needed_include_texi=1
fi

95
echo -n "Running makeinfo..."
96 97
makeinfo --no-split -I . manual.texi

98 99 100 101 102
if [ $? != 0 ]; then
    die "Manual has errors - fix before you commit"
else
    echo " Looks good."
fi
unknown's avatar
unknown committed
103

104 105

echo -n "Running texi2html..."
106 107
/usr/bin/perl ./Support/texi2html -iso -number manual.texi

108 109 110 111 112 113 114 115
if [ $? != 0 ]; then
    die "Manual has errors - fix before you commit"
else
    echo " Looks good."
fi


echo -n "Running texi2dvi..."
116
texi2dvi --batch manual.texi > texi2dvi.out
117 118

if [ $? != 0 ]; then
119
    die "Manual has errors - fix before you commit (saved in texi2dvi.out)"
120
else
121
    rm texi2dvi.out
122 123 124 125
    echo " Looks good."
fi

echo
126 127
echo
echo "Please examine your modifications in \`manual.html'."
128 129 130 131
echo
echo "If you would like to use a different browser, set the 'BROWSER' environment"
echo "variable." 
echo
unknown's avatar
unknown committed
132

133
$BROWSER file:`pwd`/manual_toc.html
unknown's avatar
unknown committed
134

135
echo "-- Press Enter to Continue --"
136
read junk
unknown's avatar
unknown committed
137
cleanup