view make/make.sh @ 47:0df6348fc276

Teach indexsections to output index and contents in one pass, and put index in an arbitrary location within the file (governed by <put_index_here> tag). Update master.idx to use this, move introductory material to the top, and reshuffle sections. Teach make.sh new calling convention for master.idx.
author Rob Landley <rob@landley.net>
date Tue, 25 Sep 2007 23:35:21 -0500
parents 17389c66eb02
children aa424ac2ce30
line wrap: on
line source

#!/bin/bash

[ -z "$WEBDIR" ] && WEBDIR=~/www/kdocs
[ -z "$LNXDIR" ] && LNXDIR=~/linux

echo $WEBDIR

echo "Update master index."

$WEBDIR/make/indexsections.py $WEBDIR/master.idx > $WEBDIR/master.html || exit 1

echo "Update Linux kernel from kernel.org"

if [ ! -d "$LNXDIR" ]
then
  # Clone repository if we haven't got one yet.
  mkdir -p "$LNXDIR"/hg &&
  cd "$LNXDIR"/hg &&
  hg clone http://kernel.org/hg/linux-2.6 hg
else
  # Update kernel mercurial repository.
  cd "$LNXDIR"/hg &&
  hg pull -u
fi

[ $? -ne 0 ] && exit 1

echo -n "Grab version number..."

LNXTAG="$(hg tags | head -n 2 | tail -n 1 | awk '{print $1}')"

echo $LNXTAG

echo Copy readme files from Linux kernel

rm -rf $WEBDIR/readme
mkdir $WEBDIR/readme
for i in $(find . -name "*[Rr][Ee][Aa][Dd][Mm][Ee]*" | grep -v "Documentation/")
do
  OUT=$(echo $i | sed -e 's@\./@@' -e 's@/@-@g')
  cp $i $WEBDIR/readme/$OUT
done
make help > $WEBDIR/makehelp.txt

echo Convert kconfig to html for all architectures

echo $WEBDIR/menuconfig/
rm -rf $WEBDIR/menuconfig/
mkdir -p $WEBDIR/menuconfig
echo "<html><title>Menuconfig docs for Linux $LNXTAG</title><body><ul>" > $WEBDIR/menuconfig/index.html
for i in $(find arch -maxdepth 2 -name Kconfig | sort)
do
  echo Converting "$i"
  ARCH=$(echo $i | sed -r 's@.*/(.*)/.*@\1@')
  echo "<li><a href=${ARCH}.html>${ARCH}</a></li>" >> $WEBDIR/menuconfig/index.html
  $WEBDIR/make/menuconfig2html.py $i $WEBDIR/menuconfig "$LNXTAG" > $WEBDIR/menuconfig/$ARCH.html
done
echo "</ul></body></html>" >> $WEBDIR/menuconfig/index.html

echo Install updated Documentation

rm -rf $WEBDIR/Documentation/
cp -a $LNXDIR/hg/Documentation $WEBDIR/Documentation

echo Build htmldocs and xhtml-nochunks

rm -rf $LNXDIR/temp
cd $LNXDIR/hg
mkdir $LNXDIR/temp
make allnoconfig O=$LNXDIR/temp

# I have a dual processor laptop, so overlap work here.  Generate the xml
# first, then have make htmldocs produce split-up versions in the background
# while a script produces nochunks versions in the foreground.
cd $LNXDIR/temp
make -j 2 xmldocs
make -j 2 htmldocs &
cd Documentation/DocBook
for i in *.xml
do
  echo "Converting $i"
  xmlto xhtml-nochunks $i -o xhtml-nochunks 
done
# Wait for background task to finish before retrieving result
while [ $(jobs | wc -l) -ne 0 ]
do
  sleep 1
  # Without this next line, bash never notices a change in the number of jobs.
  # Bug noticed in Ubuntu 7.04
  jobs > /dev/null
done
mv xhtml-nochunks/*.html .
rmdir xhtml-nochunks

echo Install htmldocs and update index

rm -rf $WEBDIR/htmldocs
cp -a $LNXDIR/temp/Documentation/DocBook $WEBDIR/htmldocs
cd $WEBDIR/htmldocs
# Work around a bug in xmlto: it puts an incorrect code page into the converted
# html documents, which produces line noise in the output.
find . -name "*.html" | xargs sed -i -e 's/.*ISO-8859-1.*//'
head -n 2 index.html > index2.html
echo "<ul>" >> index2.html
for i in $(ls -p | sed -n 's@/$@@p')
do
  echo "<li>(<a href=\"$i\">chunks</a>) (<a href=\"${i}.html\">nochunks</a>) " >> index2.html
  sed -nr 's@.*<title>(.*)</title>.*@\1@p' ${i}.xml | head -n 1 >> index2.html
  echo "</li>" >> index2.html
done
echo "</ul>" >> index2.html
mv index2.html index.html
echo "Done with kdocs"