いぇっとあなざビルド済みぶぅすとらいぶりゃり

Boost の Jamroot でやっていることと http://tinyurl.com/5towdt でやっていることをパクっただけといううわさ.っていうか, http://tinyurl.com/66fv37 でいーじゃーんという声はあーあーあー聞こえない.

# Copyright Vladimir Prus 2002-2006.
# Copyright Dave Abrahams 2005-2006.
# Copyright Rene Rivera 2005-2007.
# Copyright Douglas Gregor 2005.
#
# 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)

# Copyright Takeshi Mouri 2007.
# 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)

# prebuilt-boost-lib.jam

import common ;
import errors ;
import feature ;
import modules ;
import os ;
import path ;
import regex ;


local global-version-tag ;
local global-lib-version ;
local global-build-id ;

# Search a prebuilt boost library. The syntax is same to 'lib' target,
# except that the 'sources' argument is omitted. There is an additional argument
# 'build-id', which must be equal to the "buildid" specified
# when boost libraries were built. Typical usage is the following,
#
#   import prebuilt-boost-lib ;
#   prebuilt-boost-lib boost-thread : <name>boost_thread : : <threading>multi ;
#   exe my-exe : my.cpp boost-thread ;
#
# 'BOOST_INCLUDE_PATH' or 'BOOST_ROOT' environment should be specified.
rule prebuilt-boost-lib ( name : requirements * : default-build * : usage-requirements * : build-id ? )
{
  local version-tag = [ get-boost-version-tag ] ;
  local lib-version = [ get-boost-lib-version ] ;

  tagged-lib $(name) : : $(requirements) : $(default-build) : $(usage-requirements) : $(version-tag) : $(lib-version) : $(build-id) ;
}

local rule tagged-lib ( name : sources * : requirements * : default-build * : usage-requirements * : version-tag ? : lib-version ? : build-id ? )
{
  global-version-tag = $(version-tag) ;
  global-lib-version = $(lib-version) ;
  global-build-id = $(build-id) ;

  lib $(name) : $(sources) : $(requirements) <tag>@$(__name__).tag : $(default-build) : $(usage-requirements) ;
}

rule tag ( name : type ? : property-set )
{
  if $(type) != SEARCHED_LIB
  {
    errors.user-error boost-prebuilt-lib called as a non-SEARCHED_LIB target ;
  }

  local link = [ $(property-set).get <link> ] ;
  local type = ;

  if $(link) = static
  {
    type = "STATIC_LIB" ;
  }
  else if $(link) = shared
  {
    if [ os.name ] = NT || [ $(property-set).get <target-os> ] in windows
    {
      type = IMPORT_LIB ;
    }
    else
    {
      type = SHARED_LIB ;
    }
  }
  else
  {
    errors.error a logic error ;
  }

  local result
    = [ common.format-name
            <base> <toolset> <threading> <runtime> -$(global-version-tag) -$(global-build-id)
          : $(name)
          : $(type)
          : $(property-set) ] ;

  # Optionally add version suffix.
  # On NT, library with version suffix won't be recognized
  # by linkers. On CYGWIN, we get strage duplicate symbol
  # errors when library is generated with version suffix.
  # On OSX, version suffix is not needed -- the linker expets
  # libFoo.1.2.3.dylib format.
  # AIX linkers don't accept version suffixes either.
  # Pgi compilers can't accept library with version suffix
  if $(type) = SHARED_LIB &&
     ( ! ( [ $(property-set).get <target-os> ] in windows cygwin darwin aix ) &&
       ! ( [ $(property-set).get <toolset> ] in pgi ) )
  {
    result = $(result).$(global-lib-version)  ;
  }

  return $(result) ;
}

local rule get-boost-version-tag ( )
{
  local boost-include-path = [ modules.peek : BOOST_INCLUDE_PATH ] ;
  local boost-root =  [ modules.peek : BOOST_ROOT ] ;
  if $(boost-root) {
    boost-include-path ?= $(boost-root)/boost ;
  }
  if ! $(boost-include-path)
  {
    errors.user-error boost include path cannot be found ;
  }

  local CATENATE ;
  if [ os.name ] = NT
  {
    CATENATE = type ;
  }
  else
  {
    CATENATE = cat ;
  }
  if ! [ path.exists $(boost-include-path)/version.hpp ]
  {
    errors.user-error version.hpp not found ;
  }
  local ph = [ path.native $(boost-include-path)/version.hpp ] ;
  local version.hpp = [ SHELL "$(CATENATE) $(ph)" ] ;
  local pattern = "#define BOOST_LIB_VERSION \"([_0-9]+)\"" ;
  return [ MATCH $(pattern) : $(version.hpp) ] ;
}

local rule get-boost-lib-version ( )
{
  local v = [ get-boost-version-tag ] ;
  v = [ MATCH ^([0-9]+)_([0-9]+)_?([0-9]*)$ : $(v) ] ;
  if ! $(v[3])
  {
    v = $(v[1-2]) 0 ;
  }
  return $(v:J=.) ;
}

IMPORT $(__name__) : prebuilt-boost-lib : : prebuilt-boost-lib ;

んなことより,環境 (toolset 含む) 固有のインクルードパス・ライブラリパス ( feature などに出てこない暗黙のパス) を吐かせる方法が分からんぜよ.