http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/build/project.jam ---------------------------------------------------------------------- diff --git a/ext/kenlm b/ext/kenlm new file mode 160000 index 0000000..56fdb5c --- /dev/null +++ b/ext/kenlm @@ -0,0 +1 @@ +Subproject commit 56fdb5c44fca34d5a2e07d96139c28fb163983c5 diff --git a/ext/kenlm/jam-files/boost-build/build/project.jam b/ext/kenlm/jam-files/boost-build/build/project.jam deleted file mode 100644 index c9a0909..0000000 --- a/ext/kenlm/jam-files/boost-build/build/project.jam +++ /dev/null @@ -1,1228 +0,0 @@ -# Copyright 2002, 2003 Dave Abrahams -# Copyright 2002, 2005, 2006 Rene Rivera -# Copyright 2002, 2003, 2004, 2005, 2006 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) - -# Implements project representation and loading. Each project is represented by: -# - a module where all the Jamfile content lives. -# - an instance of 'project-attributes' class. -# (given a module name, can be obtained using the 'attributes' rule) -# - an instance of 'project-target' class (from targets.jam) -# (given a module name, can be obtained using the 'target' rule) -# -# Typically, projects are created as result of loading a Jamfile, which is done -# by rules 'load' and 'initialize', below. First, a module is prepared and a new -# project-attributes instance is created. Some rules necessary for all projects -# are added to the module (see the 'project-rules' module). Default project -# attributes are set (inheriting parent project attributes, if it exists). After -# that the Jamfile is read. It can declare its own attributes using the -# 'project' rule which will be combined with any already set. -# -# The 'project' rule can also declare a project id which will be associated with -# the project module. -# -# Besides Jamfile projects, we also support 'standalone' projects created by -# calling 'initialize' in an arbitrary module and not specifying the project's -# location. After the call, the module can call the 'project' rule, declare main -# targets and behave as a regular project except that, since it is not -# associated with any location, it should only declare prebuilt targets. -# -# The list of all loaded Jamfiles is stored in the .project-locations variable. -# It is possible to obtain a module name for a location using the 'module-name' -# rule. Standalone projects are not recorded and can only be referenced using -# their project id. - -import "class" : new ; -import modules ; -import path ; -import print ; -import property-set ; -import sequence ; - - -.debug-loading = [ MATCH ^(--debug-loading)$ : [ modules.peek : ARGV ] ] ; - - -# Loads the Jamfile at the given location. After loading, project global file -# and Jamfiles needed by the requested one will be loaded recursively. If the -# Jamfile at that location is loaded already, does nothing. Returns the project -# module for the Jamfile. -# -rule load ( jamfile-location ) -{ - local module-name = [ module-name $(jamfile-location) ] ; - # If Jamfile is already loaded, do not try again. - if ! $(module-name) in $(.jamfile-modules) - { - if $(.debug-loading) - { - ECHO Loading Jamfile at '$(jamfile-location)' ; - } - - load-jamfile $(jamfile-location) : $(module-name) ; - - # We want to make sure that child project are loaded only after parent - # projects. In particular, because parent projects define attributes - # which are then inherited by children, and we do not want children to - # be loaded before parent has defined everything. - # - # While "build-project" and "use-project" can potentially refer to child - # projects from parent projects, we do not immediately load child - # projects when seeing those attributes. Instead, we record the minimal - # information to be used only later. - load-used-projects $(module-name) ; - } - return $(module-name) ; -} - - -rule load-used-projects ( module-name ) -{ - local used = [ modules.peek $(module-name) : .used-projects ] ; - local location = [ attribute $(module-name) location ] ; - while $(used) - { - local id = $(used[1]) ; - local where = [ path.make $(used[2]) ] ; - register-id $(id) : [ load [ path.root $(where) $(location) ] ] ; - used = $(used[3-]) ; - } -} - - -# Note the use of character groups, as opposed to listing 'Jamroot' and -# 'jamroot'. With the latter, we would get duplicate matches on Windows and -# would have to eliminate duplicates. -JAMROOT ?= [ modules.peek : JAMROOT ] ; -JAMROOT ?= project-root.jam [Jj]amroot [Jj]amroot.jam ; - - -# Loads parent of Jamfile at 'location'. Issues an error if nothing is found. -# -rule load-parent ( location ) -{ - local found = [ path.glob-in-parents $(location) : $(JAMROOT) $(JAMFILE) ] ; - if ! $(found) - { - import errors ; - errors.error Could not find parent "for" project at '$(location)' : - Did not find Jamfile.jam or Jamroot.jam "in" any parent directory. ; - } - return [ load $(found[1]:D) ] ; -} - - -# Returns the project module corresponding to the given project-id or plain -# directory name. Returns nothing if such a project can not be found. -# -rule find ( name : current-location ) -{ - local project-module ; - - # Try interpreting name as project id. - if [ path.is-rooted $(name) ] - { - project-module = $($(name).jamfile-module) ; - } - - if ! $(project-module) - { - local location = [ path.root [ path.make $(name) ] $(current-location) ] - ; - - # If no project is registered for the given location, try to load it. - # First see if we have a Jamfile. If not, then see if we might have a - # project root willing to act as a Jamfile. In that case, project root - # must be placed in the directory referred to by id. - - project-module = [ module-name $(location) ] ; - if ! $(project-module) in $(.jamfile-modules) - { - if [ path.glob $(location) : $(JAMROOT) $(JAMFILE) ] - { - project-module = [ load $(location) ] ; - } - else - { - project-module = ; - } - } - } - - return $(project-module) ; -} - - -# Returns the name of the module corresponding to 'jamfile-location'. If no -# module corresponds to that location yet, associates the default module name -# with that location. -# -rule module-name ( jamfile-location ) -{ - if ! $(.module.$(jamfile-location)) - { - # Root the path, so that locations are always unambiguous. Without this, - # we can not decide if '../../exe/program1' and '.' are the same paths. - local normalized = [ path.root $(jamfile-location) [ path.pwd ] ] ; - - # Quick & dirty fix to get the same module name when we supply two - # equivalent location paths, e.g. 'd:\Foo' & 'D:\fOo\bar\..' on Windows. - # Note that our current implementation will not work correctly if the - # given location references an empty folder, but in that case any later - # attempt to load a Jamfile from this location will fail anyway. - # FIXME: Implement this cleanly. Support for this type of path - # normalization already exists internally in Boost Jam and the current - # fix relies on the GLOB builtin rule using that support. Most likely we - # just need to add a new builtin rule to do this explicitly. - normalized = [ NORMALIZE_PATH $(normalized) ] ; - local glob-result = [ GLOB [ path.native $(normalized) ] : * ] ; - if $(glob-result) - { - normalized = $(glob-result[1]:D) ; - } - .module.$(jamfile-location) = Jamfile<$(normalized)> ; - } - return $(.module.$(jamfile-location)) ; -} - - -# Default patterns to search for the Jamfiles to use for build declarations. -# -JAMFILE = [ modules.peek : JAMFILE ] ; -JAMFILE ?= [Bb]uild.jam [Jj]amfile.v2 [Jj]amfile [Jj]amfile.jam ; - - -# Find the Jamfile at the given location. This returns the exact names of all -# the Jamfiles in the given directory. The optional parent-root argument causes -# this to search not the given directory but the ones above it up to the -# parent-root directory. -# -rule find-jamfile ( - dir # The directory(s) to look for a Jamfile. - parent-root ? # Optional flag indicating to search for the parent Jamfile. - : no-errors ? - ) -{ - # Glob for all the possible Jamfiles according to the match pattern. - # - local jamfile-glob = ; - if $(parent-root) - { - if ! $(.parent-jamfile.$(dir)) - { - .parent-jamfile.$(dir) = [ path.glob-in-parents $(dir) : $(JAMFILE) - ] ; - } - jamfile-glob = $(.parent-jamfile.$(dir)) ; - } - else - { - if ! $(.jamfile.$(dir)) - { - .jamfile.$(dir) = [ path.glob $(dir) : $(JAMFILE) ] ; - } - jamfile-glob = $(.jamfile.$(dir)) ; - - } - - local jamfile-to-load = $(jamfile-glob) ; - # Multiple Jamfiles found in the same place. Warn about this and ensure we - # use only one of them. As a temporary convenience measure, if there is - # Jamfile.v2 among found files, suppress the warning and use it. - # - if $(jamfile-to-load[2-]) - { - local v2-jamfiles = [ MATCH ^(.*[Jj]amfile\\.v2)|(.*[Bb]uild\\.jam)$ : - $(jamfile-to-load) ] ; - - if $(v2-jamfiles) && ! $(v2-jamfiles[2]) - { - jamfile-to-load = $(v2-jamfiles) ; - } - else - { - local jamfile = [ path.basename $(jamfile-to-load[1]) ] ; - ECHO "warning: Found multiple Jamfiles at '"$(dir)"'!" - "Loading the first one: '$(jamfile)'." ; - } - - jamfile-to-load = $(jamfile-to-load[1]) ; - } - - # Could not find it, error. - # - if ! $(no-errors) && ! $(jamfile-to-load) - { - import errors ; - errors.error Unable to load Jamfile. - : Could not find a Jamfile in directory '$(dir)'. - : Attempted to find it with pattern '$(JAMFILE:J=" ")'. - : Please consult the documentation at 'http://www.boost.org'. ; - } - - return $(jamfile-to-load) ; -} - - -# Load a Jamfile at the given directory. Returns nothing. Will attempt to load -# the file as indicated by the JAMFILE patterns. Effect of calling this rule -# twice with the same 'dir' is undefined. -# -local rule load-jamfile ( dir : jamfile-module ) -{ - # See if the Jamfile is where it should be. - # - local jamfile-to-load = [ path.glob $(dir) : $(JAMROOT) ] ; - if ! $(jamfile-to-load) - { - jamfile-to-load = [ find-jamfile $(dir) ] ; - } - - if $(jamfile-to-load[2]) - { - import errors ; - errors.error "Multiple Jamfiles found at '$(dir)'" : - "Filenames are: " $(jamfile-to-load:D=) ; - } - - # Now load the Jamfile in its own context. - # The call to 'initialize' may load the parent Jamfile, which might contain - # a 'use-project' or a 'project.load' call, causing a second attempt to load - # the same project we are loading now. Checking inside .jamfile-modules - # prevents that second attempt from messing things up. - if ! $(jamfile-module) in $(.jamfile-modules) - { - local previous-project = $(.current-project) ; - - # Initialize the Jamfile module before loading. - initialize $(jamfile-module) : [ path.parent $(jamfile-to-load) ] : - $(jamfile-to-load:BS) ; - - if ! $(jamfile-module) in $(.jamfile-modules) - { - .jamfile-modules += $(jamfile-module) ; - - local saved-project = $(.current-project) ; - - mark-as-user $(jamfile-module) ; - modules.load $(jamfile-module) : [ path.native $(jamfile-to-load) ] - : . ; - if [ MATCH ^($(JAMROOT))$ : $(jamfile-to-load:BS) ] - { - jamfile = [ find-jamfile $(dir) : no-errors ] ; - if $(jamfile) - { - load-aux $(jamfile-module) : [ path.native $(jamfile) ] ; - } - } - - # Now do some checks. - if $(.current-project) != $(saved-project) - { - import errors ; - errors.error - The value of the .current-project variable has magically - : changed after loading a Jamfile. This means some of the - : targets might be defined in the wrong project. - : after loading $(jamfile-module) - : expected value $(saved-project) - : actual value $(.current-project) ; - } - - end-load $(previous-project) ; - - if $(.global-build-dir) - { - if [ attribute $(jamfile-module) location ] && ! [ attribute - $(jamfile-module) id ] - { - local project-root = [ attribute $(jamfile-module) - project-root ] ; - if $(project-root) = $(dir) - { - ECHO "warning: the --build-dir option was specified" ; - ECHO "warning: but Jamroot at '$(dir)'" ; - ECHO "warning: specified no project id" ; - ECHO "warning: the --build-dir option will be ignored" ; - } - } - } - } - } -} - - -# Called when done loading a project module. Restores the current project to its -# previous value and does some additional checking to make sure our 'currently -# loaded project' identifier does not get left with an invalid value. -# -rule end-load ( previous-project ? ) -{ - if ! $(.current-project) - { - import errors ; - errors.error Ending project loading requested when there was no project - currently being loaded. ; - } - - if ! $(previous-project) && $(.saved-current-project) - { - import errors ; - errors.error Ending project loading requested with no 'previous project' - when there were other projects still marked as being loaded - recursively. ; - } - - .current-project = $(previous-project) ; -} - - -rule mark-as-user ( module-name ) -{ - if USER_MODULE in [ RULENAMES ] - { - USER_MODULE $(module-name) ; - } -} - - -rule load-aux ( module-name : file ) -{ - mark-as-user $(module-name) ; - - module $(module-name) - { - include $(2) ; - local rules = [ RULENAMES $(1) ] ; - IMPORT $(1) : $(rules) : $(1) : $(1).$(rules) ; - } -} - - -.global-build-dir = [ MATCH ^--build-dir=(.*)$ : [ modules.peek : ARGV ] ] ; -if $(.global-build-dir) -{ - # If the option is specified several times, take the last value. - .global-build-dir = [ path.make $(.global-build-dir[-1]) ] ; -} - - -# Initialize the module for a project. -# -rule initialize ( - module-name # The name of the project module. - : location ? # The location (directory) of the project to initialize. If - # not specified, a standalone project will be initialized. - : basename ? - ) -{ - if $(.debug-loading) - { - ECHO "Initializing project '$(module-name)'" ; - } - - local jamroot ; - - local parent-module ; - if $(module-name) = test-config - { - # No parent. - } - else if $(module-name) = site-config - { - parent-module = test-config ; - } - else if $(module-name) = user-config - { - parent-module = site-config ; - } - else if $(module-name) = project-config - { - parent-module = user-config ; - } - else if $(location) && ! [ MATCH ^($(JAMROOT))$ : $(basename) ] - { - # We search for parent/jamroot only if this is a jamfile project, i.e. - # if is not a standalone or a jamroot project. - parent-module = [ load-parent $(location) ] ; - } - else if $(location) - { - # We have a jamroot project. Inherit from user-config (or project-config - # if it exists). - if $(project-config.attributes) - { - parent-module = project-config ; - } - else - { - parent-module = user-config ; - } - jamroot = true ; - } - - # TODO: need to consider if standalone projects can do anything but define - # prebuilt targets. If so, we need to give them a more sensible "location", - # so that source paths are correct. - location ?= "" ; - # Create the module for the Jamfile first. - module $(module-name) - { - } - - # load-parent can end up loading this module again. Make sure this is not - # duplicated. - if ! $($(module-name).attributes) - { - $(module-name).attributes = [ new project-attributes $(location) - $(module-name) ] ; - local attributes = $($(module-name).attributes) ; - - if $(location) - { - $(attributes).set source-location : [ path.make $(location) ] : - exact ; - } - else - { - local cfgs = project site test user ; - if ! $(module-name) in $(cfgs)-config - { - # This is a standalone project with known location. Set its - # source location so it can declare targets. This is needed so - # you can put a .jam file with your sources and use it via - # 'using'. Standard modules (in the 'tools' subdir) may not - # assume source dir is set. - local s = [ modules.binding $(module-name) ] ; - if ! $(s) - { - import errors ; - errors.error Could not determine project location - $(module-name) ; - } - $(attributes).set source-location : $(s:D) : exact ; - } - } - - $(attributes).set requirements : [ property-set.empty ] : exact ; - $(attributes).set usage-requirements : [ property-set.empty ] : exact ; - - # Import rules common to all project modules from project-rules module, - # defined at the end of this file. - local rules = [ RULENAMES project-rules ] ; - IMPORT project-rules : $(rules) : $(module-name) : $(rules) ; - - if $(parent-module) - { - inherit-attributes $(module-name) : $(parent-module) ; - $(attributes).set parent-module : $(parent-module) : exact ; - } - - if $(jamroot) - { - $(attributes).set project-root : $(location) : exact ; - if ! $(.first-project-root) - { - .first-project-root = $(module-name) ; - } - } - - local parent ; - if $(parent-module) - { - parent = [ target $(parent-module) ] ; - } - - if ! $(.target.$(module-name)) - { - local requirements = [ attribute $(module-name) requirements ] ; - .target.$(module-name) = [ new project-target $(module-name) : - $(module-name) $(parent) : $(requirements) ] ; - - if $(.debug-loading) - { - ECHO Assigned project target $(.target.$(module-name)) to - '$(module-name)' ; - } - } - } - - .current-project = [ target $(module-name) ] ; -} - - -# Make 'project-module' inherit attributes of project root and parent module. -# -rule inherit-attributes ( project-module : parent-module ) -{ - local attributes = $($(project-module).attributes) ; - local pattributes = [ attributes $(parent-module) ] ; - # Parent module might be locationless configuration module. - if [ modules.binding $(parent-module) ] - { - $(attributes).set parent : - [ path.parent [ path.make [ modules.binding $(parent-module) ] ] ] ; - } - $(attributes).set project-root : - [ $(pattributes).get project-root ] : exact ; - $(attributes).set default-build : - [ $(pattributes).get default-build ] ; - $(attributes).set requirements : - [ $(pattributes).get requirements ] : exact ; - $(attributes).set usage-requirements : - [ $(pattributes).get usage-requirements ] : exact ; - - local parent-build-dir = [ $(pattributes).get build-dir ] ; - if $(parent-build-dir) - { - # Have to compute relative path from parent dir to our dir. Convert both - # paths to absolute, since we cannot find relative path from ".." to - # ".". - - local location = [ attribute $(project-module) location ] ; - local parent-location = [ attribute $(parent-module) location ] ; - - local pwd = [ path.pwd ] ; - local parent-dir = [ path.root $(parent-location) $(pwd) ] ; - local our-dir = [ path.root $(location) $(pwd) ] ; - $(attributes).set build-dir : [ path.join $(parent-build-dir) - [ path.relative $(our-dir) $(parent-dir) ] ] : exact ; - } -} - - -# Returns whether the given string is a valid registered project id. -# -rule is-registered-id ( id ) -{ - return $($(id).jamfile-module) ; -} - - -# Associate the given id with the given project module. Returns the possibly -# corrected project id. -# -rule register-id ( id : module ) -{ - id = [ path.root $(id) / ] ; - - if [ MATCH (//) : $(id) ] - { - import errors ; - errors.user-error Project id may not contain two consecutive slash - characters (project id: '$(id)'). ; - } - - local orig-module = $($(id).jamfile-module) ; - if $(orig-module) && $(orig-module) != $(module) - { - local new-file = [ modules.peek $(module) : __file__ ] ; - local new-location = [ project.attribute $(module) location ] ; - - local orig-file = [ modules.peek $(orig-module) : __file__ ] ; - local orig-main-id = [ project.attribute $(orig-module) id ] ; - local orig-location = [ project.attribute $(orig-module) location ] ; - local orig-project = [ target $(orig-module) ] ; - local orig-name = [ $(orig-project).name ] ; - - import errors ; - errors.user-error Attempt to redeclare already registered project id - '$(id)'. - : Original project: - : " " Name: $(orig-name:E=---) - : " " Module: $(orig-module) - : " " Main id: $(orig-main-id:E=---) - : " " File: $(orig-file:E=---) - : " " Location: $(orig-location:E=---) - : New project: - : " " Module: $(module) - : " " File: $(new-file:E=---) - : " " Location: $(new-location:E=---) ; - } - - $(id).jamfile-module = $(module) ; - return $(id) ; -} - - -# Class keeping all the attributes of a project. -# -# The standard attributes are "id", "location", "project-root", "parent" -# "requirements", "default-build", "source-location" and "projects-to-build". -# -class project-attributes -{ - import path ; - import print ; - import project ; - import property ; - import property-set ; - import sequence ; - - rule __init__ ( location project-module ) - { - self.location = $(location) ; - self.project-module = $(project-module) ; - } - - # Set the named attribute from the specification given by the user. The - # value actually set may be different. - # - rule set ( attribute : specification * - : exact ? # Sets value from 'specification' without any processing. - ) - { - if $(exact) - { - self.$(attribute) = $(specification) ; - } - else if $(attribute) = "requirements" - { - local result = [ property-set.refine-from-user-input - $(self.requirements) : $(specification) - : $(self.project-module) : $(self.location) ] ; - - if $(result[1]) = "@error" - { - import errors : error : errors.error ; - errors.error Requirements for project at '$(self.location)' - conflict with parent's. : Explanation: $(result[2-]) ; - } - - self.requirements = $(result) ; - } - else if $(attribute) = "usage-requirements" - { - local unconditional ; - for local p in $(specification) - { - local split = [ property.split-conditional $(p) ] ; - split ?= nothing $(p) ; - unconditional += $(split[2]) ; - } - - local non-free = [ property.remove free : $(unconditional) ] ; - if $(non-free) - { - import errors : error : errors.error ; - errors.error usage-requirements $(specification) have non-free - properties $(non-free) ; - } - local t = [ property.translate-paths $(specification) : - $(self.location) ] ; - if $(self.usage-requirements) - { - self.usage-requirements = [ property-set.create - [ $(self.usage-requirements).raw ] $(t) ] ; - } - else - { - self.usage-requirements = [ property-set.create $(t) ] ; - } - } - else if $(attribute) = "default-build" - { - self.default-build = [ property.make $(specification) ] ; - } - else if $(attribute) = "source-location" - { - self.source-location = ; - for local src-path in $(specification) - { - self.source-location += [ path.root [ path.make $(src-path) ] - $(self.location) ] ; - } - } - else if $(attribute) = "build-dir" - { - self.build-dir = [ path.root [ path.make $(specification) ] - $(self.location) ] ; - } - else if $(attribute) = "id" - { - self.id = [ project.register-id $(specification) : - $(self.project-module) ] ; - } - else if ! $(attribute) in "default-build" "location" "parent" - "projects-to-build" "project-root" "source-location" - { - import errors : error : errors.error ; - errors.error Invalid project attribute '$(attribute)' specified for - project at '$(self.location)' ; - } - else - { - self.$(attribute) = $(specification) ; - } - } - - # Returns the value of the given attribute. - # - rule get ( attribute ) - { - return $(self.$(attribute)) ; - } - - # Returns whether these attributes belong to a Jamroot project module. - # - rule is-jamroot ( ) - { - if $(self.location) && $(self.project-root) = $(self.location) - { - return true ; - } - } - - # Prints the project attributes. - # - rule print ( ) - { - local id = '$(self.id)' ; - print.section $(id:E=(none)) ; - print.list-start ; - print.list-item "Parent project:" $(self.parent:E=(none)) ; - print.list-item "Requirements:" [ $(self.requirements).raw ] ; - print.list-item "Default build:" $(self.default-build) ; - print.list-item "Source location:" $(self.source-location) ; - print.list-item "Projects to build:" [ sequence.insertion-sort - $(self.projects-to-build) ] ; - print.list-end ; - } -} - - -# Returns the build directory for standalone projects -# -rule standalone-build-dir ( ) -{ - project = [ target $(.first-project-root) ] ; - return [ path.join [ $(project).build-dir ] standalone ] ; -} - -# Returns the project which is currently being loaded. -# -rule current ( ) -{ - if ! $(.current-project) - { - import errors ; - errors.error Reference to the project currently being loaded requested - when there was no project module being loaded. ; - } - return $(.current-project) ; -} - - -# Temporarily changes the current project to 'project'. Should be followed by -# 'pop-current'. -# -rule push-current ( project ) -{ - .saved-current-project += $(.current-project) ; - .current-project = $(project) ; -} - - -rule pop-current ( ) -{ - .current-project = $(.saved-current-project[-1]) ; - .saved-current-project = $(.saved-current-project[1--2]) ; -} - - -# Returns the project-attribute instance for the specified Jamfile module. -# -rule attributes ( project ) -{ - return $($(project).attributes) ; -} - - -# Returns the value of the specified attribute in the specified Jamfile module. -# -rule attribute ( project attribute ) -{ - return [ $($(project).attributes).get $(attribute) ] ; -} - - -# Returns whether a project module is one of Boost Build's configuration -# modules. -# -rule is-config-module ( project ) -{ - local cfgs = project site test user ; - if $(project) in $(cfgs)-config - { - return true ; - } -} - - -# Returns whether a project module is a Jamroot project module. -# -rule is-jamroot-module ( project ) -{ - return [ $($(project).attributes).is-jamroot ] ; -} - - -# Returns a project's parent jamroot module. Returns nothing if there is no such -# module, i.e. if this is a standalone project or one of the internal Boost -# Build configuration projects. -# -rule get-jamroot-module ( project ) -{ - local jamroot-location = [ attribute $(project) project-root ] ; - if $(jamroot-location) - { - return [ module-name $(jamroot-location) ] ; - } -} - - -# Returns the project target corresponding to the 'project-module'. -# -rule target ( project-module ) -{ - if ! $(.target.$(project-module)) - { - import errors ; - errors.user-error Project target requested but not yet assigned for - module '$(project-module)'. ; - } - return $(.target.$(project-module)) ; -} - - -# Defines a Boost.Build extension project. Such extensions usually contain -# library targets and features that can be used by many people. Even though -# extensions are really projects, they can be initialized as a module would be -# with the "using" (project.project-rules.using) mechanism. -# -rule extension ( id : options * : * ) -{ - # The caller is a standalone module for the extension. - local mod = [ CALLER_MODULE ] ; - - # We need to do the rest within the extension module. - module $(mod) - { - import path ; - - # Find the root project. - local root-project = [ project.current ] ; - root-project = [ $(root-project).project-module ] ; - while - [ project.attribute $(root-project) parent-module ] && - [ project.attribute $(root-project) parent-module ] != user-config - { - root-project = [ project.attribute $(root-project) parent-module ] ; - } - - # Create the project data, and bring in the project rules into the - # module. - project.initialize $(__name__) : [ path.join [ project.attribute - $(root-project) location ] ext $(1:L) ] ; - - # Create the project itself, i.e. the attributes. All extensions are - # created in the "/ext" project space. - project /ext/$(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : - $(9) : $(10) : $(11) : $(12) : $(13) : $(14) : $(15) : $(16) : $(17) - : $(18) : $(19) ; - local attributes = [ project.attributes $(__name__) ] ; - - # Inherit from the root project of whomever is defining us. - project.inherit-attributes $(__name__) : $(root-project) ; - $(attributes).set parent-module : $(root-project) : exact ; - } -} - - -rule glob-internal ( project : wildcards + : excludes * : rule-name ) -{ - local location = [ $(project).get source-location ] ; - - local result ; - local paths = [ path.$(rule-name) $(location) : - [ sequence.transform path.make : $(wildcards) ] : - [ sequence.transform path.make : $(excludes) ] ] ; - if $(wildcards:D) || $(rule-name) != glob - { - # The paths we have found are relative to the current directory, but the - # names specified in the sources list are assumed to be relative to the - # source directory of the corresponding project. So, just make the names - # absolute. - for local p in $(paths) - { - # If the path is below source location, use relative path. - # Otherwise, use full path just to avoid any ambiguities. - local rel = [ path.relative $(p) $(location) : no-error ] ; - if $(rel) = not-a-child - { - result += [ path.root $(p) [ path.pwd ] ] ; - } - else - { - result += $(rel) ; - } - } - } - else - { - # There were no wildcards in the directory path, so the files are all in - # the source directory of the project. Just drop the directory, instead - # of making paths absolute. - result = $(paths:D="") ; - } - - return $(result) ; -} - - -# This module defines rules common to all projects. -# -module project-rules -{ - import modules ; - - rule using ( toolset-module : * ) - { - import toolset ; - - local saved-project = [ modules.peek project : .current-project ] ; - - # Temporarily change the search path so the module referred to by - # 'using' can be placed in the same directory as Jamfile. User will - # expect the module to be found even though the directory is not in - # BOOST_BUILD_PATH. - local x = [ modules.peek : BOOST_BUILD_PATH ] ; - local caller = [ CALLER_MODULE ] ; - local caller-location = [ modules.binding $(caller) ] ; - modules.poke : BOOST_BUILD_PATH : $(caller-location:D) $(x) ; - toolset.using $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : - $(9) : $(10) : $(11) : $(12) : $(13) : $(14) : $(15) : $(16) : $(17) - : $(18) : $(19) ; - modules.poke : BOOST_BUILD_PATH : $(x) ; - - # The above might have clobbered .current-project in case it caused a - # new project instance to be created (which would then automatically - # get set as the 'current' project). Restore the correct value so any - # main targets declared after this do not get mapped to the loaded - # module's project. - modules.poke project : .current-project : $(saved-project) ; - } - - rule import ( * : * : * ) - { - local caller = [ CALLER_MODULE ] ; - local saved-project = [ modules.peek project : .current-project ] ; - module $(caller) - { - modules.import $(1) : $(2) : $(3) ; - } - - # The above might have clobbered .current-project in case it caused a - # new project instance to be created (which would then automatically - # get set as the 'current' project). Restore the correct value so any - # main targets declared after this do not get mapped to the loaded - # module's project. - modules.poke project : .current-project : $(saved-project) ; - } - - rule project ( id ? : options * : * ) - { - import path ; - import project ; - - local caller = [ CALLER_MODULE ] ; - local attributes = [ project.attributes $(caller) ] ; - if $(id) - { - $(attributes).set id : $(id) ; - } - - local explicit-build-dir ; - - for n in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - { - local option = $($(n)) ; - if $(option) - { - $(attributes).set $(option[1]) : $(option[2-]) ; - } - if $(option[1]) = "build-dir" - { - explicit-build-dir = [ path.make $(option[2-]) ] ; - } - } - - # If '--build-dir' is specified, change the build dir for the project. - local global-build-dir = [ modules.peek project : .global-build-dir ] ; - - if $(global-build-dir) - { - local location = [ $(attributes).get location ] ; - # Project with an empty location is a 'standalone' project such as - # user-config or qt. It has no build dir. If we try to set build dir - # for user-config, we shall then try to inherit it, with either - # weird or wrong consequences. - if $(location) && $(location) = [ $(attributes).get project-root ] - { - # Re-read the project id, since it might have been modified a - # bit when setting the project's id attribute, e.g. might have - # been prefixed by a slash if it was not already. - id = [ $(attributes).get id ] ; - # This is Jamroot. - if $(id) - { - if $(explicit-build-dir) && - [ path.is-rooted $(explicit-build-dir) ] - { - import errors ; - errors.user-error Absolute directory specified via - 'build-dir' project attribute : Do not know how to - combine that with the --build-dir option. ; - } - # Strip the leading slash from id. - local rid = [ MATCH ^/(.*) : $(id) ] ; - local p = [ path.join $(global-build-dir) $(rid) - $(explicit-build-dir) ] ; - - $(attributes).set build-dir : $(p) : exact ; - } - } - else - { - # Not Jamroot. - if $(explicit-build-dir) - { - import errors ; - errors.user-error When --build-dir is specified, the - 'build-dir' project : attribute is allowed only for - top-level 'project' invocations ; - } - } - } - } - - # Declare and set a project global constant. Project global constants are - # normal variables but should not be changed. They are applied to every - # child Jamfile. - # - rule constant ( name : value + ) - { - import project ; - local caller = [ CALLER_MODULE ] ; - local p = [ project.target $(caller) ] ; - $(p).add-constant $(name) : $(value) ; - } - - # Declare and set a project global constant, whose value is a path. The path - # is adjusted to be relative to the invocation directory. The given value - # path is taken to be either absolute, or relative to this project root. - # - rule path-constant ( name : value + ) - { - import project ; - local caller = [ CALLER_MODULE ] ; - local p = [ project.target $(caller) ] ; - $(p).add-constant $(name) : $(value) : path ; - } - - rule use-project ( id : where ) - { - # See comment in 'load' for explanation. - local caller = [ CALLER_MODULE ] ; - modules.poke $(caller) : .used-projects : [ modules.peek $(caller) : - .used-projects ] $(id) $(where) ; - } - - rule build-project ( dir ) - { - import project ; - local caller = [ CALLER_MODULE ] ; - local attributes = [ project.attributes $(caller) ] ; - local now = [ $(attributes).get projects-to-build ] ; - $(attributes).set projects-to-build : $(now) $(dir) ; - } - - rule explicit ( target-names * ) - { - import project ; - # If 'explicit' is used in a helper rule defined in Jamroot and - # inherited by children, then most of the time we want 'explicit' to - # operate on the Jamfile where the helper rule is invoked. - local t = [ project.current ] ; - for local n in $(target-names) - { - $(t).mark-target-as-explicit $(n) ; - } - } - - rule always ( target-names * ) - { - import project ; - local t = [ project.current ] ; - for local n in $(target-names) - { - $(t).mark-target-as-always $(n) ; - } - } - - rule glob ( wildcards + : excludes * ) - { - import project ; - return [ project.glob-internal [ project.current ] : $(wildcards) : - $(excludes) : glob ] ; - } - - rule glob-tree ( wildcards + : excludes * ) - { - import project ; - if $(wildcards:D) || $(excludes:D) - { - import errors ; - errors.user-error The patterns to 'glob-tree' may not include - directory ; - } - return [ project.glob-internal [ project.current ] : $(wildcards) : - $(excludes) : glob-tree ] ; - } - - # Calculates conditional requirements for multiple requirements at once. - # This is a shorthand to reduce duplication and to keep an inline - # declarative syntax. For example: - # - # lib x : x.cpp : [ conditional <toolset>gcc <variant>debug : - # <define>DEBUG_EXCEPTION <define>DEBUG_TRACE ] ; - # - rule conditional ( condition + : requirements * ) - { - local condition = $(condition:J=,) ; - if [ MATCH (:) : $(condition) ] - { - return $(condition)$(requirements) ; - } - else - { - return $(condition):$(requirements) ; - } - } - - rule option ( name : value ) - { - local m = [ CALLER_MODULE ] ; - local cfgs = project site test user ; - if ! $(m) in $(cfgs)-config - { - import errors ; - errors.error The 'option' rule may only be used "in" Boost Build - configuration files. ; - } - import option ; - option.set $(name) : $(value) ; - } -}
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/build/property-set.jam ---------------------------------------------------------------------- diff --git a/ext/kenlm b/ext/kenlm new file mode 160000 index 0000000..56fdb5c --- /dev/null +++ b/ext/kenlm @@ -0,0 +1 @@ +Subproject commit 56fdb5c44fca34d5a2e07d96139c28fb163983c5 diff --git a/ext/kenlm/jam-files/boost-build/build/property-set.jam b/ext/kenlm/jam-files/boost-build/build/property-set.jam deleted file mode 100644 index 55cb556..0000000 --- a/ext/kenlm/jam-files/boost-build/build/property-set.jam +++ /dev/null @@ -1,517 +0,0 @@ -# Copyright 2003 Dave Abrahams -# Copyright 2003, 2004, 2005, 2006 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) - -import "class" : new ; -import feature ; -import path ; -import project ; -import property ; -import sequence ; -import set ; -import option ; - -# Class for storing a set of properties. -# -# There is 1<->1 correspondence between identity and value. No two instances -# of the class are equal. To maintain this property, the 'property-set.create' -# rule should be used to create new instances. Instances are immutable. -# -# Each property is classified with regard to its effect on build results. -# Incidental properties have no effect on build results, from Boost.Build's -# point of view. Others are either free, or non-free and we refer to non-free -# ones as 'base'. Each property belongs to exactly one of those categories. -# -# It is possible to get a list of properties belonging to each category as -# well as a list of properties with a specific attribute. -# -# Several operations, like and refine and as-path are provided. They all use -# caching whenever possible. -# -class property-set -{ - import errors ; - import feature ; - import path ; - import property ; - import property-set ; - import set ; - - rule __init__ ( raw-properties * ) - { - self.raw = $(raw-properties) ; - - for local p in $(raw-properties) - { - if ! $(p:G) - { - errors.error "Invalid property: '$(p)'" ; - } - } - } - - # Returns Jam list of stored properties. - # - rule raw ( ) - { - return $(self.raw) ; - } - - rule str ( ) - { - return "[" $(self.raw) "]" ; - } - - # Returns properties that are neither incidental nor free. - # - rule base ( ) - { - if ! $(self.base-initialized) - { - init-base ; - } - return $(self.base) ; - } - - # Returns free properties which are not incidental. - # - rule free ( ) - { - if ! $(self.base-initialized) - { - init-base ; - } - return $(self.free) ; - } - - # Returns dependency properties. - # - rule dependency ( ) - { - if ! $(self.dependency-initialized) - { - init-dependency ; - } - return $(self.dependency) ; - } - - rule non-dependency ( ) - { - if ! $(self.dependency-initialized) - { - init-dependency ; - } - return $(self.non-dependency) ; - } - - rule conditional ( ) - { - if ! $(self.conditional-initialized) - { - init-conditional ; - } - return $(self.conditional) ; - } - - rule non-conditional ( ) - { - if ! $(self.conditional-initialized) - { - init-conditional ; - } - return $(self.non-conditional) ; - } - - # Returns incidental properties. - # - rule incidental ( ) - { - if ! $(self.base-initialized) - { - init-base ; - } - return $(self.incidental) ; - } - - rule refine ( ps ) - { - if ! $(self.refined.$(ps)) - { - local r = [ property.refine $(self.raw) : [ $(ps).raw ] ] ; - if $(r[1]) != "@error" - { - self.refined.$(ps) = [ property-set.create $(r) ] ; - } - else - { - self.refined.$(ps) = $(r) ; - } - } - return $(self.refined.$(ps)) ; - } - - rule expand ( ) - { - if ! $(self.expanded) - { - self.expanded = [ property-set.create [ feature.expand $(self.raw) ] - ] ; - } - return $(self.expanded) ; - } - - rule expand-composites ( ) - { - if ! $(self.composites) - { - self.composites = [ property-set.create - [ feature.expand-composites $(self.raw) ] ] ; - } - return $(self.composites) ; - } - - rule evaluate-conditionals ( context ? ) - { - context ?= $(__name__) ; - if ! $(self.evaluated.$(context)) - { - self.evaluated.$(context) = [ property-set.create - [ property.evaluate-conditionals-in-context $(self.raw) : [ - $(context).raw ] ] ] ; - } - return $(self.evaluated.$(context)) ; - } - - rule propagated ( ) - { - if ! $(self.propagated-ps) - { - local result ; - for local p in $(self.raw) - { - if propagated in [ feature.attributes $(p:G) ] - { - result += $(p) ; - } - } - self.propagated-ps = [ property-set.create $(result) ] ; - } - return $(self.propagated-ps) ; - } - - rule add-defaults ( ) - { - if ! $(self.defaults) - { - self.defaults = [ property-set.create - [ feature.add-defaults $(self.raw) ] ] ; - } - return $(self.defaults) ; - } - - rule as-path ( ) - { - if ! $(self.as-path) - { - self.as-path = [ property.as-path [ base ] ] ; - } - return $(self.as-path) ; - } - - # Computes the path to be used for a target with the given properties. - # Returns a list of - # - the computed path - # - if the path is relative to the build directory, a value of 'true'. - # - rule target-path ( ) - { - if ! $(self.target-path) - { - # The <location> feature can be used to explicitly change the - # location of generated targets. - local l = [ get <location> ] ; - if $(l) - { - self.target-path = $(l) ; - } - else - { - local p = [ property-set.hash-maybe [ as-path ] ] ; - - # A real ugly hack. Boost regression test system requires - # specific target paths, and it seems that changing it to handle - # other directory layout is really hard. For that reason, we - # teach V2 to do the things regression system requires. The - # value of '<location-prefix>' is prepended to the path. - local prefix = [ get <location-prefix> ] ; - if $(prefix) - { - self.target-path = [ path.join $(prefix) $(p) ] ; - } - else - { - self.target-path = $(p) ; - } - if ! $(self.target-path) - { - self.target-path = . ; - } - # The path is relative to build dir. - self.target-path += true ; - } - } - return $(self.target-path) ; - } - - rule add ( ps ) - { - if ! $(self.added.$(ps)) - { - self.added.$(ps) = [ property-set.create $(self.raw) [ $(ps).raw ] ] - ; - } - return $(self.added.$(ps)) ; - } - - rule add-raw ( properties * ) - { - return [ add [ property-set.create $(properties) ] ] ; - } - - # Returns all values of 'feature'. - # - rule get ( feature ) - { - if ! $(self.map-built) - { - # For each feature, create a member var and assign all values to it. - # Since all regular member vars start with 'self', there will be no - # conflicts between names. - self.map-built = true ; - for local v in $(self.raw) - { - $(v:G) += $(v:G=) ; - } - } - return $($(feature)) ; - } - - # Returns true if the property-set contains all the - # specified properties. - # - rule contains-raw ( properties * ) - { - if $(properties) in $(self.raw) - { - return true ; - } - } - - # Returns true if the property-set has values for - # all the specified features - # - rule contains-features ( features * ) - { - if $(features) in $(self.raw:G) - { - return true ; - } - } - - # private - - rule init-base ( ) - { - for local p in $(self.raw) - { - local att = [ feature.attributes $(p:G) ] ; - # A feature can be both incidental and free, in which case we add it - # to incidental. - if incidental in $(att) - { - self.incidental += $(p) ; - } - else if free in $(att) - { - self.free += $(p) ; - } - else - { - self.base += $(p) ; - } - } - self.base-initialized = true ; - } - - rule init-dependency ( ) - { - for local p in $(self.raw) - { - if dependency in [ feature.attributes $(p:G) ] - { - self.dependency += $(p) ; - } - else - { - self.non-dependency += $(p) ; - } - } - self.dependency-initialized = true ; - } - - rule init-conditional ( ) - { - for local p in $(self.raw) - { - # TODO: Note that non-conditional properties may contain colon (':') - # characters as well, e.g. free or indirect properties. Indirect - # properties for example contain a full Jamfile path in their value - # which on Windows file systems contains ':' as the drive separator. - if [ MATCH (:) : $(p:G=) ] - { - self.conditional += $(p) ; - } - else - { - self.non-conditional += $(p) ; - } - } - self.conditional-initialized = true ; - } -} - - -# Creates a new 'property-set' instance for the given raw properties or returns -# an already existing ones. -# -rule create ( raw-properties * ) -{ - raw-properties = [ sequence.unique - [ sequence.insertion-sort $(raw-properties) ] ] ; - - local key = $(raw-properties:J=-:E=) ; - - if ! $(.ps.$(key)) - { - .ps.$(key) = [ new property-set $(raw-properties) ] ; - } - return $(.ps.$(key)) ; -} -NATIVE_RULE property-set : create ; - -if [ HAS_NATIVE_RULE class@property-set : get : 1 ] -{ - NATIVE_RULE class@property-set : get ; -} - -if [ HAS_NATIVE_RULE class@property-set : contains-features : 1 ] -{ - NATIVE_RULE class@property-set : contains-features ; -} - -# Creates a new 'property-set' instance after checking that all properties are -# valid and converting implicit properties into gristed form. -# -rule create-with-validation ( raw-properties * ) -{ - property.validate $(raw-properties) ; - return [ create [ property.make $(raw-properties) ] ] ; -} - - -# Creates a property-set from the input given by the user, in the context of -# 'jamfile-module' at 'location'. -# -rule create-from-user-input ( raw-properties * : jamfile-module location ) -{ - local project-id = [ project.attribute $(jamfile-module) id ] ; - project-id ?= [ path.root $(location) [ path.pwd ] ] ; - return [ property-set.create [ property.translate $(raw-properties) - : $(project-id) : $(location) : $(jamfile-module) ] ] ; -} - - -# Refines requirements with requirements provided by the user. Specially handles -# "-<property>value" syntax in specification to remove given requirements. -# - parent-requirements -- property-set object with requirements to refine. -# - specification -- string list of requirements provided by the user. -# - project-module -- module to which context indirect features will be -# bound. -# - location -- path to which path features are relative. -# -rule refine-from-user-input ( parent-requirements : specification * : - project-module : location ) -{ - if ! $(specification) - { - return $(parent-requirements) ; - } - else - { - local add-requirements ; - local remove-requirements ; - - for local r in $(specification) - { - local m = [ MATCH "^-(.*)" : $(r) ] ; - if $(m) - { - remove-requirements += $(m) ; - } - else - { - add-requirements += $(r) ; - } - } - - if $(remove-requirements) - { - # Need to create a property set, so that path features and indirect - # features are translated just like they are in project - # requirements. - local ps = [ property-set.create-from-user-input - $(remove-requirements) : $(project-module) $(location) ] ; - - parent-requirements = [ property-set.create - [ set.difference [ $(parent-requirements).raw ] - : [ $(ps).raw ] ] ] ; - specification = $(add-requirements) ; - } - - local requirements = [ property-set.create-from-user-input - $(specification) : $(project-module) $(location) ] ; - - return [ $(parent-requirements).refine $(requirements) ] ; - } -} - - -# Returns a property-set with an empty set of properties. -# -rule empty ( ) -{ - if ! $(.empty) - { - .empty = [ create ] ; - } - return $(.empty) ; -} - - -if [ option.get hash : : yes ] = yes -{ - rule hash-maybe ( path ? ) - { - path ?= "" ; - return [ MD5 $(path) ] ; - } -} -else -{ - rule hash-maybe ( path ? ) - { - return $(path) ; - } -} http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/build/property.jam ---------------------------------------------------------------------- diff --git a/ext/kenlm b/ext/kenlm new file mode 160000 index 0000000..56fdb5c --- /dev/null +++ b/ext/kenlm @@ -0,0 +1 @@ +Subproject commit 56fdb5c44fca34d5a2e07d96139c28fb163983c5 diff --git a/ext/kenlm/jam-files/boost-build/build/property.jam b/ext/kenlm/jam-files/boost-build/build/property.jam deleted file mode 100644 index dc9dbd8..0000000 --- a/ext/kenlm/jam-files/boost-build/build/property.jam +++ /dev/null @@ -1,905 +0,0 @@ -# Copyright 2001, 2002, 2003 Dave Abrahams -# Copyright 2006 Rene Rivera -# Copyright 2002, 2003, 2004, 2005, 2006 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) - -import feature ; -import indirect ; -import path ; -import regex ; -import string ; -import sequence ; -import set ; -import utility ; - - -# Refines 'properties' by overriding any non-free and non-conditional properties -# for which a different value is specified in 'requirements'. Returns the -# resulting list of properties. -# -rule refine ( properties * : requirements * ) -{ - local result ; - local unset ; - - # Collect all non-free features in requirements - for local r in $(requirements) - { - # Do not consider conditional requirements. - if ! [ MATCH (:) : $(r:G=) ] && ! free in [ feature.attributes $(r:G) ] - { - unset += $(r:G) ; - } - } - - # Remove properties that are overridden by requirements - for local p in $(properties) - { - if [ MATCH (:) : $(p:G=) ] || ! $(p:G) in $(unset) - { - result += $(p) ; - } - } - - return [ sequence.unique $(result) $(requirements) ] ; -} - - -# Removes all conditional properties whose conditions are not met. For those -# with met conditions, removes the condition. Properties in conditions are -# looked up in 'context'. -# -rule evaluate-conditionals-in-context ( properties * : context * ) -{ - local base ; - local conditionals ; - for local p in $(properties) - { - if [ MATCH (:<) : $(p) ] - { - conditionals += $(p) ; - } - else - { - base += $(p) ; - } - } - - local result = $(base) ; - for local p in $(conditionals) - { - # Separate condition and property. - local s = [ MATCH ^(.*):(<.*) : $(p) ] ; - # Split condition into individual properties. - local condition = [ regex.split $(s[1]) "," ] ; - # Evaluate condition. - if ! [ MATCH ^(!).* : $(condition:G=) ] - { - # Only positive checks - if $(condition) in $(context) - { - result += $(s[2]) ; - } - } - else - { - # Have negative checks - local fail ; - while $(condition) - { - local c = $(condition[1]) ; - local m = [ MATCH ^!(.*) : $(c) ] ; - if $(m) - { - local p = $(m:G=$(c:G)) ; - if $(p) in $(context) - { - fail = true ; - c = ; - } - } - else - { - if ! $(c) in $(context) - { - fail = true ; - c = ; - } - } - condition = $(condition[2-]) ; - } - if ! $(fail) - { - result += $(s[2]) ; - } - } - } - return $(result) ; -} - - -rule expand-subfeatures-in-conditions ( properties * ) -{ - local result ; - for local p in $(properties) - { - local s = [ MATCH ^(.*):(<.*) : $(p) ] ; - if ! $(s) - { - result += $(p) ; - } - else - { - local condition = $(s[1]) ; - local value = $(s[2]) ; - # Condition might include several elements. - condition = [ regex.split $(condition) "," ] ; - local e ; - for local c in $(condition) - { - # It is common for a condition to include a toolset or - # subfeatures that have not been defined. In that case we want - # the condition to simply 'never be satisfied' and validation - # would only produce a spurious error so we prevent it by - # passing 'true' as the second parameter. - e += [ feature.expand-subfeatures $(c) : true ] ; - } - if $(e) = $(condition) - { - # (todo) - # This is just an optimization and possibly a premature one at - # that. - # (todo) (12.07.2008.) (Jurko) - result += $(p) ; - } - else - { - result += $(e:J=,):$(value) ; - } - } - } - return $(result) ; -} - - -# Helper for as-path, below. Orders properties with the implicit ones first, and -# within the two sections in alphabetical order of feature name. -# -local rule path-order ( x y ) -{ - if $(y:G) && ! $(x:G) - { - return true ; - } - else if $(x:G) && ! $(y:G) - { - return ; - } - else - { - if ! $(x:G) - { - x = [ feature.expand-subfeatures $(x) ] ; - y = [ feature.expand-subfeatures $(y) ] ; - } - - if $(x[1]) < $(y[1]) - { - return true ; - } - } -} - - -local rule abbreviate-dashed ( string ) -{ - local r ; - for local part in [ regex.split $(string) - ] - { - r += [ string.abbreviate $(part) ] ; - } - return $(r:J=-) ; -} - - -local rule identity ( string ) -{ - return $(string) ; -} - - -if --abbreviate-paths in [ modules.peek : ARGV ] -{ - .abbrev = abbreviate-dashed ; -} -else -{ - .abbrev = identity ; -} - - -# Returns a path representing the given expanded property set. -# -rule as-path ( properties * ) -{ - local entry = .result.$(properties:J=-) ; - - if ! $($(entry)) - { - # Trim redundancy. - properties = [ feature.minimize $(properties) ] ; - - # Sort according to path-order. - properties = [ sequence.insertion-sort $(properties) : path-order ] ; - - local components ; - for local p in $(properties) - { - if $(p:G) - { - local f = [ utility.ungrist $(p:G) ] ; - p = $(f)-$(p:G=) ; - } - components += [ $(.abbrev) $(p) ] ; - } - - $(entry) = $(components:J=/) ; - } - - return $($(entry)) ; -} - - -# Exit with error if property is not valid. -# -local rule validate1 ( property ) -{ - local msg ; - if $(property:G) - { - local feature = $(property:G) ; - local value = $(property:G=) ; - - if ! [ feature.valid $(feature) ] - { - # Ungrist for better error messages. - feature = [ utility.ungrist $(property:G) ] ; - msg = "unknown feature '$(feature)'" ; - } - else if $(value) && ! free in [ feature.attributes $(feature) ] - { - feature.validate-value-string $(feature) $(value) ; - } - else if ! ( $(value) || ( optional in [ feature.attributes $(feature) ] ) ) - { - # Ungrist for better error messages. - feature = [ utility.ungrist $(property:G) ] ; - msg = "No value specified for feature '$(feature)'" ; - } - } - else - { - local feature = [ feature.implied-feature $(property) ] ; - feature.validate-value-string $(feature) $(property) ; - } - if $(msg) - { - import errors ; - errors.error "Invalid property "'$(property:J=" ")'": "$(msg:J=" "). ; - } -} - - -rule validate ( properties * ) -{ - for local p in $(properties) - { - validate1 $(p) ; - } -} - - -rule validate-property-sets ( property-sets * ) -{ - for local s in $(property-sets) - { - validate [ feature.split $(s) ] ; - } -} - - -# Expands any implicit property values in the given property 'specification' so -# they explicitly state their feature. -# -rule make ( specification * ) -{ - local result ; - for local e in $(specification) - { - if $(e:G) - { - result += $(e) ; - } - else if [ feature.is-implicit-value $(e) ] - { - local feature = [ feature.implied-feature $(e) ] ; - result += $(feature)$(e) ; - } - else - { - import errors ; - errors.error "'$(e)' is not a valid property specification" ; - } - } - return $(result) ; -} - - -# Returns a property set containing all the elements in 'properties' that do not -# have their attributes listed in 'attributes'. -# -rule remove ( attributes + : properties * ) -{ - local result ; - for local e in $(properties) - { - if ! [ set.intersection $(attributes) : [ feature.attributes $(e:G) ] ] - { - result += $(e) ; - } - } - return $(result) ; -} - - -# Returns a property set containing all the elements in 'properties' that have -# their attributes listed in 'attributes'. -# -rule take ( attributes + : properties * ) -{ - local result ; - for local e in $(properties) - { - if [ set.intersection $(attributes) : [ feature.attributes $(e:G) ] ] - { - result += $(e) ; - } - } - return $(result) ; -} - - -# Selects properties corresponding to any of the given features. -# -rule select ( features * : properties * ) -{ - local result ; - - # Add any missing angle brackets. - local empty = "" ; - features = $(empty:G=$(features)) ; - - for local p in $(properties) - { - if $(p:G) in $(features) - { - result += $(p) ; - } - } - return $(result) ; -} - - -# Returns a modified version of properties with all values of the given feature -# replaced by the given value. If 'value' is empty the feature will be removed. -# -rule change ( properties * : feature value ? ) -{ - local result ; - for local p in $(properties) - { - if $(p:G) = $(feature) - { - result += $(value:G=$(feature)) ; - } - else - { - result += $(p) ; - } - } - return $(result) ; -} - - -# If 'property' is a conditional property, returns the condition and the -# property. E.g. <variant>debug,<toolset>gcc:<inlining>full will become -# <variant>debug,<toolset>gcc <inlining>full. Otherwise, returns an empty -# string. -# -rule split-conditional ( property ) -{ - return [ MATCH "^(.+):(<.+)" : $(property) ] ; -} - - -rule translate-path-value ( value : path ) -{ - local t ; - for local v in [ regex.split $(value) "&&" ] - { - t += [ path.root [ path.make $(v) ] $(path) ] ; - } - return $(t:TJ="&&") ; -} - -rule translate-dependency-value ( value : project-id : project-location ) -{ - local split-target = [ regex.match ^(.*)//(.*) : $(value) ] ; - if $(split-target) - { - local rooted = [ path.root [ path.make $(split-target[1]) ] - [ path.root $(project-location) [ path.pwd ] ] ] ; - return $(rooted)//$(split-target[2]) ; - } - else if [ path.is-rooted $(value) ] - { - return $(value) ; - } - else - { - return $(project-id)//$(value) ; - } -} - -rule translate-indirect-value ( rulename : context-module ) -{ - if [ MATCH "^([^%]*)%([^%]+)$" : $(rulename) ] - { - # Rule is already in the 'indirect-rule' format. - return @$(rulename) ; - } - else - { - local v ; - if ! [ MATCH "([.])" : $(rulename) ] - { - # This is an unqualified rule name. The user might want to - # set flags on this rule name and toolset.flag - # auto-qualifies it. Need to do the same here so flag - # setting works. We can arrange for toolset.flag to *not* - # auto-qualify the argument but then two rules defined in - # two Jamfiles would conflict. - rulename = $(context-module).$(rulename) ; - } - v = [ indirect.make $(rulename) : $(context-module) ] ; - return @$(v) ; - } - -} - -# Equivalent to a calling all of: -# translate-path -# translate-indirect -# translate-dependency -# expand-subfeatures-in-conditions -# make -# -rule translate ( properties * : project-id : project-location : context-module ) -{ - local result ; - for local p in $(properties) - { - local split = [ split-conditional $(p) ] ; - local condition property ; - - if $(split) - { - condition = $(split[1]) ; - property = $(split[2]) ; - - local e ; - for local c in [ regex.split $(condition) "," ] - { - e += [ feature.expand-subfeatures $(c) : true ] ; - } - - condition = $(e:J=,): ; - } - else - { - property = $(p) ; - } - - local feature = $(property:G) ; - if ! $(feature) - { - if [ feature.is-implicit-value $(property) ] - { - feature = [ feature.implied-feature $(property) ] ; - result += $(condition:E=)$(feature)$(property) ; - } - else - { - import errors ; - errors.error "'$(e)' is not a valid property specification" ; - } - } else { - local attributes = [ feature.attributes $(feature) ] ; - local value ; - # Only free features should be translated - if free in $(attributes) - { - if path in $(attributes) - { - value = [ translate-path-value $(property:G=) : $(project-location) ] ; - result += $(condition:E=)$(feature)$(value) ; - } - else if dependency in $(attributes) - { - value = [ translate-dependency-value $(property:G=) : $(project-id) : $(project-location) ] ; - result += $(condition:E=)$(feature)$(value) ; - } - else - { - local m = [ MATCH ^@(.+) : $(property:G=) ] ; - if $(m) - { - value = [ translate-indirect-value $(m) : $(context-module) ] ; - result += $(condition:E=)$(feature)$(value) ; - } - else - { - result += $(condition:E=)$(property) ; - } - } - } - else - { - result += $(condition:E=)$(property) ; - } - } - } - return $(result) ; -} - -# Interpret all path properties in 'properties' as relative to 'path'. The -# property values are assumed to be in system-specific form, and will be -# translated into normalized form. -# -rule translate-paths ( properties * : path ) -{ - local result ; - for local p in $(properties) - { - local split = [ split-conditional $(p) ] ; - local condition = "" ; - if $(split) - { - condition = $(split[1]): ; - p = $(split[2]) ; - } - - if path in [ feature.attributes $(p:G) ] - { - local values = [ regex.split $(p:TG=) "&&" ] ; - local t ; - for local v in $(values) - { - t += [ path.root [ path.make $(v) ] $(path) ] ; - } - t = $(t:J="&&") ; - result += $(condition)$(t:TG=$(p:G)) ; - } - else - { - result += $(condition)$(p) ; - } - } - return $(result) ; -} - - -# Assumes that all feature values that start with '@' are names of rules, used -# in 'context-module'. Such rules can be either local to the module or global. -# Converts such values into 'indirect-rule' format (see indirect.jam), so they -# can be called from other modules. Does nothing for such values that are -# already in the 'indirect-rule' format. -# -rule translate-indirect ( specification * : context-module ) -{ - local result ; - for local p in $(specification) - { - local m = [ MATCH ^@(.+) : $(p:G=) ] ; - if $(m) - { - local v ; - if [ MATCH "^([^%]*)%([^%]+)$" : $(m) ] - { - # Rule is already in the 'indirect-rule' format. - v = $(m) ; - } - else - { - if ! [ MATCH "([.])" : $(m) ] - { - # This is an unqualified rule name. The user might want to - # set flags on this rule name and toolset.flag - # auto-qualifies it. Need to do the same here so flag - # setting works. We can arrange for toolset.flag to *not* - # auto-qualify the argument but then two rules defined in - # two Jamfiles would conflict. - m = $(context-module).$(m) ; - } - v = [ indirect.make $(m) : $(context-module) ] ; - } - - v = @$(v) ; - result += $(v:G=$(p:G)) ; - } - else - { - result += $(p) ; - } - } - return $(result) ; -} - - -# Binds all dependency properties in a list relative to the given project. -# Targets with absolute paths will be left unchanged and targets which have a -# project specified will have the path to the project interpreted relative to -# the specified location. -# -rule translate-dependencies ( specification * : project-id : location ) -{ - local result ; - for local p in $(specification) - { - local split = [ split-conditional $(p) ] ; - local condition = "" ; - if $(split) - { - condition = $(split[1]): ; - p = $(split[2]) ; - } - if dependency in [ feature.attributes $(p:G) ] - { - local split-target = [ regex.match ^(.*)//(.*) : $(p:G=) ] ; - if $(split-target) - { - local rooted = [ path.root [ path.make $(split-target[1]) ] - [ path.root $(location) [ path.pwd ] ] ] ; - result += $(condition)$(p:G)$(rooted)//$(split-target[2]) ; - } - else if [ path.is-rooted $(p:G=) ] - { - result += $(condition)$(p) ; - } - else - { - result += $(condition)$(p:G)$(project-id)//$(p:G=) ; - } - } - else - { - result += $(condition)$(p) ; - } - } - return $(result) ; -} - - -# Class maintaining a property set -> string mapping. -# -class property-map -{ - import numbers ; - import sequence ; - - rule __init__ ( ) - { - self.next-flag = 1 ; - } - - # Associate 'value' with 'properties'. - # - rule insert ( properties * : value ) - { - self.all-flags += self.$(self.next-flag) ; - self.$(self.next-flag) = $(value) $(properties) ; - - self.next-flag = [ numbers.increment $(self.next-flag) ] ; - } - - # Returns the value associated with 'properties' or any subset of it. If - # more than one subset has a value assigned to it, returns the value for the - # longest subset, if it is unique. - # - rule find ( property-set ) - { - # First find all matches. - local matches ; - local match-ranks ; - for local i in $(self.all-flags) - { - local list = $($(i)) ; - if [ $(property-set).contains-raw $(list[2-]) ] - { - matches += $(list[1]) ; - match-ranks += [ sequence.length $(list) ] ; - } - } - local best = [ sequence.select-highest-ranked $(matches) - : $(match-ranks) ] ; - if $(best[2]) - { - import errors : error : errors.error ; - errors.error "Ambiguous key $(properties:J= :E=)" ; - } - return $(best) ; - } - - # Returns the value associated with 'properties'. If 'value' parameter is - # given, replaces the found value. - # - rule find-replace ( properties * : value ? ) - { - # First find all matches. - local matches ; - local match-ranks ; - for local i in $(self.all-flags) - { - if $($(i)[2-]) in $(properties) - { - matches += $(i) ; - match-ranks += [ sequence.length $($(i)) ] ; - } - } - local best = [ sequence.select-highest-ranked $(matches) - : $(match-ranks) ] ; - if $(best[2]) - { - import errors : error : errors.error ; - errors.error "Ambiguous key $(properties:J= :E=)" ; - } - local original = $($(best)[1]) ; - if $(value) - { - $(best) = $(value) $($(best)[2-]) ; - } - return $(original) ; - } -} - - -rule __test__ ( ) -{ - import assert ; - import "class" : new ; - import errors : try catch ; - import feature ; - - # Local rules must be explicitly re-imported. - import property : path-order abbreviate-dashed ; - - feature.prepare-test property-test-temp ; - - feature.feature toolset : gcc : implicit symmetric ; - feature.subfeature toolset gcc : version : 2.95.2 2.95.3 2.95.4 3.0 3.0.1 - 3.0.2 : optional ; - feature.feature define : : free ; - feature.feature runtime-link : dynamic static : symmetric link-incompatible ; - feature.feature optimization : on off ; - feature.feature variant : debug release : implicit composite symmetric ; - feature.feature rtti : on off : link-incompatible ; - - feature.compose <variant>debug : <define>_DEBUG <optimization>off ; - feature.compose <variant>release : <define>NDEBUG <optimization>on ; - - validate <toolset>gcc <toolset>gcc-3.0.1 : $(test-space) ; - - assert.true path-order $(test-space) debug <define>foo ; - assert.false path-order $(test-space) <define>foo debug ; - assert.true path-order $(test-space) gcc debug ; - assert.false path-order $(test-space) debug gcc ; - assert.true path-order $(test-space) <optimization>on <rtti>on ; - assert.false path-order $(test-space) <rtti>on <optimization>on ; - - assert.result-set-equal <toolset>gcc <rtti>off <define>FOO - : refine <toolset>gcc <rtti>off - : <define>FOO - : $(test-space) ; - - assert.result-set-equal <toolset>gcc <optimization>on - : refine <toolset>gcc <optimization>off - : <optimization>on - : $(test-space) ; - - assert.result-set-equal <toolset>gcc <rtti>off - : refine <toolset>gcc : <rtti>off : $(test-space) ; - - assert.result-set-equal <toolset>gcc <rtti>off <rtti>off:<define>FOO - : refine <toolset>gcc : <rtti>off <rtti>off:<define>FOO - : $(test-space) ; - - assert.result-set-equal <toolset>gcc:<define>foo <toolset>gcc:<define>bar - : refine <toolset>gcc:<define>foo : <toolset>gcc:<define>bar - : $(test-space) ; - - assert.result <define>MY_RELEASE - : evaluate-conditionals-in-context - <variant>release,<rtti>off:<define>MY_RELEASE - : <toolset>gcc <variant>release <rtti>off ; - - assert.result debug - : as-path <optimization>off <variant>debug - : $(test-space) ; - - assert.result gcc/debug/rtti-off - : as-path <toolset>gcc <optimization>off <rtti>off <variant>debug - : $(test-space) ; - - assert.result optmz-off : abbreviate-dashed optimization-off ; - assert.result rntm-lnk-sttc : abbreviate-dashed runtime-link-static ; - - try ; - validate <feature>value : $(test-space) ; - catch "Invalid property '<feature>value': unknown feature 'feature'." ; - - try ; - validate <rtti>default : $(test-space) ; - catch \"default\" is not a known value of feature <rtti> ; - - validate <define>WHATEVER : $(test-space) ; - - try ; - validate <rtti> : $(test-space) ; - catch "Invalid property '<rtti>': No value specified for feature 'rtti'." ; - - try ; - validate value : $(test-space) ; - catch \"value\" is not an implicit feature value ; - - assert.result-set-equal <rtti>on - : remove free implicit : <toolset>gcc <define>foo <rtti>on : $(test-space) ; - - assert.result-set-equal <include>a - : select include : <include>a <toolset>gcc ; - - assert.result-set-equal <include>a - : select include bar : <include>a <toolset>gcc ; - - assert.result-set-equal <include>a <toolset>gcc - : select include <bar> <toolset> : <include>a <toolset>gcc ; - - assert.result-set-equal <toolset>kylix <include>a - : change <toolset>gcc <include>a : <toolset> kylix ; - - pm = [ new property-map ] ; - $(pm).insert <toolset>gcc : o ; - $(pm).insert <toolset>gcc <os>NT : obj ; - $(pm).insert <toolset>gcc <os>CYGWIN : obj ; - - assert.equal o : [ $(pm).find-replace <toolset>gcc ] ; - - assert.equal obj : [ $(pm).find-replace <toolset>gcc <os>NT ] ; - - try ; - $(pm).find-replace <toolset>gcc <os>NT <os>CYGWIN ; - catch "Ambiguous key <toolset>gcc <os>NT <os>CYGWIN" ; - - # Test ordinary properties. - assert.result : split-conditional <toolset>gcc ; - - # Test properties with ":". - assert.result : split-conditional <define>FOO=A::B ; - - # Test conditional feature. - assert.result-set-equal <toolset>gcc,<toolset-gcc:version>3.0 <define>FOO - : split-conditional <toolset>gcc,<toolset-gcc:version>3.0:<define>FOO ; - - feature.finish-test property-test-temp ; -} http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/build/readme.txt ---------------------------------------------------------------------- diff --git a/ext/kenlm b/ext/kenlm new file mode 160000 index 0000000..56fdb5c --- /dev/null +++ b/ext/kenlm @@ -0,0 +1 @@ +Subproject commit 56fdb5c44fca34d5a2e07d96139c28fb163983c5 diff --git a/ext/kenlm/jam-files/boost-build/build/readme.txt b/ext/kenlm/jam-files/boost-build/build/readme.txt deleted file mode 100644 index b15055b..0000000 --- a/ext/kenlm/jam-files/boost-build/build/readme.txt +++ /dev/null @@ -1,11 +0,0 @@ -Copyright 2001, 2002 Dave Abrahams -Copyright 2002 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) - -Development code for new build system. To run unit tests for jam code, execute: - - bjam --debug --build-system=test - -Comprehensive tests require Python. See ../test/readme.txt
