Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/tools/boostbook/setup_boostbook.sh @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

  • Property svn:executable set to *
File size: 5.6 KB
Line 
1#!/bin/sh
2
3# User configuration
4DOCBOOK_XSL_VERSION=1.67.2
5DOCBOOK_DTD_VERSION=4.2
6FOP_VERSION=0.20.5
7FOP_MIRROR=http://mirrors.ibiblio.org/pub/mirrors/apache/xml/fop/
8SOURCEFORGE_MIRROR=http://dl.sourceforge.net
9HTTP_GET_CMD="curl -O"
10
11# No user configuration below this point-------------------------------------
12
13# Get the DocBook XSLT Stylesheets
14DOCBOOK_XSL_TARBALL=docbook-xsl-$DOCBOOK_XSL_VERSION.tar.gz
15DOCBOOK_XSL_URL=$SOURCEFORGE_MIRROR/sourceforge/docbook/$DOCBOOK_XSL_TARBALL
16if test -f $DOCBOOK_XSL_TARBALL; then
17  echo "Using existing DocBook XSLT Stylesheets (version $DOCBOOK_XSL_VERSION)."
18else
19  echo "Downloading DocBook XSLT Stylesheets version $DOCBOOK_XSL_VERSION..."
20  $HTTP_GET_CMD $DOCBOOK_XSL_URL
21fi
22
23DOCBOOK_XSL_DIR="$PWD/docbook-xsl-$DOCBOOK_XSL_VERSION"
24if test ! -d docbook-xsl-$DOCBOOK_XSL_VERSION; then
25  echo -n "Expanding DocBook XSLT Stylesheets into $DOCBOOK_XSL_DIR..."
26  gunzip -cd $DOCBOOK_XSL_TARBALL | tar xf -
27  echo "done."
28fi
29
30# Get the DocBook DTD
31DOCBOOK_DTD_ZIP=docbook-xml-$DOCBOOK_DTD_VERSION.zip
32DOCBOOK_DTD_URL=http://www.oasis-open.org/docbook/xml/$DOCBOOK_DTD_VERSION/$DOCBOOK_DTD_ZIP
33if test -f $DOCBOOK_DTD_ZIP; then
34  echo "Using existing DocBook XML DTD (version $DOCBOOK_DTD_VERSION)."
35else
36  echo "Downloading DocBook XML DTD version $DOCBOOK_DTD_VERSION..."
37  $HTTP_GET_CMD $DOCBOOK_DTD_URL
38fi
39
40DOCBOOK_DTD_DIR="$PWD/docbook-dtd-$DOCBOOK_DTD_VERSION"
41if test ! -d docbook-dtd-$DOCBOOK_DTD_VERSION; then
42  echo -n "Expanding DocBook XML DTD into $DOCBOOK_DTD_DIR... "
43  unzip -q $DOCBOOK_DTD_ZIP -d $DOCBOOK_DTD_DIR
44  echo "done."
45fi
46
47# Find xsltproc, doxygen, and java
48OLD_IFS=$IFS
49IFS=:
50for dir in $PATH; do
51  if test -f $dir/xsltproc && test -x $dir/xsltproc; then
52    XSLTPROC="$dir/xsltproc"
53  fi
54  if test -f $dir/doxygen && test -x $dir/doxygen; then
55    DOXYGEN="$dir/doxygen"
56  fi
57  if test -f $dir/java && test -x $dir/java; then
58    JAVA="$dir/java"
59  fi
60done
61IFS=$OLD_IFS
62
63# Make sure we have xsltproc
64if test ! -f "$XSLTPROC" && test ! -x "$XSLTPROC"; then
65  echo "Searching for xsltproc... NOT FOUND.";
66  echo "ERROR: Unable to find xsltproc executable."
67  echo "If you have already installed xsltproc, please set the environment"
68  echo "variable XSLTPROC to the xsltproc executable. If you do not have"
69  echo "xsltproc, you may download it from http://xmlsoft.org/XSLT/."
70  exit 0;
71else
72  echo "Searching for xsltproc... $XSLTPROC.";
73fi
74
75# Just notify the user if we haven't found doxygen.
76if test ! -f "$DOXYGEN" && test ! -x "$DOXYGEN"; then
77  echo "Searching for Doxygen... not found.";
78  echo "Warning: unable to find Doxygen executable. You will not be able to"
79  echo "  use Doxygen to generate BoostBook documentation. If you have Doxygen,"
80  echo "  please set the DOXYGEN environment variable to the path of the doxygen"
81  echo "  executable."
82  HAVE_DOXYGEN="no"
83else
84  echo "Searching for Doxygen... $DOXYGEN.";
85  HAVE_DOXYGEN="yes"
86fi
87
88# Just notify the user if we haven't found Java. Otherwise, go get FOP.
89if test ! -f "$JAVA" && test ! -x "$JAVA"; then
90  echo "Searching for Java... not found.";
91  echo "Warning: unable to find Java executable. You will not be able to"
92  echo "  generate PDF documentation. If you have Java, please set the JAVA"
93  echo "  environment variable to the path of the java executable."
94  HAVE_FOP="no"
95else
96  echo "Searching for Java... $JAVA.";
97  FOP_TARBALL="fop-$FOP_VERSION-bin.tar.gz"
98  FOP_URL="$FOP_MIRROR/$FOP_TARBALL"
99  FOP_DIR="$PWD/fop-$FOP_VERSION"
100  FOP="$FOP_DIR/fop.sh"
101  if test -f $FOP_TARBALL; then
102    echo "Using existing FOP distribution (version $FOP_VERSION)."
103  else
104    echo "Downloading FOP distribution version $FOP_VERSION..." 
105    $HTTP_GET_CMD $FOP_URL
106  fi
107 
108  if test ! -d $FOP_DIR; then
109    echo -n "Expanding FOP distribution into $FOP_DIR... ";
110    gunzip -cd $FOP_TARBALL | tar xf -
111    echo "done.";
112  fi
113  HAVE_FOP="yes"
114fi
115
116# Find the input jamfile to configure
117JAM_CONFIG_OUT="$HOME/user-config.jam"
118if test -r "$HOME/user-config.jam"; then
119  JAM_CONFIG_IN="user-config-backup.jam"
120  cp $JAM_CONFIG_OUT user-config-backup.jam
121  JAM_CONFIG_IN_TEMP="yes"
122  echo -n "Updating Boost.Jam configuration in $JAM_CONFIG_OUT... "
123
124elif test -r "$BOOST_ROOT/tools/build/v2/user-config.jam"; then
125  JAM_CONFIG_IN="$BOOST_ROOT/tools/build/v2/user-config.jam";
126  JAM_CONFIG_IN_TEMP="no"
127  echo -n "Writing Boost.Jam configuration to $JAM_CONFIG_OUT... "
128else 
129  echo "ERROR: Please set the BOOST_ROOT environment variable to refer to your"
130  echo "Boost installation or copy user-config.jam into your home directory."
131  exit 0
132fi
133
134cat > setup_boostbook.awk <<EOF
135BEGIN { using_boostbook = 0; eaten=0 }
136
137/^\s*using boostbook/ {
138  using_boostbook = 1;
139  print "using boostbook";
140  print "  : $DOCBOOK_XSL_DIR";
141  print "  : $DOCBOOK_DTD_DIR";
142  eaten=1
143}
144
145using_boostbook==1 && /;/ { using_boostbook = 2 }
146using_boostbook==1 { eaten=1 }
147
148/^\s*using xsltproc.*$/ { eaten=1 }
149/^\s*using doxygen.*$/ { eaten=1 }
150/^\s*using fop.*$/ { eaten=1 }
151
152/^.*$/             { if (eaten == 0) print; eaten=0 }
153
154END {
155  if (using_boostbook==0) {
156    print "using boostbook";
157    print "  : $DOCBOOK_XSL_DIR";
158    print "  : $DOCBOOK_DTD_DIR";
159    print "  ;"
160  }
161  print "using xsltproc : $XSLTPROC ;"
162  if ("$HAVE_DOXYGEN" == "yes") print "using doxygen : $DOXYGEN ;";
163  if ("$HAVE_FOP" == "yes") print "using fop : $FOP : : $JAVA ;";
164}
165EOF
166
167awk -f setup_boostbook.awk $JAM_CONFIG_IN > $JAM_CONFIG_OUT
168rm -f setup_boostbook.awk
169echo "done."
170
171if test x"$JAM_CONFIG_IN_TEMP" = "xyes"; then
172  rm -f $JAM_CONFIG_IN
173fi
174
175echo "Done! Execute \"bjam --v2\" in a documentation directory to generate"
176echo "documentation with BoostBook. If you have not already, you will need"
177echo "to compile Boost.Jam."
Note: See TracBrowser for help on using the repository browser.