From 3faecf9a00512dcbc8712c4bca9adae72fb64410 Mon Sep 17 00:00:00 2001 From: Kenneth Heafield Date: Sat, 12 May 2012 14:01:52 -0400 Subject: Give in and copy bjam into cdec source code --- jam-files/boost-build/tools/types/__init__.py | 18 +++++ jam-files/boost-build/tools/types/asm.jam | 4 + jam-files/boost-build/tools/types/asm.py | 13 ++++ jam-files/boost-build/tools/types/cpp.jam | 86 ++++++++++++++++++++++ jam-files/boost-build/tools/types/cpp.py | 10 +++ jam-files/boost-build/tools/types/exe.jam | 9 +++ jam-files/boost-build/tools/types/exe.py | 11 +++ jam-files/boost-build/tools/types/html.jam | 4 + jam-files/boost-build/tools/types/html.py | 10 +++ jam-files/boost-build/tools/types/lib.jam | 74 +++++++++++++++++++ jam-files/boost-build/tools/types/lib.py | 77 +++++++++++++++++++ jam-files/boost-build/tools/types/obj.jam | 9 +++ jam-files/boost-build/tools/types/obj.py | 11 +++ jam-files/boost-build/tools/types/objc.jam | 26 +++++++ jam-files/boost-build/tools/types/preprocessed.jam | 9 +++ jam-files/boost-build/tools/types/qt.jam | 10 +++ jam-files/boost-build/tools/types/register.jam | 39 ++++++++++ jam-files/boost-build/tools/types/rsp.jam | 4 + jam-files/boost-build/tools/types/rsp.py | 10 +++ 19 files changed, 434 insertions(+) create mode 100644 jam-files/boost-build/tools/types/__init__.py create mode 100644 jam-files/boost-build/tools/types/asm.jam create mode 100644 jam-files/boost-build/tools/types/asm.py create mode 100644 jam-files/boost-build/tools/types/cpp.jam create mode 100644 jam-files/boost-build/tools/types/cpp.py create mode 100644 jam-files/boost-build/tools/types/exe.jam create mode 100644 jam-files/boost-build/tools/types/exe.py create mode 100644 jam-files/boost-build/tools/types/html.jam create mode 100644 jam-files/boost-build/tools/types/html.py create mode 100644 jam-files/boost-build/tools/types/lib.jam create mode 100644 jam-files/boost-build/tools/types/lib.py create mode 100644 jam-files/boost-build/tools/types/obj.jam create mode 100644 jam-files/boost-build/tools/types/obj.py create mode 100644 jam-files/boost-build/tools/types/objc.jam create mode 100644 jam-files/boost-build/tools/types/preprocessed.jam create mode 100644 jam-files/boost-build/tools/types/qt.jam create mode 100644 jam-files/boost-build/tools/types/register.jam create mode 100644 jam-files/boost-build/tools/types/rsp.jam create mode 100644 jam-files/boost-build/tools/types/rsp.py (limited to 'jam-files/boost-build/tools/types') diff --git a/jam-files/boost-build/tools/types/__init__.py b/jam-files/boost-build/tools/types/__init__.py new file mode 100644 index 00000000..f972b714 --- /dev/null +++ b/jam-files/boost-build/tools/types/__init__.py @@ -0,0 +1,18 @@ +__all__ = [ + 'asm', + 'cpp', + 'exe', + 'html', + 'lib', + 'obj', + 'rsp', +] + +def register_all (): + for i in __all__: + m = __import__ (__name__ + '.' + i) + reg = i + '.register ()' + #exec (reg) + +# TODO: (PF) I thought these would be imported automatically. Anyone knows why they aren't? +register_all () diff --git a/jam-files/boost-build/tools/types/asm.jam b/jam-files/boost-build/tools/types/asm.jam new file mode 100644 index 00000000..a340db36 --- /dev/null +++ b/jam-files/boost-build/tools/types/asm.jam @@ -0,0 +1,4 @@ +# Copyright Craig Rodrigues 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) +type ASM : s S asm ; diff --git a/jam-files/boost-build/tools/types/asm.py b/jam-files/boost-build/tools/types/asm.py new file mode 100644 index 00000000..b4e1c30e --- /dev/null +++ b/jam-files/boost-build/tools/types/asm.py @@ -0,0 +1,13 @@ +# Copyright Craig Rodrigues 2005. +# Copyright (c) 2008 Steven Watanabe +# +# 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) + +from b2.build import type + +def register(): + type.register_type('ASM', ['s', 'S', 'asm']) + +register() diff --git a/jam-files/boost-build/tools/types/cpp.jam b/jam-files/boost-build/tools/types/cpp.jam new file mode 100644 index 00000000..3159cdd7 --- /dev/null +++ b/jam-files/boost-build/tools/types/cpp.jam @@ -0,0 +1,86 @@ +# Copyright David Abrahams 2004. +# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus +# Copyright 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) +import type ; +import scanner ; + +class c-scanner : scanner +{ + import path ; + import regex ; + import scanner ; + import sequence ; + import virtual-target ; + + rule __init__ ( includes * ) + { + scanner.__init__ ; + + for local i in $(includes) + { + self.includes += [ sequence.transform path.native + : [ regex.split $(i:G=) "&&" ] ] ; + } + } + + rule pattern ( ) + { + return "#[ \t]*include[ ]*(<(.*)>|\"(.*)\")" ; + } + + rule process ( target : matches * : binding ) + { + local angle = [ regex.transform $(matches) : "<(.*)>" ] ; + angle = [ sequence.transform path.native : $(angle) ] ; + local quoted = [ regex.transform $(matches) : "\"(.*)\"" ] ; + quoted = [ sequence.transform path.native : $(quoted) ] ; + + # CONSIDER: the new scoping rule seem to defeat "on target" variables. + local g = [ on $(target) return $(HDRGRIST) ] ; + local b = [ NORMALIZE_PATH $(binding:D) ] ; + + # Attach binding of including file to included targets. When a target is + # directly created from virtual target this extra information is + # unnecessary. But in other cases, it allows us to distinguish between + # two headers of the same name included from different places. We do not + # need this extra information for angle includes, since they should not + # depend on including file (we can not get literal "." in include path). + local g2 = $(g)"#"$(b) ; + + angle = $(angle:G=$(g)) ; + quoted = $(quoted:G=$(g2)) ; + + local all = $(angle) $(quoted) ; + + INCLUDES $(target) : $(all) ; + NOCARE $(all) ; + SEARCH on $(angle) = $(self.includes:G=) ; + SEARCH on $(quoted) = $(b) $(self.includes:G=) ; + + # Just propagate the current scanner to includes in hope that includes + # do not change scanners. + scanner.propagate $(__name__) : $(angle) $(quoted) : $(target) ; + + ISFILE $(angle) $(quoted) ; + } +} + +scanner.register c-scanner : include ; + +type.register CPP : cpp cxx cc ; +type.register H : h ; +type.register HPP : hpp : H ; +type.register C : c ; + +# It most cases where a CPP file or a H file is a source of some action, we +# should rebuild the result if any of files included by CPP/H are changed. One +# case when this is not needed is installation, which is handled specifically. +type.set-scanner CPP : c-scanner ; +type.set-scanner C : c-scanner ; +# One case where scanning of H/HPP files is necessary is PCH generation -- if +# any header included by HPP being precompiled changes, we need to recompile the +# header. +type.set-scanner H : c-scanner ; +type.set-scanner HPP : c-scanner ; diff --git a/jam-files/boost-build/tools/types/cpp.py b/jam-files/boost-build/tools/types/cpp.py new file mode 100644 index 00000000..7b56111c --- /dev/null +++ b/jam-files/boost-build/tools/types/cpp.py @@ -0,0 +1,10 @@ +# Copyright David Abrahams 2004. 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) + +from b2.build import type + +def register (): + type.register_type ('CPP', ['cpp', 'cxx', 'cc']) + +register () diff --git a/jam-files/boost-build/tools/types/exe.jam b/jam-files/boost-build/tools/types/exe.jam new file mode 100644 index 00000000..47109513 --- /dev/null +++ b/jam-files/boost-build/tools/types/exe.jam @@ -0,0 +1,9 @@ +# Copyright David Abrahams 2004. 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 type ; + +type.register EXE ; +type.set-generated-target-suffix EXE : windows : "exe" ; +type.set-generated-target-suffix EXE : cygwin : "exe" ; diff --git a/jam-files/boost-build/tools/types/exe.py b/jam-files/boost-build/tools/types/exe.py new file mode 100644 index 00000000..a4935e24 --- /dev/null +++ b/jam-files/boost-build/tools/types/exe.py @@ -0,0 +1,11 @@ +# Copyright David Abrahams 2004. 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) + +from b2.build import type + +def register (): + type.register_type ('EXE', ['exe'], None, ['NT', 'CYGWIN']) + type.register_type ('EXE', [], None, []) + +register () diff --git a/jam-files/boost-build/tools/types/html.jam b/jam-files/boost-build/tools/types/html.jam new file mode 100644 index 00000000..5cd337d0 --- /dev/null +++ b/jam-files/boost-build/tools/types/html.jam @@ -0,0 +1,4 @@ +# Copyright David Abrahams 2004. 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) +type HTML : html ; diff --git a/jam-files/boost-build/tools/types/html.py b/jam-files/boost-build/tools/types/html.py new file mode 100644 index 00000000..63af4d90 --- /dev/null +++ b/jam-files/boost-build/tools/types/html.py @@ -0,0 +1,10 @@ +# Copyright David Abrahams 2004. 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) + +from b2.build import type + +def register (): + type.register_type ('HTML', ['html']) + +register () diff --git a/jam-files/boost-build/tools/types/lib.jam b/jam-files/boost-build/tools/types/lib.jam new file mode 100644 index 00000000..854ab8fd --- /dev/null +++ b/jam-files/boost-build/tools/types/lib.jam @@ -0,0 +1,74 @@ +# Copyright David Abrahams 2004. 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 type ; # for set-generated-target-suffix +import os ; + +# The following naming scheme is used for libraries. +# +# On *nix: +# libxxx.a static library +# libxxx.so shared library +# +# On windows (msvc) +# libxxx.lib static library +# xxx.dll DLL +# xxx.lib import library +# +# On windows (mingw): +# libxxx.a static library +# libxxx.dll DLL +# libxxx.dll.a import library +# +# On cygwin i.e. cygwin +# libxxx.a static library +# cygxxx.dll DLL +# libxxx.dll.a import library +# + +type.register LIB ; + +# FIXME: should not register both extensions on both platforms. +type.register STATIC_LIB : a lib : LIB ; + +# The 'lib' prefix is used everywhere +type.set-generated-target-prefix STATIC_LIB : : lib ; + +# Use '.lib' suffix for windows +type.set-generated-target-suffix STATIC_LIB : windows : lib ; + +# Except with gcc. +type.set-generated-target-suffix STATIC_LIB : gcc windows : a ; + +# Use xxx.lib for import libs +type IMPORT_LIB : : STATIC_LIB ; +type.set-generated-target-prefix IMPORT_LIB : : "" ; +type.set-generated-target-suffix IMPORT_LIB : : lib ; + +# Except with gcc (mingw or cygwin), where use libxxx.dll.a +type.set-generated-target-prefix IMPORT_LIB : gcc : lib ; +type.set-generated-target-suffix IMPORT_LIB : gcc : dll.a ; + +type.register SHARED_LIB : so dll dylib : LIB ; + +# Both mingw and cygwin use libxxx.dll naming scheme. +# On Linux, use "lib" prefix +type.set-generated-target-prefix SHARED_LIB : : lib ; +# But don't use it on windows +type.set-generated-target-prefix SHARED_LIB : windows : "" ; +# But use it again on mingw +type.set-generated-target-prefix SHARED_LIB : gcc windows : lib ; +# And use 'cyg' on cygwin +type.set-generated-target-prefix SHARED_LIB : cygwin : cyg ; + + +type.set-generated-target-suffix SHARED_LIB : windows : dll ; +type.set-generated-target-suffix SHARED_LIB : cygwin : dll ; +type.set-generated-target-suffix SHARED_LIB : darwin : dylib ; + +type SEARCHED_LIB : : LIB ; +# This is needed so that when we create a target of SEARCHED_LIB +# type, there's no prefix or suffix automatically added. +type.set-generated-target-prefix SEARCHED_LIB : : "" ; +type.set-generated-target-suffix SEARCHED_LIB : : "" ; diff --git a/jam-files/boost-build/tools/types/lib.py b/jam-files/boost-build/tools/types/lib.py new file mode 100644 index 00000000..d0ec1fb5 --- /dev/null +++ b/jam-files/boost-build/tools/types/lib.py @@ -0,0 +1,77 @@ +# Status: ported +# Base revision: 64456. +# Copyright David Abrahams 2004. +# Copyright 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) + +import b2.build.type as type + +# The following naming scheme is used for libraries. +# +# On *nix: +# libxxx.a static library +# libxxx.so shared library +# +# On windows (msvc) +# libxxx.lib static library +# xxx.dll DLL +# xxx.lib import library +# +# On windows (mingw): +# libxxx.a static library +# libxxx.dll DLL +# libxxx.dll.a import library +# +# On cygwin i.e. cygwin +# libxxx.a static library +# cygxxx.dll DLL +# libxxx.dll.a import library +# + +type.register('LIB') + +# FIXME: should not register both extensions on both platforms. +type.register('STATIC_LIB', ['a', 'lib'], 'LIB') + +# The 'lib' prefix is used everywhere +type.set_generated_target_prefix('STATIC_LIB', [], 'lib') + +# Use '.lib' suffix for windows +type.set_generated_target_suffix('STATIC_LIB', ['windows'], 'lib') + +# Except with gcc. +type.set_generated_target_suffix('STATIC_LIB', ['gcc', 'windows'], 'a') + +# Use xxx.lib for import libs +type.register('IMPORT_LIB', [], 'STATIC_LIB') +type.set_generated_target_prefix('IMPORT_LIB', [], '') +type.set_generated_target_suffix('IMPORT_LIB', [], 'lib') + +# Except with gcc (mingw or cygwin), where use libxxx.dll.a +type.set_generated_target_prefix('IMPORT_LIB', ['gcc'], 'lib') +type.set_generated_target_suffix('IMPORT_LIB', ['gcc'], 'dll.a') + +type.register('SHARED_LIB', ['so', 'dll', 'dylib'], 'LIB') + +# Both mingw and cygwin use libxxx.dll naming scheme. +# On Linux, use "lib" prefix +type.set_generated_target_prefix('SHARED_LIB', [], 'lib') +# But don't use it on windows +type.set_generated_target_prefix('SHARED_LIB', ['windows'], '') +# But use it again on mingw +type.set_generated_target_prefix('SHARED_LIB', ['gcc', 'windows'], 'lib') +# And use 'cyg' on cygwin +type.set_generated_target_prefix('SHARED_LIB', ['cygwin'], 'cyg') + + +type.set_generated_target_suffix('SHARED_LIB', ['windows'], 'dll') +type.set_generated_target_suffix('SHARED_LIB', ['cygwin'], 'dll') +type.set_generated_target_suffix('SHARED_LIB', ['darwin'], 'dylib') + +type.register('SEARCHED_LIB', [], 'LIB') +# This is needed so that when we create a target of SEARCHED_LIB +# type, there's no prefix or suffix automatically added. +type.set_generated_target_prefix('SEARCHED_LIB', [], '') +type.set_generated_target_suffix('SEARCHED_LIB', [], '') diff --git a/jam-files/boost-build/tools/types/obj.jam b/jam-files/boost-build/tools/types/obj.jam new file mode 100644 index 00000000..6afbcaa6 --- /dev/null +++ b/jam-files/boost-build/tools/types/obj.jam @@ -0,0 +1,9 @@ +# Copyright David Abrahams 2004. 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 type ; + +type.register OBJ : o obj ; +type.set-generated-target-suffix OBJ : windows : obj ; +type.set-generated-target-suffix OBJ : cygwin : obj ; diff --git a/jam-files/boost-build/tools/types/obj.py b/jam-files/boost-build/tools/types/obj.py new file mode 100644 index 00000000..e61e99a8 --- /dev/null +++ b/jam-files/boost-build/tools/types/obj.py @@ -0,0 +1,11 @@ +# Copyright David Abrahams 2004. 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) + +from b2.build import type + +def register (): + type.register_type ('OBJ', ['obj'], None, ['NT', 'CYGWIN']) + type.register_type ('OBJ', ['o']) + +register () diff --git a/jam-files/boost-build/tools/types/objc.jam b/jam-files/boost-build/tools/types/objc.jam new file mode 100644 index 00000000..709cbd0c --- /dev/null +++ b/jam-files/boost-build/tools/types/objc.jam @@ -0,0 +1,26 @@ +# Copyright Rene Rivera 2008, 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) +import type ; +import scanner ; +import types/cpp ; + +class objc-scanner : c-scanner +{ + rule __init__ ( includes * ) + { + c-scanner.__init__ $(includes) ; + } + + rule pattern ( ) + { + return "#[ \t]*include|import[ ]*(<(.*)>|\"(.*)\")" ; + } +} + +scanner.register objc-scanner : include ; + +type.register OBJECTIVE_C : m ; +type.register OBJECTIVE_CPP : mm ; +type.set-scanner OBJECTIVE_C : objc-scanner ; +type.set-scanner OBJECTIVE_CPP : objc-scanner ; diff --git a/jam-files/boost-build/tools/types/preprocessed.jam b/jam-files/boost-build/tools/types/preprocessed.jam new file mode 100644 index 00000000..c9187ba6 --- /dev/null +++ b/jam-files/boost-build/tools/types/preprocessed.jam @@ -0,0 +1,9 @@ +# Copyright Steven Watanabe 2011 +# 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 type ; + +type.register PREPROCESSED_C : i : C ; +type.register PREPROCESSED_CPP : ii : CPP ; diff --git a/jam-files/boost-build/tools/types/qt.jam b/jam-files/boost-build/tools/types/qt.jam new file mode 100644 index 00000000..6d1dfbd4 --- /dev/null +++ b/jam-files/boost-build/tools/types/qt.jam @@ -0,0 +1,10 @@ +# Copyright Vladimir Prus 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) + +type UI : ui ; +type QRC : qrc ; +type MOCCABLE_CPP ; +type MOCCABLE_H ; +# Result of running moc. +type MOC : moc : H ; diff --git a/jam-files/boost-build/tools/types/register.jam b/jam-files/boost-build/tools/types/register.jam new file mode 100644 index 00000000..203992ca --- /dev/null +++ b/jam-files/boost-build/tools/types/register.jam @@ -0,0 +1,39 @@ +# Copyright David Abrahams 2004. 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) + +# This module's job is to automatically import all the type +# registration modules in its directory. +import type os path modules ; + +# Register the given type on the specified OSes, or on remaining OSes +# if os is not specified. This rule is injected into each of the type +# modules for the sake of convenience. +local rule type ( type : suffixes * : base-type ? : os * ) +{ + if ! [ type.registered $(type) ] + { + if ( ! $(os) ) || [ os.name ] in $(os) + { + type.register $(type) : $(suffixes) : $(base-type) ; + } + } +} + +.this-module's-file = [ modules.binding $(__name__) ] ; +.this-module's-dir = [ path.parent $(.this-module's-file) ] ; +.sibling-jamfiles = [ path.glob $(.this-module's-dir) : *.jam ] ; +.sibling-modules = [ MATCH ^(.*)\.jam$ : $(.sibling-jamfiles) ] ; + +# A loop over all modules in this directory +for m in $(.sibling-modules) +{ + m = [ path.basename $(m) ] ; + m = types/$(m) ; + + # Inject the type rule into the new module + IMPORT $(__name__) : type : $(m) : type ; + import $(m) ; +} + + diff --git a/jam-files/boost-build/tools/types/rsp.jam b/jam-files/boost-build/tools/types/rsp.jam new file mode 100644 index 00000000..bdf8a7c9 --- /dev/null +++ b/jam-files/boost-build/tools/types/rsp.jam @@ -0,0 +1,4 @@ +# Copyright David Abrahams 2004. 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) +type RSP : rsp ; diff --git a/jam-files/boost-build/tools/types/rsp.py b/jam-files/boost-build/tools/types/rsp.py new file mode 100644 index 00000000..ccb379e9 --- /dev/null +++ b/jam-files/boost-build/tools/types/rsp.py @@ -0,0 +1,10 @@ +# Copyright David Abrahams 2004. 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) + +from b2.build import type + +def register (): + type.register_type ('RSP', ['rsp']) + +register () -- cgit v1.2.3