Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64166 - in trunk/tools/build/v2: . tools
From: ghost_at_[hidden]
Date: 2010-07-19 15:48:28


Author: vladimir_prus
Date: 2010-07-19 15:48:27 EDT (Mon, 19 Jul 2010)
New Revision: 64166
URL: http://svn.boost.org/trac/boost/changeset/64166

Log:
Implement 'bootstrap' + 'bjam install' installation for Boost.Build.

Added:
   trunk/tools/build/v2/bootstrap.bat (contents, props changed)
   trunk/tools/build/v2/bootstrap.sh (contents, props changed)
   trunk/tools/build/v2/build.jam (contents, props changed)
Text files modified:
   trunk/tools/build/v2/tools/package.jam | 54 +++++++++++++++++++++++++++++++--------
   1 files changed, 43 insertions(+), 11 deletions(-)

Added: trunk/tools/build/v2/bootstrap.bat
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/bootstrap.bat 2010-07-19 15:48:27 EDT (Mon, 19 Jul 2010)
@@ -0,0 +1,47 @@
+@ECHO OFF
+
+REM Copyright (C) 2009 Vladimir Prus
+REM
+REM Distributed under the Boost Software License, Version 1.0.
+REM (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+ECHO Bootstrapping the build engine
+if exist ".\engine\src\bin.ntx86\bjam.exe" del tools\build\v2\engine\src\bin.ntx86\bjam.exe
+if exist ".\engine\src\bin.ntx86_64\bjam.exe" del tools\build\v2\engine\src\bin.ntx86_64\bjam.exe
+cd engine\src
+
+call .\build.bat > ..\bootstrap.log
+@ECHO OFF
+cd ..\..\..
+
+if exist ".\engine\src\bin.ntx86\bjam.exe" (
+ copy .\engine\src\bin.ntx86\bjam.exe . > nul
+ goto :bjam_built)
+
+if exist ".\engine\src\bin.ntx86_64\bjam.exe" (
+ copy .\engine\src\bin.ntx86_64\bjam.exe . > nul
+ goto :bjam_built)
+
+goto :bjam_failure
+
+:bjam_built
+
+ECHO.
+ECHO Bootstrapping is done. To build, run:
+ECHO.
+ECHO .\bjam --prefix=DIR install
+ECHO.
+
+goto :end
+
+:bjam_failure
+
+ECHO.
+ECHO Failed to bootstrap the build engine
+ECHO Please consult bootstrap.log for furter diagnostics.
+ECHO.
+
+
+goto :end
+
+:end

Added: trunk/tools/build/v2/bootstrap.sh
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/bootstrap.sh 2010-07-19 15:48:27 EDT (Mon, 19 Jul 2010)
@@ -0,0 +1,107 @@
+#!/bin/sh
+# Copyright (C) 2005, 2006 Douglas Gregor.
+# Copyright (C) 2006 The Trustees of Indiana University
+#
+# 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)
+
+# boostinspect:notab - Tabs are required for the Makefile.
+
+BJAM=""
+TOOLSET=""
+BJAM_CONFIG=""
+
+for option
+do
+ case $option in
+
+ -help | --help | -h)
+ want_help=yes ;;
+
+ -with-toolset=* | --with-toolset=* )
+ TOOLSET=`expr "x$option" : "x-*with-toolset=\(.*\)"`
+ ;;
+
+ -*)
+ { echo "error: unrecognized option: $option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ esac
+done
+
+if test "x$want_help" = xyes; then
+ cat <<EOF
+\`./bootstrap.sh' creates minimal Boost.Build, which can install itself.
+
+Usage: $0 [OPTION]...
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --with-bjam=BJAM use existing Boost.Jam executable (bjam)
+ [automatically built]
+ --with-toolset=TOOLSET use specific Boost.Build toolset
+ [automatically detected]
+EOF
+fi
+test -n "$want_help" && exit 0
+
+# TBD: Determine where the script is located
+my_dir="."
+
+# Determine the toolset, if not already decided
+if test "x$TOOLSET" = x; then
+ guessed_toolset=`$my_dir/engine/src/build.sh --guess-toolset`
+ case $guessed_toolset in
+ acc | darwin | gcc | como | mipspro | pathscale | pgi | qcc | vacpp )
+ TOOLSET=$guessed_toolset
+ ;;
+
+ intel-* )
+ TOOLSET=intel
+ ;;
+
+ mingw )
+ TOOLSET=gcc
+ ;;
+
+ sun* )
+ TOOLSET=sun
+ ;;
+
+ * )
+ # Not supported by Boost.Build
+ ;;
+ esac
+fi
+
+rm -f config.log
+
+# Build bjam
+if test "x$BJAM" = x; then
+ echo -n "Bootstrapping the build engine with toolset $TOOLSET... "
+ pwd=`pwd`
+ (cd "$my_dir/engine/src" && ./build.sh "$TOOLSET") > bootstrap.log 2>&1
+ if [ $? -ne 0 ]; then
+ echo
+ echo "Failed to bootstrap the build engine"
+ echo "Consult 'bootstrap.log' for more details"
+ exit 1
+ fi
+ cd "$pwd"
+ arch=`cd $my_dir/engine/src && ./bootstrap/jam0 -d0 -f build.jam --toolset=$TOOLSET --toolset-root= --show-locate-target && cd ..`
+ BJAM="$my_dir/engine/src/$arch/bjam"
+ echo "engine/src/$arch/bjam"
+ cp "$BJAM" .
+fi
+
+cat << EOF
+
+Bootstrapping is done. To build and install, run:
+
+ ./bjam install --prefix=<DIR>
+
+EOF
\ No newline at end of file

Added: trunk/tools/build/v2/build.jam
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/build.jam 2010-07-19 15:48:27 EDT (Mon, 19 Jul 2010)
@@ -0,0 +1,35 @@
+
+path-constant SELF : . ;
+
+import path ;
+import package ;
+import os ;
+
+local ext = "" ;
+if [ os.on-windows ]
+{
+ ext = ".exe" ;
+}
+
+
+package.install boost-build-engine
+ : # properties
+ : # binaries
+ bjam$(ext)
+ ;
+
+package.install-data boost-build-core
+ : # Which subdir of $prefix/share
+ boost-build
+ : # What to install
+ $(SELF)/boost-build.jam
+ $(SELF)/build-system.jam
+ [ path.glob-tree $(SELF)/build : *.jam *.py ]
+ [ path.glob-tree $(SELF)/kernel : *.jam *.py ]
+ [ path.glob-tree $(SELF)/util : *.jam *.py ]
+ [ path.glob-tree $(SELF)/tools : *.jam *.py ]
+ : # What is the root of the directory
+ <install-source-root>.
+ ;
+
+alias install : boost-build-engine boost-build-core ;
\ No newline at end of file

Modified: trunk/tools/build/v2/tools/package.jam
==============================================================================
--- trunk/tools/build/v2/tools/package.jam (original)
+++ trunk/tools/build/v2/tools/package.jam 2010-07-19 15:48:27 EDT (Mon, 19 Jul 2010)
@@ -67,17 +67,7 @@
 
     # First, figure out all locations. Use the default if no prefix option
     # given.
- local prefix = [ option.get prefix : [ property.select
- <install-default-prefix> : $(requirements) ] ] ;
- prefix = $(prefix:G=) ;
- requirements = [ property.change $(requirements) : <install-default-prefix>
- ] ;
- # Or some likely defaults if neither is given.
- if ! $(prefix)
- {
- if [ modules.peek : NT ] { prefix = C:\\$(name) ; }
- else if [ modules.peek : UNIX ] { prefix = /usr/local ; }
- }
+ local prefix = [ get-prefix $(requirements) ] ;
 
     # Architecture dependent files.
     local exec-locate = [ option.get exec-prefix : $(prefix) ] ;
@@ -126,3 +116,45 @@
           $(1)-lib-shared-universe $(1)-lib-shared-cygwin ;
     }
 }
+
+rule install-data ( target-name : directory-name : data * : requirements * )
+{
+ if [ MATCH --prefix=(.*) : [ modules.peek : ARGV ] ]
+ {
+ # If --prefix is explicitly specified on the command line,
+ # then we need wipe away any settings of datarootdir
+ option.set datarootdir : ;
+ }
+
+ local prefix = [ get-prefix $(requirements) ] ;
+ local datadir = [ option.get datarootdir : $(prefix)/share ] ;
+
+ stage.install $(target-name)
+ : $(data)
+ : $(requirements) <location>$(datadir)/$(directory-name)
+ ;
+
+ local c = [ project.current ] ;
+ local project-module = [ $(c).project-module ] ;
+ module $(project-module)
+ {
+ explicit $(1) ;
+ }
+}
+
+local rule get-prefix ( requirements * )
+{
+ local prefix = [ option.get prefix : [ property.select
+ <install-default-prefix> : $(requirements) ] ] ;
+ prefix = $(prefix:G=) ;
+ requirements = [ property.change $(requirements) : <install-default-prefix>
+ ] ;
+ # Or some likely defaults if neither is given.
+ if ! $(prefix)
+ {
+ if [ modules.peek : NT ] { prefix = C:\\$(name) ; }
+ else if [ modules.peek : UNIX ] { prefix = /usr/local ; }
+ }
+ return $(prefix) ;
+}
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk