2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

boostbook.jam:

- Factor out XSLT processing rules
  - Add "tests" rule to build testcases and Jamfiles

doxygen.jam:
  - Use Doxygen as-is, without the monolithic XML file patch

xsltproc.jam:
  - xsltproc XSLT toolset

user-config.jam:
  - add "using xsltproc"


[SVN r18241]
This commit is contained in:
Douglas Gregor
2003-04-13 14:41:40 +00:00
parent 45cd767871
commit ff4e39fb66
8 changed files with 234 additions and 196 deletions

View File

@@ -21,8 +21,8 @@ import scanner ;
import make ;
feature.feature xsl:param : : free ;
feature.feature format : html onehtml man pdf ps docbook fo
: incidental implicit composite propagated ;
feature.feature format : html onehtml man pdf ps docbook fo tests
: incidental implicit composite ;
type.register DTDXML : dtdxml ;
type.register XML : xml ;
@@ -34,12 +34,11 @@ type.register PS : ps ;
type.register XSLT : xsl ;
type.register HTMLDIR ;
type.register MANPAGES ;
# Generates handle -> * rules a bit strangely, so don't try to use them for now
#generators.register-standard boostbook.xslt : XML XSLT : * ;
type.register TESTS : tests ;
generators.register-standard boostbook.dtdxml-to-boostbook : DTDXML : XML ;
generators.register-standard boostbook.boostbook-to-docbook : XML : DOCBOOK ;
generators.register-standard boostbook.boostbook-to-tests : XML : TESTS ;
generators.register-standard boostbook.docbook-to-onehtml : DOCBOOK : HTML ;
generators.register-standard boostbook.docbook-to-htmldir : DOCBOOK : HTMLDIR ;
generators.register-standard boostbook.docbook-to-manpages : DOCBOOK : MANPAGES ;
@@ -53,9 +52,7 @@ generators.register-standard boostbook.docbook-to-fo : DOCBOOK : FO ;
# docbook-dtd-dir: The DocBook DTD directory. If not provided, we use
# DOCBOOK_DTD_DIR From the environment (if available). Otherwise, we let
# the XML processor load the DTD remotely.
#
# xsltproc: The xsltproc executable
rule init ( docbook-xsl-dir ? : docbook-dtd-dir ? : xsltproc ? )
rule init ( docbook-xsl-dir ? : docbook-dtd-dir ? )
{
if ! $(docbook-xsl-dir)
{
@@ -67,11 +64,6 @@ rule init ( docbook-xsl-dir ? : docbook-dtd-dir ? : xsltproc ? )
docbook-dtd-dir = [ modules.peek : DOCBOOK_DTD_DIR ] ;
}
if ! $(xsltproc)
{
xsltroc = [ modules.peek : XSLTPROC ] ;
}
if ! $(.initialized)
{
$(.initialized) = true ;
@@ -80,7 +72,6 @@ rule init ( docbook-xsl-dir ? : docbook-dtd-dir ? : xsltproc ? )
local boost-root = [ path.make [ modules.peek : BOOST_ROOT ] ] ;
.boostbook-xsl-dir = [ path.join $(boost-root) tools boostbook xsl/ ] ;
.boostbook-dtd-dir = [ path.join $(boost-root) tools boostbook dtd/ ] ;
.xsltproc = $(xsltproc) ;
}
}
@@ -104,36 +95,6 @@ rule docbook-dtd-dir
return $(.docbook-dtd-dir) ;
}
rule xslt ( target : source stylesheet : properties * )
{
local flags ;
for local param in [ feature.get-values <xsl:param> : $(properties) ]
{
local namevalue = [ regex.split $(param) "=" ] ;
flags += --stringparam $(namevalue[1]) $(namevalue[2]) ;
}
STYLESHEET on $(target) = $(stylesheet) ;
FLAGS on $(target) = $(flags) ;
NAME on $(target) = $(.xsltproc) ;
xslt-xsltproc $(target) : $(source) ;
}
rule xslt-dir ( target : source stylesheet : properties * : dirname )
{
local flags ;
for local param in [ feature.get-values <xsl:param> : $(properties) ]
{
local namevalue = [ regex.split $(param) "=" ] ;
flags += --stringparam $(namevalue[1]) $(namevalue[2]) ;
}
STYLESHEET on $(target) = $(stylesheet) ;
FLAGS on $(target) = $(flags) ;
DIRECTORY on $(target) = $(dirname) ;
NAME on $(target) = $(.xsltproc) ;
xslt-xsltproc-dir $(target) : $(source) ;
}
rule dtdxml-to-boostbook ( target : source : properties * )
{
xslt $(target) : $(source) "$(.boostbook-xsl-dir)/dtd/dtd2boostbook.xsl"
@@ -286,6 +247,7 @@ rule boostbook-target-class ( name : project : sources * : requirements *
case fo : type = FO ;
case pdf : type = PDF ;
case ps : type = PS ;
case tests : type = TESTS ;
}
if $(manifest)
@@ -332,33 +294,6 @@ rule boostbook ( target-name : sources * : requirements * : default-build * )
] ;
}
if [ modules.peek : NT ]
{
actions xslt-xsltproc
{
set XML_CATALOG_FILES=catalog.xml
$(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(<) $(STYLESHEET) $(>)
}
actions xslt-xsltproc-dir
{
set XML_CATALOG_FILES=catalog.xml
$(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(DIRECTORY)/ $(STYLESHEET) $(>)
}
}
else
{
actions xslt-xsltproc
{
XML_CATALOG_FILES=catalog.xml $(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(<) $(STYLESHEET) $(>)
}
actions xslt-xsltproc-dir
{
XML_CATALOG_FILES=catalog.xml $(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(DIRECTORY)/ $(STYLESHEET) $(>)
}
}
#############################################################################
# Dependency scanners
#############################################################################
@@ -401,9 +336,8 @@ type.set-scanner XML : xinclude-scanner ;
#############################################################################
# Testsuite handling
#############################################################################
rule testsuite-to-jamfiles ( target : source : properties * )
rule boostbook-to-tests ( target : source : properties * )
{
ECHO $(target) ;
local boost_root = [ modules.peek : BOOST_ROOT ] ;
local native-path =
[ path.native [ path.join $(.boostbook-xsl-dir) testing/ ] ] ;
@@ -412,12 +346,3 @@ rule testsuite-to-jamfiles ( target : source : properties * )
: $(properties) <xsl:param>boost.root=$(boost_root)
;
}
rule testsuite ( target-name : source : requirements * )
{
local project = [ CALLER_MODULE ] ;
make $(target-name) : $(source) : boostbook.testsuite-to-jamfiles
: $(requirements)
;
}

View File

@@ -56,32 +56,37 @@ rule extract-xml ( target : sources * : properties * )
RECURSIVE on $(target) = NO ;
}
PATTERNS on $(target) = [ feature.get-values <pattern> : $(properties) ] ;
NAME on $(target) = [ name ] ;
doxygen-action $(<) : $(>) ;
local index-target = $(target:B="xml/index":S=".xml") ;
PATTERNS on $(index-target) =
[ feature.get-values <pattern> : $(properties) ] ;
NAME on $(index-target) = [ name ] ;
doxygen-action $(index-target) : $(>) ;
local xsl-dir = [ boostbook.xsl-dir ] ;
DEPENDS $(target) : $(index-target) ;
xslt $(target) : $(index-target) "$(xsl-dir)/doxygen/collect.xsl"
: <xsl:param>doxygen.xml.path=/home/gregod/Projects/Boost/boost/libs/any/doc/xml ;
}
actions doxygen-action
{
$(NAME:E=doxygen) -g $(<:S=.doxyfile)
echo "GENERATE_HTML = NO" >> $(<:S=.doxyfile)
echo "GENERATE_LATEX = NO" >> $(<:S=.doxyfile)
echo "GENERATE_XML = YES" >> $(<:S=.doxyfile)
echo "INPUT = $(>) " >> $(<:S=.doxyfile)
echo "MONOLITHIC_XML_FILE = $(<)" >> $(<:S=.doxyfile)
echo "RECURSIVE = $(RECURSIVE) " >> $(<:S=.doxyfile)
echo "FILE_PATTERNS = $(PATTERNS) " >> $(<:S=.doxyfile)
$(NAME:E=doxygen) $(<:S=.doxyfile) ;
$(NAME:E=doxygen) -g doxyfile
echo "GENERATE_HTML = NO" >> doxyfile
echo "GENERATE_LATEX = NO" >> doxyfile
echo "GENERATE_XML = YES" >> doxyfile
echo "INPUT = $(>) " >> doxyfile
echo "RECURSIVE = $(RECURSIVE) " >> doxyfile
echo "FILE_PATTERNS = $(PATTERNS) " >> doxyfile
$(NAME:E=doxygen) doxyfile ;
}
rule xml-to-boostbook ( target : source : properties * )
{
local xsl-dir = [ boostbook.xsl-dir ] ;
boostbook.xslt $(target)
: $(source) "$(xsl-dir)/doxygen/doxygen2boostbook.xsl"
: $(properties)
;
xslt $(target) : $(source) "$(xsl-dir)/doxygen/doxygen2boostbook.xsl"
: $(properties)
;
}
rule doxygen-xml-target-class ( name : project : sources * : requirements *

View File

@@ -42,6 +42,9 @@ import toolset : using ;
# Configure with explicit installation prefix
# using qt : /usr/opt/qt ;
# xsltproc (from libxslt) configuration
using xsltproc ;
# BoostBook configuration
using boostbook ;
# using boostbook : /home/gregod/Projects/share/docbook-xsl-1.60.1/

86
new/xsltproc.jam Normal file
View File

@@ -0,0 +1,86 @@
# Copyright (C) 2003 Doug Gregor. Permission to copy, use, modify,
# sell and distribute this software is granted provided this
# copyright notice appears in all copies. This software is provided
# "as is" without express or implied warranty, and with no claim as
# to its suitability for any purpose.
# This module defines rules to apply an XSLT stylesheet to an XML file
# using the xsltproc driver, part of libxslt.
import feature ;
import regex ;
# Initialize xsltproc support. The parameters are:
# xsltproc: The xsltproc executable
rule init ( xsltproc ? )
{
if ! $(xsltproc)
{
xsltproc = [ modules.peek : XSLTPROC ] ;
}
if ! $(.initialized)
{
$(.initialized) = true ;
.xsltproc = $(xsltproc) ;
}
}
rule xslt ( target : source stylesheet : properties * )
{
local flags ;
for local param in [ feature.get-values <xsl:param> : $(properties) ]
{
local namevalue = [ regex.split $(param) "=" ] ;
flags += --stringparam $(namevalue[1]) $(namevalue[2]) ;
}
STYLESHEET on $(target) = $(stylesheet) ;
FLAGS on $(target) = $(flags) ;
NAME on $(target) = $(.xsltproc) ;
xslt-xsltproc $(target) : $(source) ;
}
rule xslt-dir ( target : source stylesheet : properties * : dirname )
{
local flags ;
for local param in [ feature.get-values <xsl:param> : $(properties) ]
{
local namevalue = [ regex.split $(param) "=" ] ;
flags += --stringparam $(namevalue[1]) $(namevalue[2]) ;
}
STYLESHEET on $(target) = $(stylesheet) ;
FLAGS on $(target) = $(flags) ;
DIRECTORY on $(target) = $(dirname) ;
NAME on $(target) = $(.xsltproc) ;
xslt-xsltproc-dir $(target) : $(source) ;
}
if [ modules.peek : NT ]
{
actions xslt-xsltproc
{
set XML_CATALOG_FILES=catalog.xml
$(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(<) $(STYLESHEET) $(>)
}
actions xslt-xsltproc-dir
{
set XML_CATALOG_FILES=catalog.xml
$(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(DIRECTORY)/ $(STYLESHEET) $(>)
}
}
else
{
actions xslt-xsltproc
{
XML_CATALOG_FILES=catalog.xml $(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(<) $(STYLESHEET) $(>)
}
actions xslt-xsltproc-dir
{
XML_CATALOG_FILES=catalog.xml $(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(DIRECTORY)/ $(STYLESHEET) $(>)
}
}
IMPORT $(__name__) : xslt : : xslt ;
IMPORT $(__name__) : xslt-dir : : xslt-dir ;

View File

@@ -21,8 +21,8 @@ import scanner ;
import make ;
feature.feature xsl:param : : free ;
feature.feature format : html onehtml man pdf ps docbook fo
: incidental implicit composite propagated ;
feature.feature format : html onehtml man pdf ps docbook fo tests
: incidental implicit composite ;
type.register DTDXML : dtdxml ;
type.register XML : xml ;
@@ -34,12 +34,11 @@ type.register PS : ps ;
type.register XSLT : xsl ;
type.register HTMLDIR ;
type.register MANPAGES ;
# Generates handle -> * rules a bit strangely, so don't try to use them for now
#generators.register-standard boostbook.xslt : XML XSLT : * ;
type.register TESTS : tests ;
generators.register-standard boostbook.dtdxml-to-boostbook : DTDXML : XML ;
generators.register-standard boostbook.boostbook-to-docbook : XML : DOCBOOK ;
generators.register-standard boostbook.boostbook-to-tests : XML : TESTS ;
generators.register-standard boostbook.docbook-to-onehtml : DOCBOOK : HTML ;
generators.register-standard boostbook.docbook-to-htmldir : DOCBOOK : HTMLDIR ;
generators.register-standard boostbook.docbook-to-manpages : DOCBOOK : MANPAGES ;
@@ -53,9 +52,7 @@ generators.register-standard boostbook.docbook-to-fo : DOCBOOK : FO ;
# docbook-dtd-dir: The DocBook DTD directory. If not provided, we use
# DOCBOOK_DTD_DIR From the environment (if available). Otherwise, we let
# the XML processor load the DTD remotely.
#
# xsltproc: The xsltproc executable
rule init ( docbook-xsl-dir ? : docbook-dtd-dir ? : xsltproc ? )
rule init ( docbook-xsl-dir ? : docbook-dtd-dir ? )
{
if ! $(docbook-xsl-dir)
{
@@ -67,11 +64,6 @@ rule init ( docbook-xsl-dir ? : docbook-dtd-dir ? : xsltproc ? )
docbook-dtd-dir = [ modules.peek : DOCBOOK_DTD_DIR ] ;
}
if ! $(xsltproc)
{
xsltroc = [ modules.peek : XSLTPROC ] ;
}
if ! $(.initialized)
{
$(.initialized) = true ;
@@ -80,7 +72,6 @@ rule init ( docbook-xsl-dir ? : docbook-dtd-dir ? : xsltproc ? )
local boost-root = [ path.make [ modules.peek : BOOST_ROOT ] ] ;
.boostbook-xsl-dir = [ path.join $(boost-root) tools boostbook xsl/ ] ;
.boostbook-dtd-dir = [ path.join $(boost-root) tools boostbook dtd/ ] ;
.xsltproc = $(xsltproc) ;
}
}
@@ -104,36 +95,6 @@ rule docbook-dtd-dir
return $(.docbook-dtd-dir) ;
}
rule xslt ( target : source stylesheet : properties * )
{
local flags ;
for local param in [ feature.get-values <xsl:param> : $(properties) ]
{
local namevalue = [ regex.split $(param) "=" ] ;
flags += --stringparam $(namevalue[1]) $(namevalue[2]) ;
}
STYLESHEET on $(target) = $(stylesheet) ;
FLAGS on $(target) = $(flags) ;
NAME on $(target) = $(.xsltproc) ;
xslt-xsltproc $(target) : $(source) ;
}
rule xslt-dir ( target : source stylesheet : properties * : dirname )
{
local flags ;
for local param in [ feature.get-values <xsl:param> : $(properties) ]
{
local namevalue = [ regex.split $(param) "=" ] ;
flags += --stringparam $(namevalue[1]) $(namevalue[2]) ;
}
STYLESHEET on $(target) = $(stylesheet) ;
FLAGS on $(target) = $(flags) ;
DIRECTORY on $(target) = $(dirname) ;
NAME on $(target) = $(.xsltproc) ;
xslt-xsltproc-dir $(target) : $(source) ;
}
rule dtdxml-to-boostbook ( target : source : properties * )
{
xslt $(target) : $(source) "$(.boostbook-xsl-dir)/dtd/dtd2boostbook.xsl"
@@ -286,6 +247,7 @@ rule boostbook-target-class ( name : project : sources * : requirements *
case fo : type = FO ;
case pdf : type = PDF ;
case ps : type = PS ;
case tests : type = TESTS ;
}
if $(manifest)
@@ -332,33 +294,6 @@ rule boostbook ( target-name : sources * : requirements * : default-build * )
] ;
}
if [ modules.peek : NT ]
{
actions xslt-xsltproc
{
set XML_CATALOG_FILES=catalog.xml
$(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(<) $(STYLESHEET) $(>)
}
actions xslt-xsltproc-dir
{
set XML_CATALOG_FILES=catalog.xml
$(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(DIRECTORY)/ $(STYLESHEET) $(>)
}
}
else
{
actions xslt-xsltproc
{
XML_CATALOG_FILES=catalog.xml $(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(<) $(STYLESHEET) $(>)
}
actions xslt-xsltproc-dir
{
XML_CATALOG_FILES=catalog.xml $(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(DIRECTORY)/ $(STYLESHEET) $(>)
}
}
#############################################################################
# Dependency scanners
#############################################################################
@@ -401,9 +336,8 @@ type.set-scanner XML : xinclude-scanner ;
#############################################################################
# Testsuite handling
#############################################################################
rule testsuite-to-jamfiles ( target : source : properties * )
rule boostbook-to-tests ( target : source : properties * )
{
ECHO $(target) ;
local boost_root = [ modules.peek : BOOST_ROOT ] ;
local native-path =
[ path.native [ path.join $(.boostbook-xsl-dir) testing/ ] ] ;
@@ -412,12 +346,3 @@ rule testsuite-to-jamfiles ( target : source : properties * )
: $(properties) <xsl:param>boost.root=$(boost_root)
;
}
rule testsuite ( target-name : source : requirements * )
{
local project = [ CALLER_MODULE ] ;
make $(target-name) : $(source) : boostbook.testsuite-to-jamfiles
: $(requirements)
;
}

View File

@@ -56,32 +56,37 @@ rule extract-xml ( target : sources * : properties * )
RECURSIVE on $(target) = NO ;
}
PATTERNS on $(target) = [ feature.get-values <pattern> : $(properties) ] ;
NAME on $(target) = [ name ] ;
doxygen-action $(<) : $(>) ;
local index-target = $(target:B="xml/index":S=".xml") ;
PATTERNS on $(index-target) =
[ feature.get-values <pattern> : $(properties) ] ;
NAME on $(index-target) = [ name ] ;
doxygen-action $(index-target) : $(>) ;
local xsl-dir = [ boostbook.xsl-dir ] ;
DEPENDS $(target) : $(index-target) ;
xslt $(target) : $(index-target) "$(xsl-dir)/doxygen/collect.xsl"
: <xsl:param>doxygen.xml.path=/home/gregod/Projects/Boost/boost/libs/any/doc/xml ;
}
actions doxygen-action
{
$(NAME:E=doxygen) -g $(<:S=.doxyfile)
echo "GENERATE_HTML = NO" >> $(<:S=.doxyfile)
echo "GENERATE_LATEX = NO" >> $(<:S=.doxyfile)
echo "GENERATE_XML = YES" >> $(<:S=.doxyfile)
echo "INPUT = $(>) " >> $(<:S=.doxyfile)
echo "MONOLITHIC_XML_FILE = $(<)" >> $(<:S=.doxyfile)
echo "RECURSIVE = $(RECURSIVE) " >> $(<:S=.doxyfile)
echo "FILE_PATTERNS = $(PATTERNS) " >> $(<:S=.doxyfile)
$(NAME:E=doxygen) $(<:S=.doxyfile) ;
$(NAME:E=doxygen) -g doxyfile
echo "GENERATE_HTML = NO" >> doxyfile
echo "GENERATE_LATEX = NO" >> doxyfile
echo "GENERATE_XML = YES" >> doxyfile
echo "INPUT = $(>) " >> doxyfile
echo "RECURSIVE = $(RECURSIVE) " >> doxyfile
echo "FILE_PATTERNS = $(PATTERNS) " >> doxyfile
$(NAME:E=doxygen) doxyfile ;
}
rule xml-to-boostbook ( target : source : properties * )
{
local xsl-dir = [ boostbook.xsl-dir ] ;
boostbook.xslt $(target)
: $(source) "$(xsl-dir)/doxygen/doxygen2boostbook.xsl"
: $(properties)
;
xslt $(target) : $(source) "$(xsl-dir)/doxygen/doxygen2boostbook.xsl"
: $(properties)
;
}
rule doxygen-xml-target-class ( name : project : sources * : requirements *

View File

@@ -42,6 +42,9 @@ import toolset : using ;
# Configure with explicit installation prefix
# using qt : /usr/opt/qt ;
# xsltproc (from libxslt) configuration
using xsltproc ;
# BoostBook configuration
using boostbook ;
# using boostbook : /home/gregod/Projects/share/docbook-xsl-1.60.1/

86
v2/xsltproc.jam Normal file
View File

@@ -0,0 +1,86 @@
# Copyright (C) 2003 Doug Gregor. Permission to copy, use, modify,
# sell and distribute this software is granted provided this
# copyright notice appears in all copies. This software is provided
# "as is" without express or implied warranty, and with no claim as
# to its suitability for any purpose.
# This module defines rules to apply an XSLT stylesheet to an XML file
# using the xsltproc driver, part of libxslt.
import feature ;
import regex ;
# Initialize xsltproc support. The parameters are:
# xsltproc: The xsltproc executable
rule init ( xsltproc ? )
{
if ! $(xsltproc)
{
xsltproc = [ modules.peek : XSLTPROC ] ;
}
if ! $(.initialized)
{
$(.initialized) = true ;
.xsltproc = $(xsltproc) ;
}
}
rule xslt ( target : source stylesheet : properties * )
{
local flags ;
for local param in [ feature.get-values <xsl:param> : $(properties) ]
{
local namevalue = [ regex.split $(param) "=" ] ;
flags += --stringparam $(namevalue[1]) $(namevalue[2]) ;
}
STYLESHEET on $(target) = $(stylesheet) ;
FLAGS on $(target) = $(flags) ;
NAME on $(target) = $(.xsltproc) ;
xslt-xsltproc $(target) : $(source) ;
}
rule xslt-dir ( target : source stylesheet : properties * : dirname )
{
local flags ;
for local param in [ feature.get-values <xsl:param> : $(properties) ]
{
local namevalue = [ regex.split $(param) "=" ] ;
flags += --stringparam $(namevalue[1]) $(namevalue[2]) ;
}
STYLESHEET on $(target) = $(stylesheet) ;
FLAGS on $(target) = $(flags) ;
DIRECTORY on $(target) = $(dirname) ;
NAME on $(target) = $(.xsltproc) ;
xslt-xsltproc-dir $(target) : $(source) ;
}
if [ modules.peek : NT ]
{
actions xslt-xsltproc
{
set XML_CATALOG_FILES=catalog.xml
$(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(<) $(STYLESHEET) $(>)
}
actions xslt-xsltproc-dir
{
set XML_CATALOG_FILES=catalog.xml
$(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(DIRECTORY)/ $(STYLESHEET) $(>)
}
}
else
{
actions xslt-xsltproc
{
XML_CATALOG_FILES=catalog.xml $(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(<) $(STYLESHEET) $(>)
}
actions xslt-xsltproc-dir
{
XML_CATALOG_FILES=catalog.xml $(NAME:E=xsltproc) $(FLAGS) --xinclude -o $(DIRECTORY)/ $(STYLESHEET) $(>)
}
}
IMPORT $(__name__) : xslt : : xslt ;
IMPORT $(__name__) : xslt-dir : : xslt-dir ;