diff make/make.sh @ 83:13a980b307f8

Largeish rewrite of make.sh, breaking things out into functions. This has the advantage of letting subsets of this functionality easily be called by new wrapper scripts (instead of turning make.sh into a nest of --options), but doesn't leave us with 8 gazillion tiny little scripts that share no common code. (Probably buggy, this is just the first good stopping point.)
author Rob Landley <rob@landley.net>
date Wed, 07 Nov 2007 01:43:39 -0600
parents 6adf16f10d54
children ca7e38053195
line wrap: on
line diff
--- a/make/make.sh	Wed Oct 31 16:40:10 2007 -0500
+++ b/make/make.sh	Wed Nov 07 01:43:39 2007 -0600
@@ -5,95 +5,57 @@
 [ -z "$WEBDIR" ] && export WEBDIR=~/www/kdocs
 [ -z "$LNXDIR" ] && export LNXDIR=~/linux
 
+source "$WEBDIR"/make/functions.sh
+
 # Update mercurial repository
 if [ "$1" != "--nonet" ]
 then
-  "$WEBDIR"/make/do-gethg.sh || exit 1
+  echo "Update Linux source from mercurial on kernel.org"
+  get_hg || exit 1
 fi
 
-echo -n "Grab version number..."
-export LNXTAG="$(hg tags | head -n 2 | tail -n 1 | awk '{print $1}')"
-echo $LNXTAG
+echo "Install updated (and patched) Documentation directory."
+update_documentation_dir || exit 1
+
+echo "Set up Linux build directory (uses patched Documentation dir)"
+setuplinuxtemp || exit 1
+
+if [ "$1" == "--long" ]
+then
+  # I have a dual processor laptop, so overlap work here.  Have make htmldocs
+  # produce split-up versions in the background (which is very slow)
+  # while other work is done in the foreground.
+  make_htmldocs > /dev/null &
+
+  # This is also very slow.
+
+  # Search for references to RFC documents
+  "$WEBDIR"/make/do-rfc.sh &
+fi
 
 echo "Update master index."
-"$WEBDIR"/make/do-master.sh || exit 1
+update_master || exit 1
 
 echo "Mirror resources"
-"$WEBDIR"/make/do-mirror.sh || exit 1
+mirror_files || exit 1
 
 echo Copy readme files from Linux kernel
-"$WEBDIR"/make/do-readme.sh || exit 1
+find_readmes || exit 1
 
 echo Convert kconfig to html for all architectures
-"$WEBDIR"/make/do-menuconfig.sh || exit 1
-
-echo Install updated Documentation
+htmlize_menuconfig || exit 1
 
-rm -rf $WEBDIR/Documentation/
-cp -a $LNXDIR/hg/Documentation $WEBDIR/Documentation
-cd $WEBDIR
-for i in make/patches/*.patch
-do
-  echo $i
-  patch -p1 -i $i || exit 1
-done
-make/docdiridx.py
-
-[ "$1" == "--short" ] && exit 1
-
-echo Build htmldocs and xhtml-nochunks
-
-rm -rf $LNXDIR/temp
-cd $LNXDIR/hg
-mkdir $LNXDIR/temp
-make allnoconfig O=$LNXDIR/temp
-
-# Adjust to use the patched Documentation directory
-ln -s $WEBDIR/Documentation $LNXDIR/temp
+echo Build nochunks htmldocs.
+make_htmlnochunks || exit 1
 
-# 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
-[ "$1" != "--skimp" ] && 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
-[ "$1" != "--skimp" ] && 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
+# Wait for background task(s) to finish.  If there aren't any, this continues
+# immediately.
+"$WEBDIR"/do-wait.sh
 
-echo Install htmldocs and update index
-
-rm -f $WEBDIR/htmldocs
-ln -s 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
+# Install the htmldocs
+install_htmldocs || exit 1
 
 # Search for references to RFC documents
-"$WEBDIR"/make/findrfc.sh > "$WEBDIR"/rfc-linux.html || exit 1
+"$WEBDIR"/make/do-rfc.sh > "$WEBDIR"/rfc-linux.html || exit 1
 
 echo "Done with kdocs"