diff --git a/v2/build-system.jam b/v2/build-system.jam index 6a313108a..67def964d 100644 --- a/v2/build-system.jam +++ b/v2/build-system.jam @@ -921,6 +921,15 @@ local rule should-clean-project ( project ) __ACTION_RULE__ = build-system.out-xml.collect [ modules.peek build-system : .out-xml ] ; } + + IMPORT + build-system : + out-xml.collect + out-xml.generate-action + : : + build-system.out-xml.collect + build-system.out-xml.generate-action + ; } local j = [ option.get jobs ] ; @@ -998,4 +1007,3 @@ local rule should-clean-project ( project ) } } } - diff --git a/v2/contrib/boost.jam b/v2/contrib/boost.jam index c26b8a62b..4c284e496 100644 --- a/v2/contrib/boost.jam +++ b/v2/contrib/boost.jam @@ -59,6 +59,7 @@ import property-set ; import regex ; import common ; import option ; +import numbers ; .boost.auto_config = [ property-set.create system ] ; @@ -114,7 +115,7 @@ rule init # searchable pre-built boost libraries, or references a source tree # of the boost library. If the 'version' parameter is omitted either # the configured default (first in config files) is used or an auto -# configuration will be attemted. +# configuration will be attempted. # rule use-project ( @@ -190,40 +191,61 @@ rule boost_std ( inc ? lib ? ) # The default definitions for pre-built libraries. project boost - : usage-requirements $(inc) + : usage-requirements $(inc) BOOST_ALL_NO_LIB : requirements @tag_std $(lib) ; alias headers ; - lib program_options : : : : - shared:BOOST_PROGRAM_OPTIONS_DYN_LINK ; - lib thread : : : : - shared:BOOST_THREAD_DYN_DLL ; - lib iostreams : : : : - shared:BOOST_IOSTREAMS_DYN_LINK ; - lib wave : : : : - shared:BOOST_WAVE_DYN_LINK ; - lib python : : : : - shared:BOOST_PYTHON_DYN_LINK ; - lib serialization : : : : - shared:BOOST_SERIALIZATION_DYN_LINK ; - lib graph : : : : - shared:BOOST_GRAPH_DYN_LINK ; lib date_time : : : : shared:BOOST_DATE_TIME_DYN_LINK ; - lib test : : : : - shared:BOOST_TEST_DYN_LINK ; - lib regex : : : : - shared:BOOST_REGEX_DYN_LINK ; lib filesystem : : : : shared:BOOST_FILE_SYSTEM_DYN_LINK ; + lib graph : : : : + shared:BOOST_GRAPH_DYN_LINK ; + lib graph_parallel : : : : + shared:BOOST_GRAPH_DYN_LINK ; + lib iostreams : : : : + shared:BOOST_IOSTREAMS_DYN_LINK ; + lib math_tr1 : : : : + shared:BOOST_MATH_TR1_DYN_LINK ; + lib math_tr1f : : : : + shared:BOOST_MATH_TR1_DYN_LINK ; + lib math_tr1l : : : : + shared:BOOST_MATH_TR1_DYN_LINK ; + lib math_c99 : : : : + shared:BOOST_MATH_TR1_DYN_LINK ; + lib math_c99f : : : : + shared:BOOST_MATH_TR1_DYN_LINK ; + lib math_c99l : : : : + shared:BOOST_MATH_TR1_DYN_LINK ; + lib mpi : : : : + shared:BOOST_MPI_DYN_LINK ; + lib program_options : : : : + shared:BOOST_PROGRAM_OPTIONS_DYN_LINK ; + lib python : : : : + shared:BOOST_PYTHON_DYN_LINK ; + lib random : : : : + shared:BOOST_RANDOM_DYN_LINK ; + lib regex : : : : + shared:BOOST_REGEX_DYN_LINK ; + lib serialization : : : : + shared:BOOST_SERIALIZATION_DYN_LINK ; + lib wserialization : : : : + shared:BOOST_SERIALIZATION_DYN_LINK ; lib signals : : : : shared:BOOST_SIGNALS_DYN_LINK ; - lib function_types ; - lib mpi : : : : - shared:BOOST_MPI_DYN_LINK ; lib system : : : : shared:BOOST_SYSTEM_DYN_LINK ; + lib unit_test_framework : : : : + shared:BOOST_TEST_DYN_LINK ; + lib prg_exec_monitor : : : : + shared:BOOST_TEST_DYN_LINK ; + lib test_exec_monitor : : : : + shared:BOOST_TEST_DYN_LINK ; + lib thread : : : : + shared:BOOST_THREAD_DYN_DLL ; + lib wave : : : : + shared:BOOST_WAVE_DYN_LINK ; } rule boost_0_0_1 ( inc ? lib ? ) @@ -244,13 +266,56 @@ rule tag_std ( name : type ? : property-set ) { name = lib$(name) ; } - if $(.layout) = versioned + + local result ; + if $(.layout) = system { - version = $(.version_tag) ; - toolset = ; + local version = [ MATCH ^([0-9]+)_([0-9]+) : $(.version_tag) ] ; + if $(version[1]) = "1" && [ numbers.less $(version[2]) 39 ] + { + result = [ tag_tagged $(name) : $(type) : $(property-set) ] ; + } + else + { + result = [ tag_system $(name) : $(type) : $(property-set) ] ; + } + } + else if $(.layout) = tagged + { + result = [ tag_tagged $(name) : $(type) : $(property-set) ] ; + } + else if $(.layout) = versioned + { + result = [ tag_versioned $(name) : $(type) : $(property-set) ] ; + } + else + { + errors.error "Missing layout" ; } - return [ common.format-name - $(toolset) -$(version) -$(.build_id) - : $(name) : $(type) : $(property-set) ] ; + return $(result) ; +} + +rule tag_system ( name : type ? : property-set ) +{ + return [ common.format-name + + -$(.build_id) + : $(name) : $(type) : $(property-set) ] ; +} + +rule tag_tagged ( name : type ? : property-set ) +{ + return [ common.format-name + + -$(.build_id) + : $(name) : $(type) : $(property-set) ] ; +} + +rule tag_versioned ( name : type ? : property-set ) +{ + return [ common.format-name + -$(.version_tag) + -$(.build_id) + : $(name) : $(type) : $(property-set) ] ; } diff --git a/v2/doc/src/standalone.xml b/v2/doc/src/standalone.xml index dde41b0db..1e8efa656 100644 --- a/v2/doc/src/standalone.xml +++ b/v2/doc/src/standalone.xml @@ -4,6 +4,23 @@ + + + 2006 + 2007 + 2008 + 2009 + Vladimir Prus + + + + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) + + + Boost.Build V2 User Manual diff --git a/v2/doc/src/userman.xml b/v2/doc/src/userman.xml index a431800ba..915027dfa 100644 --- a/v2/doc/src/userman.xml +++ b/v2/doc/src/userman.xml @@ -4,6 +4,23 @@ + + + 2006 + 2007 + 2008 + 2009 + Vladimir Prus + + + + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) + + + Boost.Build V2 User Manual diff --git a/v2/test/BoostBuild.py b/v2/test/BoostBuild.py index 49db78476..9f7705cb6 100644 --- a/v2/test/BoostBuild.py +++ b/v2/test/BoostBuild.py @@ -131,8 +131,6 @@ if os.name == 'posix': def _failed(self, status=0): if self.status is None: return None - if os.WIFSIGNALED(status): - return None return _status(self) != status def _status(self): if os.WIFEXITED(self.status): @@ -458,8 +456,8 @@ class Tester(TestCmd.TestCmd): annotation("failure", '"%s" returned %d%s' % (kw['program'], _status(self), expect)) - - annotation("reason", "error returned by bjam") + + annotation("reason", "unexpected status returned by bjam") self.fail_test(1) if not (stdout is None) and not match(self.stdout(), stdout): diff --git a/v2/test/exit_status.py b/v2/test/exit_status.py new file mode 100755 index 000000000..11c4abf76 --- /dev/null +++ b/v2/test/exit_status.py @@ -0,0 +1,26 @@ +#!/usr/bin/python + +# Copyright (C) Vladimir Prus 2010. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# Test that build failure results in non-zero exit status + +import BoostBuild + +# Create a temporary working directory. +t = BoostBuild.Tester() + +# Create the needed files. +t.write("jamroot.jam", """ +exe hello : hello.cpp ; +""") + +t.write("hello.cpp", """ +int main() { +""") + +t.run_build_system(status=1) + +t.cleanup() diff --git a/v2/test/gcc_runtime.py b/v2/test/gcc_runtime.py index a7e57550f..696b6a5fd 100644 --- a/v2/test/gcc_runtime.py +++ b/v2/test/gcc_runtime.py @@ -23,7 +23,7 @@ t.write("hello.cpp", """ int main() { } """) -t.run_build_system("runtime-link=static", status=1) +t.run_build_system("runtime-link=static") t.fail_test(string.find(t.stdout(), "On gcc, DLL can't be build with 'static'") == -1) diff --git a/v2/test/test_all.py b/v2/test/test_all.py index 038c2928a..fad67fab6 100644 --- a/v2/test/test_all.py +++ b/v2/test/test_all.py @@ -201,7 +201,8 @@ tests = [ "absolute_sources", "use_requirements", "using", "wrapper", - "wrong_project" + "wrong_project", + "exit_status", ] if os.name == 'posix': diff --git a/v2/tools/boostbook-config.jam b/v2/tools/boostbook-config.jam index 0b91705f4..6e3f3ddc1 100644 --- a/v2/tools/boostbook-config.jam +++ b/v2/tools/boostbook-config.jam @@ -3,53 +3,11 @@ #~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) # Automatic configuration for BoostBook tools. To use, just import this module. +# +# This module is deprecated. +# using boostbook ; +# with no arguments now suffices. -import os ; import toolset : using ; -local docbook_xsl-path = [ modules.peek : DOCBOOK_XSL_DIR ] ; -local docbook_dtd-path = [ modules.peek : DOCBOOK_DTD_DIR ] ; -local boostbook-path = [ modules.peek : BOOSTBOOK_DIR ] ; -if [ os.name ] = NT -{ - # If installed by the Boost installer. - local boost-dir = ; - for local R in snapshot cvs 1.33.0 - { - boost-dir += [ W32_GETREG - "HKEY_LOCAL_MACHINE\\SOFTWARE\\Boost.org\\$(R)" - : "InstallRoot" ] ; - } - # Plausible locations. - local root = [ PWD ] ; - while $(root) != $(root:D) { root = $(root:D) ; } - docbook_xsl-path ?= [ GLOB "$(boost-dir)\\share" "$(root)Boost\\share" : docbook-xsl* ] ; - docbook_dtd-path ?= [ GLOB "$(boost-dir)\\share" "$(root)Boost\\share" : docbook-xml* ] ; - boostbook-path ?= [ GLOB "$(boost-dir)\\share" "$(root)Boost\\share" : boostbook* ] ; - - docbook_xsl-path = $(docbook_xsl-path[1]) ; - docbook_dtd-path = $(docbook_dtd-path[1]) ; - boostbook-path = $(boostbook-path[1]) ; -} -else -{ - # Plausible locations. - docbook_xsl-path ?= [ GLOB "/usr/local/share" "/usr/share" "/opt/share" : docbook-xsl* ] ; - docbook_dtd-path ?= [ GLOB "/usr/local/share" "/usr/share" "/opt/share" : docbook-xml* ] ; - boostbook-path ?= [ GLOB "/usr/local/share" "/usr/share" "/opt/share" : boostbook* ] ; - # Ubuntu Linux - docbook_xsl-path ?= [ GLOB "/usr/share/xml/docbook/stylesheet" : nwalsh ] ; - docbook_dtd-path ?= [ GLOB "/usr/share/xml/docbook/schema/dtd" : 4.3 4.2 ] ; - - docbook_xsl-path = $(docbook_xsl-path[1]) ; - docbook_dtd-path = $(docbook_dtd-path[1]) ; - boostbook-path = $(boostbook-path[1]) ; -} -if $(docbook_xsl-path) && $(docbook_dtd-path) -{ - if --debug-configuration in [ modules.peek : ARGV ] - { - ECHO "notice:" using boostbook ":" $(docbook_xsl-path) ":" $(docbook_dtd-path) ":" $(boostbook-path) ; - } - using boostbook : $(docbook_xsl-path) : $(docbook_dtd-path) : $(boostbook-path) ; -} +using boostbook ; diff --git a/v2/tools/boostbook.jam b/v2/tools/boostbook.jam index 92296050a..47f8a326c 100644 --- a/v2/tools/boostbook.jam +++ b/v2/tools/boostbook.jam @@ -22,6 +22,7 @@ import regex ; import scanner ; import sequence ; import make ; +import os ; import type ; import modules path project ; import build-system ; @@ -56,71 +57,26 @@ type.register BOOSTBOOK_MAIN ; # Initialize BoostBook support. The parameters are: # docbook-xsl-dir: The DocBook XSL stylesheet directory. If not provided, -# we use DOCBOOK_XSL_DIR from the environment (if available). Otherwise, -# we let the XML processor load the stylesheets remotely. +# we use DOCBOOK_XSL_DIR from the environment (if available) or look in +# standard locations. Otherwise, we let the XML processor load the +# stylesheets remotely. # # 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. +# DOCBOOK_DTD_DIR From the environment (if available) or look in +# standard locations. Otherwise, we let the XML processor load the +# DTD remotely. # # boost-book-dir: The BoostBook directory with the DTD and XSL subdirs. # rule init ( docbook-xsl-dir ? : docbook-dtd-dir ? : boostbook-dir ? ) { - docbook-xsl-dir ?= [ modules.peek : DOCBOOK_XSL_DIR ] ; - - docbook-dtd-dir ?= [ modules.peek : DOCBOOK_DTD_DIR ] ; - if ! $(.initialized) { .initialized = true ; - if $(docbook-xsl-dir) - { - .docbook-xsl-dir = [ path.make $(docbook-xsl-dir) ] ; - } - if $(docbook-dtd-dir) - { - .docbook-dtd-dir = [ path.make $(docbook-dtd-dir) ] ; - } - - local boost-root = [ modules.peek : BOOST_ROOT ] ; - if $(boost-root) - { - boost-root = [ path.make $(boost-root) ] ; - } - local boost-build-root = [ build-system.location ] ; - local search-dirs = $(boostbook-dir) [ path.join $(boost-root) tools boostbook ] - $(boost-build-root)/../../boostbook ; - - - if --debug-configuration in [ modules.peek : ARGV ] - { - ECHO "notice: Boost.Book: searching XSLS/DTD in" ; - ECHO "notice:" [ sequence.transform path.native : $(search-dirs) ] ; - } - local boostbook-xsl-dir ; - for local dir in $(search-dirs) { - boostbook-xsl-dir += [ path.glob $(dir) : xsl ] ; - } - local boostbook-dtd-dir ; - for local dir in $(search-dirs) { - boostbook-dtd-dir += [ path.glob $(dir) : dtd ] ; - } - .boostbook-xsl-dir = $(boostbook-xsl-dir[1]) ; - .boostbook-dtd-dir = $(boostbook-dtd-dir[1]) ; - - - if ! $(.boostbook-xsl-dir) || ! $(.boostbook-dtd-dir) - { - errors.warning - "couldn't find BoostBook xsl or dtd directories;" - : please set \"BOOST_ROOT\" variable to the root directory of - your boost installation. Searched in: - : $(search-dirs:J=" -") ; - } + find-tools $(docbook-xsl-dir) : $(docbook-dtd-dir) : $(boostbook-dir) ; + # Register generators only if we've were called via "using boostbook ; " generators.register-standard boostbook.dtdxml-to-boostbook : DTDXML : XML ; generators.register-standard boostbook.boostbook-to-docbook : XML : DOCBOOK ; @@ -137,6 +93,160 @@ rule init ( docbook-xsl-dir ? : docbook-dtd-dir ? : boostbook-dir ? ) } } +rule find-boost-in-registry ( keys * ) +{ + local boost-root = ; + for local R in $(keys) + { + local installed-boost = [ W32_GETREG + "HKEY_LOCAL_MACHINE\\SOFTWARE\\$(R)" + : "InstallRoot" ] ; + if $(installed-boost) + { + boost-root += [ path.make $(installed-boost) ] ; + } + } + return $(boost-root) ; +} + +rule find-tools ( docbook-xsl-dir ? : docbook-dtd-dir ? : boostbook-dir ? ) +{ + docbook-xsl-dir ?= [ modules.peek : DOCBOOK_XSL_DIR ] ; + docbook-dtd-dir ?= [ modules.peek : DOCBOOK_DTD_DIR ] ; + boostbook-dir ?= [ modules.peek : BOOSTBOOK_DIR ] ; + + # Look for the boostbook stylesheets relative to BOOST_ROOT + # and Boost.Build. + local boost-build-root = [ path.make [ build-system.location ] ] ; + local boostbook-search-dirs = [ path.join $(boost-build-root) .. .. ] ; + + local boost-root = [ modules.peek : BOOST_ROOT ] ; + if $(boost-root) + { + boostbook-search-dirs += [ path.join [ path.make $(boost-root) ] tools ] ; + } + boostbook-dir ?= [ path.glob $(boostbook-search-dirs) : boostbook* ] ; + + # Try to find the tools in platform specific locations + if [ os.name ] = NT + { + # If installed by the Boost installer. + local boost-root = ; + + local boost-installer-versions = snapshot cvs 1.33.0 ; + local boost-consulting-installer-versions = 1.33.1 1.34.0 1.34.1 ; + local boostpro-installer-versions = + 1.35.0 1.36.0 1.37.0 1.38.0 1.39.0 1.40.0 1.41.0 1.42.0 + 1.43.0 1.44.0 1.45.0 1.46.0 1.47.0 1.48.0 1.49.0 1.50.0 ; + + local old-installer-root = [ find-boost-in-registry Boost.org\\$(boost-installer-versions) ] ; + + # Make sure that the most recent version is searched for first + boost-root += [ sequence.reverse + [ find-boost-in-registry + Boost-Consulting.com\\$(boost-consulting-installer-versions) + boostpro.com\\$(boostpro-installer-versions) ] ] ; + + # Plausible locations. + local root = [ PWD ] ; + while $(root) != $(root:D) { root = $(root:D) ; } + root = [ path.make $(root) ] ; + local search-dirs = ; + local docbook-search-dirs = ; + for local p in $(boost-root) { + search-dirs += [ path.join $(p) tools ] ; + } + for local p in $(old-installer-root) + { + search-dirs += [ path.join $(p) share ] ; + docbook-search-dirs += [ path.join $(p) share ] ; + } + search-dirs += [ path.join $(root) Boost tools ] ; + search-dirs += [ path.join $(root) Boost share ] ; + docbook-search-dirs += [ path.join $(root) Boost share ] ; + + docbook-xsl-dir ?= [ path.glob $(docbook-search-dirs) : docbook-xsl* ] ; + docbook-dtd-dir ?= [ path.glob $(docbook-search-dirs) : docbook-xml* ] ; + boostbook-dir ?= [ path.glob $(search-dirs) : boostbook* ] ; + } + else + { + # Plausible locations. + + local share = /usr/local/share /usr/share /opt/share /opt/local/share ; + local dtd-versions = 4.2 ; + + docbook-xsl-dir ?= [ path.glob $(share) : docbook-xsl* ] ; + docbook-xsl-dir ?= [ path.glob $(share)/sgml/docbook : xsl-stylesheets ] ; + docbook-xsl-dir ?= [ path.glob $(share)/xsl : docbook* ] ; + + docbook-dtd-dir ?= [ path.glob $(share) : docbook-xml* ] ; + docbook-dtd-dir ?= [ path.glob $(share)/sgml/docbook : xml-dtd-$(dtd-versions)* ] ; + docbook-dtd-dir ?= [ path.glob $(share)/xml/docbook : $(dtd-versions) ] ; + + boostbook-dir ?= [ path.glob $(share) : boostbook* ] ; + + # Ubuntu Linux + docbook-xsl-dir ?= [ path.glob /usr/share/xml/docbook/stylesheet : nwalsh ] ; + docbook-dtd-dir ?= [ path.glob /usr/share/xml/docbook/schema/dtd : $(dtd-versions) ] ; + } + + if $(docbook-xsl-dir) + { + .docbook-xsl-dir = [ path.make $(docbook-xsl-dir[1]) ] ; + } + if $(docbook-dtd-dir) + { + .docbook-dtd-dir = [ path.make $(docbook-dtd-dir[1]) ] ; + } + + if --debug-configuration in [ modules.peek : ARGV ] + { + ECHO "notice: Boost.Book: searching XSL/DTD in" ; + ECHO "notice:" [ sequence.transform path.native : $(boostbook-dir) ] ; + } + local boostbook-xsl-dir ; + for local dir in $(boostbook-dir) { + boostbook-xsl-dir += [ path.glob $(dir) : xsl ] ; + } + local boostbook-dtd-dir ; + for local dir in $(boostbook-dir) { + boostbook-dtd-dir += [ path.glob $(dir) : dtd ] ; + } + .boostbook-xsl-dir = $(boostbook-xsl-dir[1]) ; + .boostbook-dtd-dir = $(boostbook-dtd-dir[1]) ; + + if --debug-configuration in [ modules.peek : ARGV ] + { + if $(.docbook-xsl-dir) + { + ECHO "notice: Boost.Book: found docbook XSL stylesheets in:" [ path.native $(.docbook-xsl-dir) ] ; + } + if $(.docbook-dtd-dir) + { + ECHO "notice: Boost.Book: found docbook DTD in:" [ path.native $(.docbook-dtd-dir) ] ; + } + if $(.boostbook-xsl-dir) + { + ECHO "notice: Boost.Book: found boostbook XSL stylesheets in:" [ path.native $(.boostbook-xsl-dir) ] ; + } + if $(.boostbook-dtd-dir) + { + ECHO "notice: Boost.Book: found boostbook DTD in:" [ path.native $(.boostbook-dtd-dir) ] ; + } + } + + if ! $(.boostbook-xsl-dir) || ! $(.boostbook-dtd-dir) + { + errors.warning + "couldn't find BoostBook xsl or dtd directories;" + : please set \"BOOST_ROOT\" variable to the root directory of + your boost installation. Searched in: + : $(boostbook-dir:J=" +") ; + } +} + rule xsl-dir { return $(.boostbook-xsl-dir) ; @@ -205,6 +315,28 @@ 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 + { + local native-path = [ path.native $(path) ] ; + result = [ path.make $(native-path:W) ] ; + } + } + return [ regex.replace $(result) " " "%20" ] ; +} + rule generate-xml-catalog ( target : sources * : properties * ) { print.output $(target) ; @@ -213,7 +345,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 @@ -238,7 +370,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 " " ; } @@ -255,7 +387,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 " " ; } diff --git a/v2/tools/como-win.jam b/v2/tools/como-win.jam index a351177e4..d21a70d6f 100644 --- a/v2/tools/como-win.jam +++ b/v2/tools/como-win.jam @@ -110,8 +110,8 @@ actions compile.c++ $(CONFIG_COMMAND) -c -e5 --no_version --no_prelink_verbose --display_error_number --long_long --diag_suppress=9,21,161,748,940,962 --diag_error=461 -D__STL_LONG_LONG -U$(UNDEFS) -D$(DEFINES) $(WARN) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -I"$(SYSHDRS)" -o "$(<)" "$(>)" } -actions updated together piecemeal archive +actions archive { - $(CONFIG_COMMAND) --no_version --no_prelink_verbose --prelink_object "$(>)" - lib $(ARFLAGS) /nologo /out:"$(<:S=.lib)" "$(>)" + $(CONFIG_COMMAND) --no_version --no_prelink_verbose --prelink_object @"@($(<[1]:W).rsp:E=$(nl)"$(>)")" + lib $(ARFLAGS) /nologo /out:"$(<:S=.lib)" @"@($(<[1]:W).rsp:E=$(nl)"$(>)")" } diff --git a/v2/tools/darwin.jam b/v2/tools/darwin.jam index a14987c33..703803ad5 100644 --- a/v2/tools/darwin.jam +++ b/v2/tools/darwin.jam @@ -3,7 +3,7 @@ # Copyright 2003, 2004, 2005, 2006 Vladimir Prus # Copyright 2005-2007 Mat Marcus # Copyright 2005-2007 Adobe Systems Incorporated -# Copyright 2007-2009 Rene Rivera +# Copyright 2007-2010 Rene Rivera # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) @@ -30,6 +30,9 @@ feature macosx-version : : propagated link-incompatible symmetric optional ; ## The minimal MacOSX version to target. feature macosx-version-min : : propagated optional ; +## A dependency, that is forced to be included in the link. +feature force-load : : free dependency incidental ; + ############################################################################# if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] @@ -262,9 +265,9 @@ local rule init-sdk ( condition * : root ? : version + : version-feature ? ) case mac* : { flags darwin.compile OPTIONS $(version-feature) - : -miphoneos-version-min=$(version[2-]:J=.) ; + : -mmacosx-version-min=$(version[2-]:J=.) ; flags darwin.link OPTIONS $(version-feature) - : -miphoneos-version-min=$(version[2-]:J=.) ; + : -mmacosx-version-min=$(version[2-]:J=.) ; } } @@ -484,6 +487,9 @@ flags darwin.compile OPTIONS : -no-cpp-precomp -gdwarf-2 ; # Add the framework names to use. flags darwin.link FRAMEWORK ; +# +flags darwin.link FORCE_LOAD ; + # This is flag is useful for debugging the link step # uncomment to see what libtool is doing under the hood #~ flags darwin.link.dll OPTIONS : -Wl,-v ; @@ -511,6 +517,7 @@ local rule prepare-framework-path ( target + ) rule link ( targets * : sources * : properties * ) { + DEPENDS $(targets) : [ on $(targets) return $(FORCE_LOAD) ] ; setup-address-model $(targets) : $(sources) : $(properties) ; prepare-framework-path $(<) ; } @@ -519,9 +526,9 @@ rule link ( targets * : sources * : properties * ) # binaries, at least on OS X 10.5.5, see: # http://svn.boost.org/trac/boost/ticket/2347 # So we pass -S -x. -actions link bind LIBRARIES +actions link bind LIBRARIES FORCE_LOAD { - "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(FRAMEWORK_PATH) -framework$(_)$(FRAMEWORK:D=:S=) $(OPTIONS) $(USER_OPTIONS) + "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<)" "$(>)" -Wl,-force_load$(_)"$(FORCE_LOAD)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(FRAMEWORK_PATH) -framework$(_)$(FRAMEWORK:D=:S=) $(OPTIONS) $(USER_OPTIONS) $(NEED_STRIP)"$(.STRIP)" $(NEED_STRIP)-S $(NEED_STRIP)-x $(NEED_STRIP)"$(<)" } diff --git a/v2/tools/doxygen.jam b/v2/tools/doxygen.jam index 0c6682958..ebc9f017b 100644 --- a/v2/tools/doxygen.jam +++ b/v2/tools/doxygen.jam @@ -37,6 +37,7 @@ import alias ; import common ; import modules ; import project ; +import utility ; # Use to specify extra configuration paramters. These get translated @@ -64,6 +65,9 @@ feature.feature doxygen.doxproc.title : : free ; # Location for images when generating XML feature.feature doxygen:xml-imagedir : : free ; +# Indicates whether the entire directory should be deleted +feature.feature doxygen.rmdir : off on : optional incidental ; + # Doxygen configuration input file. type.register DOXYFILE : doxyfile ; @@ -140,6 +144,11 @@ rule init ( name ? ) ECHO "notice:" using doxygen ":" $(.doxygen) ; } + if [ .is-cygwin ] + { + .is-cygwin = true ; + } + .doxproc = [ modules.binding $(__name__) ] ; .doxproc = $(.doxproc:D)/doxproc.py ; @@ -170,6 +179,22 @@ rule name ( ) return $(.doxygen) ; } +rule .is-cygwin ( ) +{ + if [ os.on-windows ] + { + local file = [ path.make [ modules.binding $(__name__) ] ] ; + local dir = [ path.native + [ path.join [ path.parent $(file) ] doxygen ] ] ; + local command = + "cd \"$(dir)\" && \"$(.doxygen)\" windows-paths-check.doxyfile 2>&1" ; + result = [ SHELL $(command) ] ; + if [ MATCH "(Parsing file /)" : $(result) ] + { + return true ; + } + } +} # Runs Doxygen on the given Doxygen configuration file (the source) to generate # the Doxygen files. The output is dumped according to the settings in the @@ -192,6 +217,48 @@ actions doxproc } +rule translate-path ( path ) +{ + if [ os.on-windows ] + { + if [ os.name ] = CYGWIN + { + if $(.is-cygwin) + { + return $(path) ; + } + else + { + return $(path:W) ; + } + } + else + { + if $(.is-cygwin) + { + match = [ MATCH ^(.):(.*) : $(path) ] ; + if $(match) + { + return /cygdrive/$(match[1])$(match[2]:T) ; + } + else + { + return $(path:T) ; + } + } + else + { + return $(path) ; + } + } + } + else + { + return $(path) ; + } +} + + # Generates a doxygen configuration file (doxyfile) given a set of C++ sources # and a property list that may contain features. # @@ -205,20 +272,30 @@ rule headers-to-doxyfile ( target : sources * : properties * ) for local param in [ feature.get-values : $(properties) ] { local namevalue = [ regex.match ([^=]*)=(.*) : $(param) ] ; - text += "$(namevalue[1]) = $(namevalue[2])" ; if $(namevalue[1]) = OUTPUT_DIRECTORY { - output-dir = "$(namevalue[2])" ; + output-dir = [ translate-path + [ utility.unquote $(namevalue[2]) ] ] ; + text += "OUTPUT_DIRECTORY = \"$(output-dir)\"" ; + } + else + { + text += "$(namevalue[1]) = $(namevalue[2])" ; } } if ! $(output-dir) { - output-dir = [ on $(target) return $(LOCATE) ] ; + output-dir = [ translate-path [ on $(target) return $(LOCATE) ] ] ; text += "OUTPUT_DIRECTORY = \"$(output-dir)\"" ; } - local headers = \"$(sources:G=)\" ; + local headers = ; + for local header in $(sources:G=) + { + header = [ translate-path $(header) ] ; + headers += \"$(header)\" ; + } # Doxygen generates LaTex by default. So disable it unconditionally, or at # least until someone needs, and hence writes support for, LaTex output. @@ -234,6 +311,24 @@ rule headers-to-doxyfile ( target : sources * : properties * ) # rule run ( target : source : properties * ) { + if on in $(properties) + { + local output-dir = + [ path.make + [ MATCH OUTPUT_DIRECTORY=\"?([^\"]*) : + $(properties) ] ] ; + local html-dir = + [ path.make + [ MATCH HTML_OUTPUT=(.*) : + $(properties) ] ] ; + if $(output-dir) && $(html-dir) && + [ path.glob $(output-dir) : $(html-dir) ] + { + HTMLDIR on $(target) = + [ path.native [ path.join $(output-dir) $(html-dir) ] ] ; + rm-htmldir $(target) ; + } + } doxygen-action $(target) : $(source) ; NAME on $(target) = $(.doxygen) ; RM on $(target) = [ modules.peek common : RM ] ; @@ -245,6 +340,19 @@ rule run ( target : source : properties * ) *.xml ] ] ; } +if [ os.name ] = NT +{ + RMDIR = rmdir /s /q ; +} +else +{ + RMDIR = rm -rf ; +} + +actions quietly rm-htmldir +{ + $(RMDIR) $(HTMLDIR) +} # The rules below require Boost.Book stylesheets, so we need some code to check # that the boostbook module has actualy been initialized. @@ -355,10 +463,29 @@ rule copy-latex-pngs ( target : source : requirements * ) local directory = [ path.native [ feature.get-values : $(requirements) ] ] ; + + local location = [ on $(target) return $(LOCATE) ] ; + + local pdf-location = + [ path.native + [ path.join + [ path.make $(location) ] + [ path.make $(directory) ] ] ] ; + local html-location = + [ path.native + [ path.join + . + html + [ path.make $(directory) ] ] ] ; + + common.MkDir $(pdf-location) ; + common.MkDir $(html-location) ; + + DEPENDS $(target) : $(pdf-location) $(html-location) ; + if [ os.name ] = NT { CP on $(target) = copy /y ; - MKDIR on $(target) = mkdir ; FROM on $(target) = \\*.png ; TOHTML on $(target) = .\\html\\$(directory) ; TOPDF on $(target) = \\$(directory) ; @@ -366,7 +493,6 @@ rule copy-latex-pngs ( target : source : requirements * ) else { CP on $(target) = cp ; - MKDIR on $(target) = mkdir -p ; FROM on $(target) = /*.png ; TOHTML on $(target) = ./html/$(directory) ; TOPDF on $(target) = $(target:D)/$(directory) ; @@ -375,8 +501,6 @@ rule copy-latex-pngs ( target : source : requirements * ) actions copy-latex-pngs { - $(MKDIR) $(TOHTML) - $(MKDIR) $(<:D)$(TOPDF) $(CP) $(>:S=)$(FROM) $(TOHTML) $(CP) $(>:S=)$(FROM) $(<:D)$(TOPDF) echo "Stamped" > "$(<)" @@ -520,6 +644,8 @@ rule doxygen ( target : sources * : requirements * : default-build * : usage-req [ new typed-target $(target:S=.dir) : $(project) : DOXYGEN_HTML_MULTIFILE : $(target:S=.tag) : [ targets.main-target-requirements $(requirements) + "OUTPUT_DIRECTORY=\"$(output-dir-native)\"" + HTML_OUTPUT=$(target:B) : $(project) ] : [ targets.main-target-default-build $(default-build) : $(project) ] ] ; @@ -549,6 +675,7 @@ rule doxygen ( target : sources * : requirements * : default-build * : usage-req { doxygen $(target).doxygen-xml-images.html : $(sources) : $(requirements) + on QUIET=YES WARNINGS=NO WARN_IF_UNDOCUMENTED=NO diff --git a/v2/tools/doxygen/windows-paths-check.doxyfile b/v2/tools/doxygen/windows-paths-check.doxyfile new file mode 100644 index 000000000..9b969df9c --- /dev/null +++ b/v2/tools/doxygen/windows-paths-check.doxyfile @@ -0,0 +1,3 @@ +INPUT = windows-paths-check.hpp +GENERATE_HTML = NO +GENERATE_LATEX = NO diff --git a/v2/tools/doxygen/windows-paths-check.hpp b/v2/tools/doxygen/windows-paths-check.hpp new file mode 100644 index 000000000..e69de29bb diff --git a/v2/tools/mpi.jam b/v2/tools/mpi.jam index 38012474e..9dd27ec63 100644 --- a/v2/tools/mpi.jam +++ b/v2/tools/mpi.jam @@ -336,6 +336,65 @@ rule init ( mpicxx ? : options * : mpirun-with-options * ) compile_flags = [ SHELL "$(command) -compile_info" ] ; link_flags = [ SHELL "$(command) -link_info" ] ; } + # Sun HPC and Ibm POE + else if [ SHELL "$(command) -v 2>/dev/null" ] + { + compile_flags = [ SHELL "$(command) -c -v -xtarget=native64 2>/dev/null" ] ; + + local back = [ MATCH "--------------------(.*)" : $(compile_flags) ] ; + if $(back) + { + # Sun HPC + if $(.debug-configuration) + { + ECHO "Found Sun MPI wrapper compiler: $(command)" ; + } + + compile_flags = [ MATCH "(.*)--------------------" : $(back) ] ; + compile_flags = [ MATCH "(.*)-v" : $(compile_flags) ] ; + link_flags = [ SHELL "$(command) -v -xtarget=native64 2>/dev/null" ] ; + link_flags = [ MATCH "--------------------(.*)" : $(link_flags) ] ; + link_flags = [ MATCH "(.*)--------------------" : $(link_flags) ] ; + + # strip out -v from compile options + local front = [ MATCH "(.*)-v" : $(link_flags) ] ; + local back = [ MATCH "-v(.*)" : $(link_flags) ] ; + link_flags = "$(front) $(back)" ; + front = [ MATCH "(.*)-xtarget=native64" : $(link_flags) ] ; + back = [ MATCH "-xtarget=native64(.*)" : $(link_flags) ] ; + link_flags = "$(front) $(back)" ; + } + else + { + # Ibm POE + if $(.debug-configuration) + { + ECHO "Found IBM MPI wrapper compiler: $(command)" ; + } + + # + compile_flags = [ SHELL "$(command) -c -v 2>/dev/null" ] ; + compile_flags = [ MATCH "(.*)exec: export.*" : $(compile_flags) ] ; + local front = [ MATCH "(.*)-v" : $(compile_flags) ] ; + local back = [ MATCH "-v(.*)" : $(compile_flags) ] ; + compile_flags = "$(front) $(back)" ; + front = [ MATCH "(.*)-c" : $(compile_flags) ] ; + back = [ MATCH "-c(.*)" : $(compile_flags) ] ; + compile_flags = "$(front) $(back)" ; + link_flags = $(compile_flags) ; + + # get location of mpif.h from mpxlf + local f_flags = [ SHELL "mpxlf -v 2>/dev/null" ] ; + f_flags = [ MATCH "(.*)exec: export.*" : $(f_flags) ] ; + front = [ MATCH "(.*)-v" : $(f_flags) ] ; + back = [ MATCH "-v(.*)" : $(f_flags) ] ; + f_flags = "$(front) $(back)" ; + f_flags = [ MATCH "xlf_r(.*)" : $(f_flags) ] ; + f_flags = [ MATCH "-F:mpxlf_r(.*)" : $(f_flags) ] ; + compile_flags = [ strip-eol $(compile_flags) ] ; + compile_flags = "$(compile_flags) $(f_flags)" ; + } + } if $(result) || $(compile_flags) && $(link_flags) { @@ -493,6 +552,9 @@ rule capture-output ( target : sources * : properties * ) local num_processes = [ property.select : $(properties) ] ; num_processes = $(num_processes:G=) ; + # serialize the MPI tests to avoid overloading systems + JAM_SEMAPHORE on $(target) = mpi-run-semaphore ; + # We launch MPI processes using the "mpirun" equivalent specified by the user. LAUNCHER on $(target) = [ on $(target) return $(.mpirun) $(.mpirun_flags) $(num_processes) ] ; diff --git a/v2/tools/testing.jam b/v2/tools/testing.jam index 25398ee72..c42075b78 100644 --- a/v2/tools/testing.jam +++ b/v2/tools/testing.jam @@ -205,12 +205,12 @@ rule dump-tests local rule get-library-name ( path ) { # Path is in normalized form, so all slashes are forward. - local match1 = [ MATCH /libs/(.*)/(test|example) : $(path) ] ; - local match2 = [ MATCH /libs/(.*)$ : $(path) ] ; + local match1 = [ MATCH /(tools|libs)/(.*)/(test|example) : $(path) ] ; + local match2 = [ MATCH /(tools|libs)/(.*)$ : $(path) ] ; local match3 = [ MATCH (/status$) : $(path) ] ; - if $(match1) { return $(match1[0]) ; } - else if $(match2) { return $(match2[0]) ; } + if $(match1) { return $(match1[2]) ; } + else if $(match2) { return $(match2[2]) ; } else if $(match3) { return "" ; } else if --dump-tests in [ modules.peek : ARGV ] { diff --git a/v2/tools/xsltproc.jam b/v2/tools/xsltproc.jam index e0be7561c..900800a46 100644 --- a/v2/tools/xsltproc.jam +++ b/v2/tools/xsltproc.jam @@ -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 ; @@ -31,11 +34,42 @@ rule init ( xsltproc ? ) if ! $(.initialized) { - $(.initialized) = true ; + .initialized = true ; .xsltproc = $(xsltproc) ; + .is-cygwin = [ .is-cygwin $(xsltproc:E=xsltproc) ] ; } } +# Returns a non-empty string if a cygwin xsltproc binary was specified. +rule is-cygwin ( ) +{ + if ! $(.initialized) + { + init ; + } + 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 + { + dir = $(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 * ) { @@ -72,7 +106,7 @@ rule compute-xslt-flags ( target : properties * ) for local dir in $(implicit-target-directories) { - flags += --path \"$(dir)\" ; + flags += --path \"$(dir:T)\" ; } return $(flags) ; @@ -87,7 +121,12 @@ local rule .xsltproc ( target : source stylesheet : properties * : dirname ? : a for local catalog in [ feature.get-values : $(properties) ] { - CATALOG = [ common.variable-setting-command XML_CATALOG_FILES : $(catalog) ] ; + CATALOG = [ common.variable-setting-command XML_CATALOG_FILES : $(catalog:T) ] ; + } + + if [ os.on-windows ] && ! [ is-cygwin ] + { + action = $(action).windows ; } $(action) $(target) : $(source) ; @@ -105,14 +144,25 @@ rule xslt-dir ( target : source stylesheet : properties * : dirname ) return [ .xsltproc $(target) : $(source) $(stylesheet) : $(properties) : $(dirname) : xslt-xsltproc-dir ] ; } +actions xslt-xsltproc.windows +{ + $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<)" "$(STYLESHEET:W)" "$(>:W)" +} + actions xslt-xsltproc bind STYLESHEET { - $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<)" "$(STYLESHEET)" "$(>)" + $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<)" "$(STYLESHEET:T)" "$(>:T)" +} + + +actions xslt-xsltproc-dir.windows bind STYLESHEET +{ + $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<:D)/" "$(STYLESHEET:W)" "$(>:W)" } actions xslt-xsltproc-dir bind STYLESHEET { - $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<:D)/" "$(STYLESHEET)" "$(>)" + $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<:D)/" "$(STYLESHEET:T)" "$(>:T)" } diff --git a/v2/tools/xsltproc/included.xsl b/v2/tools/xsltproc/included.xsl new file mode 100644 index 000000000..ef86394a9 --- /dev/null +++ b/v2/tools/xsltproc/included.xsl @@ -0,0 +1,11 @@ + + + + diff --git a/v2/tools/xsltproc/test.xml b/v2/tools/xsltproc/test.xml new file mode 100644 index 000000000..57c8ba187 --- /dev/null +++ b/v2/tools/xsltproc/test.xml @@ -0,0 +1,2 @@ + + diff --git a/v2/tools/xsltproc/test.xsl b/v2/tools/xsltproc/test.xsl new file mode 100644 index 000000000..a142c91dd --- /dev/null +++ b/v2/tools/xsltproc/test.xsl @@ -0,0 +1,12 @@ + + + + + diff --git a/v2/util/print.jam b/v2/util/print.jam index 464381b5c..9db214ed0 100644 --- a/v2/util/print.jam +++ b/v2/util/print.jam @@ -12,6 +12,9 @@ import modules ; import numbers ; import string ; import regex ; +import "class" ; +import scanner ; +import path ; # The current output target. Defaults to console. output-target = console ; @@ -341,6 +344,11 @@ rule text ( text-content on $(output-target) = ; text-action $(output-target) ; + + if $(overwrite) && $(output-target) != console + { + check-for-update $(output-target) ; + } } $(output-target).text-$(prefix-body-suffix) += $(strings) ; text-content on $(output-target) = @@ -394,6 +402,72 @@ actions quietly text-action } +rule get-scanner ( ) +{ + if ! $(.scanner) + { + .scanner = [ class.new print-scanner ] ; + } + return $(.scanner) ; +} + + +# The following code to update print targets when their contents +# change is a horrible hack. It basically creates a target which +# binds to this file (print.jam) and installs a scanner on it +# which reads the target and compares its contents to the new +# contents that we're writing. +# +rule check-for-update ( target ) +{ + local scanner = [ get-scanner ] ; + local file = [ path.native [ modules.binding $(__name__) ] ] ; + local g = [ MATCH <(.*)> : $(target:G) ] ; + local dependency-target = $(__file__:G=$(g)-$(target:G=)-$(scanner)) ; + DEPENDS $(target) : $(dependency-target) ; + SEARCH on $(dependency-target) = $(file:D) ; + ISFILE $(dependency-target) ; + NOUPDATE $(dependency-target) ; + base on $(dependency-target) = $(target) ; + scanner.install $(scanner) : $(dependency-target) none ; + return $(dependency-target) ; +} + + +class print-scanner : scanner +{ + import path ; + import os ; + + rule pattern ( ) + { + return "(One match...)" ; + } + + rule process ( target : matches * : binding ) + { + local base = [ on $(target) return $(base) ] ; + local nl = [ on $(base) return $(nl) ] ; + local text-content = [ on $(base) return $(text-content) ] ; + local dir = [ path.make [ on $(base) return $(LOCATE) ] ] ; + local file = [ path.native [ path.join $(dir) $(base:G=) ] ] ; + local actual-content ; + if [ os.name ] = NT + { + actual-content = [ SHELL "type \"$(file)\" 2>nul" ] ; + } + else + { + actual-content = [ SHELL "cat \"$(file)\" 2>/dev/null" ] ; + } + if $(text-content:J=$(nl)) != $(actual-content) + { + ALWAYS $(base) ; + } + } +} + + rule __test__ ( ) { import assert ;