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

Try to adjust the paths in boostbook_catalog.xml to be correct, whether we're using a windows or cygwin build of xsltproc

[SVN r62221]
This commit is contained in:
Steven Watanabe
2010-05-26 00:31:42 +00:00
parent eb163585c4
commit fbcc338aa4
2 changed files with 54 additions and 3 deletions

View File

@@ -315,6 +315,27 @@ rule docbook-to-fo ( target : source : properties * )
xslt $(target) : $(source) $(stylesheet) : $(properties) ;
}
rule format-catalog-path ( path )
{
local result = $(path) ;
if [ xsltproc.is-cygwin ]
{
if [ os.name ] = NT
{
drive = [ MATCH ^/(.):(.*)$ : $(path) ] ;
result = /cygdrive/$(drive[1])$(drive[2]) ;
}
}
else
{
if [ os.name ] = CYGWIN
{
result = [ path.make $(path:W) ] ;
}
}
return [ regex.replace $(result) " " "%20" ] ;
}
rule generate-xml-catalog ( target : sources * : properties * )
{
print.output $(target) ;
@@ -323,7 +344,7 @@ rule generate-xml-catalog ( target : sources * : properties * )
local boostbook-dtd-dir = [ boostbook.dtd-dir ] ;
if $(boostbook-dtd-dir)
{
boostbook-dtd-dir = [ regex.replace $(boostbook-dtd-dir) " " "%20" ] ;
boostbook-dtd-dir = [ format-catalog-path $(boostbook-dtd-dir) ] ;
}
print.text
@@ -348,7 +369,7 @@ rule generate-xml-catalog ( target : sources * : properties * )
}
else
{
docbook-xsl-dir = [ regex.replace $(docbook-xsl-dir) " " "%20" ] ;
docbook-xsl-dir = [ format-catalog-path $(docbook-xsl-dir) ] ;
print.text " <rewriteURI uriStartString=\"http://docbook.sourceforge.net/release/xsl/current/\" rewritePrefix=\"file://$(docbook-xsl-dir)/\"/>" ;
}
@@ -365,7 +386,7 @@ rule generate-xml-catalog ( target : sources * : properties * )
}
else
{
docbook-dtd-dir = [ regex.replace $(docbook-dtd-dir) " " "%20" ] ;
docbook-dtd-dir = [ format-catalog-path $(docbook-dtd-dir) ] ;
print.text " <rewriteURI uriStartString=\"http://www.oasis-open.org/docbook/xml/4.2/\" rewritePrefix=\"file://$(docbook-dtd-dir)/\"/>" ;
}

View File

@@ -13,6 +13,9 @@ import feature ;
import regex ;
import sequence ;
import common ;
import os ;
import modules ;
import path ;
feature.feature xsl:param : : free ;
feature.feature xsl:path : : free ;
@@ -33,9 +36,36 @@ rule init ( xsltproc ? )
{
$(.initialized) = true ;
.xsltproc = $(xsltproc) ;
.is-cygwin = [ .is-cygwin $(xsltproc) ] ;
}
}
# Returns a non-empty string if a cygwin xsltproc binary was specified.
rule is-cygwin ( )
{
return $(.is-cygwin) ;
}
rule .is-cygwin ( xsltproc )
{
if [ os.on-windows ]
{
local file = [ path.make [ modules.binding $(__name__) ] ] ;
local dir = [ path.native
[ path.join [ path.parent $(file) ] xsltproc ] ] ;
if [ os.name ] = CYGWIN
{
cygdir = $(dir:W) ;
}
local command =
"\"$(xsltproc)\" \"$(dir)\\test.xsl\" \"$(dir)\\test.xml\" 2>&1" ;
local status = [ SHELL $(command) : no-output : exit-status ] ;
if $(status[2]) != "0"
{
return true ;
}
}
}
rule compute-xslt-flags ( target : properties * )
{