diff --git a/src/engine/boost-jam.spec b/src/engine/boost-jam.spec index 1b094aff0..12aec18e1 100644 --- a/src/engine/boost-jam.spec +++ b/src/engine/boost-jam.spec @@ -25,23 +25,23 @@ Authors: %setup -n %{name}-%{version} %build -YACC="" LOCATE_TARGET=bin ./build.sh +LOCATE_TARGET=bin ./build.sh %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{_bindir} -mkdir -p $RPM_BUILD_ROOT%{_docdir}/boost-jam-%{version} +mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version} install -m 755 bin/bjam $RPM_BUILD_ROOT%{_bindir}/bjam-%{version} ln -sf bjam-%{version} $RPM_BUILD_ROOT%{_bindir}/bjam ln -sf bjam-%{version} $RPM_BUILD_ROOT%{_bindir}/jam -install -m 644 $BOOST_JAM_DOCS $RPM_BUILD_ROOT%{_docdir}/boost-jam-%{version} +install -m 644 $BOOST_JAM_DOCS $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version} find $RPM_BUILD_ROOT -name CVS -type d -depth -exec rm -r {} \; %files %defattr(-,root,root) %attr(755,root,root) /usr/bin/* -%doc %{_docdir}/boost-jam-%{version} +%doc %{_docdir}/%{name}-%{version} %clean diff --git a/src/engine/build.bat b/src/engine/build.bat index 0c5fe401b..4a8ba37ab 100644 --- a/src/engine/build.bat +++ b/src/engine/build.bat @@ -18,10 +18,15 @@ if "%1" == "vc7" goto Set_MSVC7_Defaut if "%1" == "borland" goto Set_Borland ECHO ### ECHO ### Unknown toolset: %1 +goto Print_Help + +:Print_Help ECHO ### ECHO ### You can specify the toolset as the argument, i.e.: ECHO ### .\build.bat msvc ECHO ### +ECHO ### Toolsets supported by this script are: borland, metrowerks, msvc, vc7 +ECHO ### goto Finish REM Try and guess the toolset to bootstrap the build with... @@ -32,13 +37,9 @@ if EXIST "C:\Program Files\Microsoft Visual C++\VC98\bin\VCVARS32.BAT" goto Set_ if EXIST "C:\Program Files\Microsoft Visual Studio\VC98\bin\VCVARS32.BAT" goto Set_MSVS_Defaut if EXIST "C:\Program Files\Microsoft Visual Studio .NET\VC7\bin\VCVARS32.BAT" goto Set_MSVC7_Defaut if EXIST "C:\Borland\BCC55\Bin\bcc32.exe" goto Set_Borland -ECHO "###" -ECHO "### Could not find a suitable toolset." -ECHO "###" -ECHO "### You can specify the toolset as the argument, i.e.:" -ECHO "### .\build.bat msvc" -ECHO "###" -goto Finish +ECHO ### +ECHO ### Could not find a suitable toolset. +goto Print_Help :Set_Metrowerks set BOOST_JAM_TOOLSET=metrowerks @@ -75,9 +76,9 @@ set BOOST_JAM_OPT_MKJAMBASE=-emkjambasejam0 goto Build :Build -ECHO "###" -ECHO "### Using '%BOOST_JAM_TOOLSET%' toolset." -ECHO "###" +ECHO ### +ECHO ### Using '%BOOST_JAM_TOOLSET%' toolset. +ECHO ### set MKJAMBASE_SOURCES=mkjambase.c set BJAM_SOURCES= @@ -88,7 +89,7 @@ set BJAM_SOURCES=%BJAM_SOURCES% newstr.c option.c parse.c pathunix.c pathvms.c r set BJAM_SOURCES=%BJAM_SOURCES% rules.c scan.c search.c subst.c timestamp.c variable.c modules.c set BJAM_SOURCES=%BJAM_SOURCES% strings.c filesys.c builtins.c pwd.c -REM No "yyacc" script available, yet. +REM No "yyacc" script available, yet, and therefore no grammar bootstrap. @ECHO ON rd /S /Q bootstrap.%BOOST_JAM_TOOLSET% md bootstrap.%BOOST_JAM_TOOLSET% @@ -99,6 +100,6 @@ md bootstrap.%BOOST_JAM_TOOLSET% :Build_BJAM %BOOST_JAM_CC% %BOOST_JAM_OPT_JAM% %BJAM_SOURCES% @if NOT EXIST ".\bootstrap.%BOOST_JAM_TOOLSET%\jam0.exe" goto Finish -.\bootstrap.%BOOST_JAM_TOOLSET%\jam0 -f build.jam -sBOOST_JAM_TOOLSET=%BOOST_JAM_TOOLSET% +.\bootstrap.%BOOST_JAM_TOOLSET%\jam0 -f build.jam --toolset=%BOOST_JAM_TOOLSET% :Finish diff --git a/src/engine/build.jam b/src/engine/build.jam index 18fa6ab45..df82cb79a 100644 --- a/src/engine/build.jam +++ b/src/engine/build.jam @@ -9,61 +9,116 @@ NAME = boost-jam ; VERSION = 3.1.3 ; RELEASE = 1 ; +# Generate development debug binaries? +if --debug in $(ARGV) +{ + debug = true ; +} + # Configure the implemented toolsets. These are minimal # commands and options to compile the full Jam. When # adding new toolsets make sure to add them to the # "known" list also. -rule toolset ( name command : opt.out + : opt.define + : flags * : linklibs * ) +rule toolset ( name command : opt.out + : opt.define + : release-flags * : debug-flags * : linklibs * ) { tool.$(name).cc ?= $(command) ; tool.$(name).opt.out ?= $(opt.out) ; tool.$(name).opt.define ?= $(opt.define) ; - tool.$(name).flags ?= $(flags) ; + if $(debug) + { + tool.$(name).flags ?= $(debug-flags) ; + } + else + { + tool.$(name).flags ?= $(release-flags) ; + } tool.$(name).linklibs ?= $(linklibs) ; toolsets += $(name) ; } ## Borland C++ 5.5.x -toolset borland bcc32 : -e -n : /D : -WC -w- -q -IC:\\Borland\\BCC55\\Include -LC:\\Borland\\BCC55\\Lib -O2 ; +toolset borland bcc32 : -e -n : /D + : -WC -w- -q -IC:\\Borland\\BCC55\\Include -LC:\\Borland\\BCC55\\Lib -O2 -vi -w-inl + : -WC -w- -q -IC:\\Borland\\BCC55\\Include -LC:\\Borland\\BCC55\\Lib -v -Od -vi- ; ## Comeau C/C++ 4.x -toolset como como : "-o " : -D ; +toolset como como : "-o " : -D + : --inlining + : --no_inlining ; ## MacOSX Darwin, using GCC 2.9.x, 3.x -toolset darwin cc : "-o " : -D : -Wl,-x -O3 ; +toolset darwin cc : "-o " : -D + : -Wl,-x -O3 -finline-functions + : -g -O0 -fno-inline -pg ; ## GCC 2.x, 3.x -toolset gcc gcc : "-o " : -D : -s -O3 ; +toolset gcc gcc : "-o " : -D + : -s -O3 -finline-functions + : -g -O0 -fno-inline -pg ; ## GCC 2.x, 3.x on CYGWIN but without cygwin1.dll -toolset gcc-nocygwin gcc : "-o " : -D : -s -O3 -mno-cygwin ; +toolset gcc-nocygwin gcc : "-o " : -D + : -s -O3 -finline-functions -mno-cygwin + : -s -O3 -fno-inline -pg -mno-cygwin ; ## Intel C/C++ for Linux -toolset intel-linux icc : "-o " : -D : -Xlinker -s -O3 ; +toolset intel-linux icc : "-o " : -D + : -Xlinker -s -O3 + : -g -O0 -p ; ## Intel C/C++ for Win32 -toolset intel-win32 icl : /Fe : -D : /nologo /GZ /Zi /MLd ; +toolset intel-win32 icl : /Fe : -D + : /nologo /ML /O2 /Ob2 /Gy /GF /GA /GB + : /nologo /MLd /DEBUG /Z7 /Od /Ob0 ; ## KCC ? -toolset kcc KCC : "-o " : -D : -s +K2 ; +toolset kcc KCC : "-o " : -D + : -s +K2 + : -g +K0 ; ## Borland Kylix -toolset kylix bc++ : -o : -D : -tC -q -O2 ; +toolset kylix bc++ : -o : -D + : -tC -q -O2 -vi -w-inl + : -tC -q -v -Od -vi- ; ## Metrowerks CodeWarrior 8.x -{ local mwcc = ; if $(NT) { mwcc = mwcc ; } else { mwcc = mwc$(OSPLAT:L) ; } - toolset metrowerks $(mwcc) : "-o " : -D : -runtime staticsingle -O ; } +{ + local mwcc = ; if $(NT) { mwcc = mwcc ; } else { mwcc = mwc$(OSPLAT:L) ; } + toolset metrowerks $(mwcc) : "-o " : -D + : -subsystem console -runtime staticsingle -opt full -inline auto -inline level=8 + : -subsystem console -runtime staticsingle -O0 -inline off ; +} ## MINGW GCC -toolset mingw gcc : "-o " : -D : -s -O3 -DMINGW ; +toolset mingw gcc : "-o " : -D + : -s -O3 -finline-functions -DMINGW + : -g -O0 -fno-inline -pg -DMINGW ; ## MIPS Pro -toolset mipspro cc : "-o " : -D : -s -O3 -g0 ; +toolset mipspro cc : "-o " : -D + : -s -O3 -g0 -INLINE:none + : -g -O0 -INLINE ; ## Microsoft Visual Studio C++ 6.x -toolset msvc cl : /Fe : -D : /nologo /GZ /Zi /MLd : $(MSVCDir)\\lib\\kernel32.lib ; +toolset msvc cl : /Fe : -D + : /nologo /ML /O2 /Ob2 /Gy /GF /GA /GB + : /nologo /MLd /DEBUG /Z7 /Od /Ob0 + : $(MSVCDir)\\lib\\kernel32.lib ; ## Sun Workshop 6 C++ -toolset sunpro CC : "-o " : -D : -s -fast -O4 ; +toolset sunpro CC : "-o " : -D + : -s -fast -O4 + : -g +d ; ## Compaq Alpha CXX -toolset tru64cxx cc : "-o " : -D : -s -O5 ; +toolset tru64cxx cc : "-o " : -D + : -s -O5 -inline speed + : -g -O0 -pg ; ## IBM VisualAge C++ -toolset vacpp xlc : "-o " : -D : -s -O3 -qstrict ; +toolset vacpp xlc : "-o " : -D + : -s -O3 -qstrict -qinline + : -g -qNOOPTimize -qnoinline -pg ; ## Microsoft Visual C++ .NET 7.x -toolset vc7 cl : /Fe : -D : /nologo /GZ /Zi /MLd : $(MSVCDir)\\lib\\kernel32.lib ; +toolset vc7 cl : /Fe : -D + : /nologo /ML /O2 /Ob2 /Gy /GF /GA /GB + : /nologo /MLd /DEBUG /Z7 /Od /Ob0 + : $(MSVCDir)\\lib\\kernel32.lib ; # First set the build commands and options according to the # preset toolset. -toolset = $(BOOST_JAM_TOOLSET) ; +toolset = [ MATCH --toolset=(.*) : $(ARGV) ] ; if ! $(toolset) in $(toolsets) { - EXIT "Unknown toolset '$(toolset)'." ; + ECHO "###" ; + ECHO "###" Unknown toolset: $(toolset) ; + ECHO "###" ; + ECHO "###" Known toolsets are: $(toolsets:J=", ") ; + EXIT "###" ; } --cc = $(tool.$(toolset).cc) ; if $(tool.$(toolset).opt.out[2]) @@ -84,7 +139,7 @@ else locate-target = $(LOCATE_TARGET) ; if $(VMS) { - locate-target ?= [.binvms] ; + locate-target ?= [.bin.vms] ; platform = vms ; } else if $(MAC) @@ -97,6 +152,10 @@ else locate-target ?= bin.$(OS:L)$(OSPLAT:L) ; platform = $(OS:L)$(OSPLAT:L) ; } +if $(debug) +{ + locate-target = $(locate-target).debug ; +} # We have some different files for UNIX, VMS, and NT. jam.source = @@ -130,6 +189,12 @@ else jam.source += execunix.c fileunix.c pathunix.c ; } +# Debug assertions, or not. +if ! $(debug) +{ + --defs += NDEBUG ; +} + # Enable some optional features. --defs += OPT_HEADER_CACHE_EXT ; --defs += OPT_GRAPH_DEBUG_EXT ; @@ -195,8 +260,8 @@ rule .yyacc } actions .yyacc { ./yyacc $(<) $(>) } -yacc ?= [ GLOB $(PATH) : bison bison.exe ] ; yacc ?= [ GLOB $(PATH) : yacc yacc.exe ] ; +yacc ?= [ GLOB $(PATH) : bison bison.exe ] ; yacc = $(yacc[1]) ; switch $(yacc:D=:S=) { @@ -210,18 +275,18 @@ rule .yacc } if $(NT) { actions .yacc { $(yacc) $(>) - rename y.tab.c $(<:S=.c) - rename y.tab.h $(<:S=.h) } } + rename y.tab.c $(<[1]:S=.c) + rename y.tab.h $(<[1]:S=.h) } } if $(UNIX) { actions .yacc { $(yacc) $(>) - mv -f y.tab.c $(<:S=.c) - mv -f y.tab.h $(<:S=.h) } } + mv -f y.tab.c $(<[1]:S=.c) + mv -f y.tab.h $(<[1]:S=.h) } } # How to build the grammar. if $(yacc) { .yyacc jamgram.y jamgramtab.h : jamgram.yy ; - .yacc jamgram.c : jamgram.y ; + .yacc jamgram.c jamgram.h : jamgram.y ; } # How to build the compiled in jambase. diff --git a/src/engine/build.sh b/src/engine/build.sh index 9a516df92..6f6b8b36e 100755 --- a/src/engine/build.sh +++ b/src/engine/build.sh @@ -25,15 +25,17 @@ function error_exit() echo "### You can specify the toolset as the argument, i.e.:" echo "### ./build.sh gcc" echo "###" + echo "### Toolsets supported by this script are: como, darwin, gcc, intel-linux, kcc, vacpp" + echo "###" exit 1 } -function test_run () +function test_path () { - q=`$* 2>/dev/null` + hash $1 2>/dev/null } function test_uname () { - if test_run uname; then + if test_path uname; then test `uname` = $* fi } @@ -41,9 +43,12 @@ function test_uname () function Guess_Toolset () { if test_uname Darwin ; then BOOST_JAM_TOOLSET=darwin - elif test_run gcc --version ; then BOOST_JAM_TOOLSET=gcc - elif [[ -e /opt/intel/compiler50/ia32/bin/iccvars.sh ]] ; then BOOST_JAM_TOOLSET=intel-linux - elif test_run xlc ; then BOOST_JAM_TOOLSET=vacpp + elif test_path gcc ; then BOOST_JAM_TOOLSET=gcc + elif test_path icc ; then BOOST_JAM_TOOLSET=intel-linux + elif test -e /opt/intel/compiler50/ia32/bin/iccvars.sh ; then BOOST_JAM_TOOLSET=intel-linux + elif test_path xlc ; then BOOST_JAM_TOOLSET=vacpp + elif test_path como ; then BOOST_JAM_TOOLSET=como + elif test_path KCC ; then BOOST_JAM_TOOLSET=kcc fi if test "$BOOST_JAM_TOOLSET" = "" ; then error_exit "Could not find a suitable toolset." @@ -53,35 +58,49 @@ function Guess_Toolset () # The one option we support in the invocation # is the name of the toolset to force building # with. -if test "$1" = ""; then - Guess_Toolset -else - BOOST_JAM_TOOLSET=$1 -fi +case "$1" in + -*) Guess_Toolset ;; + ?*) BOOST_JAM_TOOLSET=$1 ; shift ;; + *) Guess_Toolset ;; +esac case $BOOST_JAM_TOOLSET in gcc) BOOST_JAM_CC=gcc - BOOST_JAM_OPT_JAM="-O3 -o bootstrap.$BOOST_JAM_TOOLSET/jam0" - BOOST_JAM_OPT_MKJAMBASE="-O3 -o bootstrap.$BOOST_JAM_TOOLSET/mkjambase0" + BOOST_JAM_OPT_JAM="-o bootstrap.$BOOST_JAM_TOOLSET/jam0" + BOOST_JAM_OPT_MKJAMBASE="-o bootstrap.$BOOST_JAM_TOOLSET/mkjambase0" ;; darwin) BOOST_JAM_CC=cc - BOOST_JAM_OPT_JAM="-O3 -o bootstrap.$BOOST_JAM_TOOLSET/jam0" - BOOST_JAM_OPT_MKJAMBASE="-O3 -o bootstrap.$BOOST_JAM_TOOLSET/mkjambase0" + BOOST_JAM_OPT_JAM="-o bootstrap.$BOOST_JAM_TOOLSET/jam0" + BOOST_JAM_OPT_MKJAMBASE="-o bootstrap.$BOOST_JAM_TOOLSET/mkjambase0" ;; intel-linux) - echo_run /opt/intel/compiler50/ia32/bin/iccvars.sh + if test -e /opt/intel/compiler50/ia32/bin/iccvars.sh ; then + . /opt/intel/compiler50/ia32/bin/iccvars.sh + fi BOOST_JAM_CC=icc - BOOST_JAM_OPT_JAM="-Xlinker -O3 -o bootstrap.$BOOST_JAM_TOOLSET/jam0" - BOOST_JAM_OPT_MKJAMBASE="-Xlinker -O3 -o bootstrap.$BOOST_JAM_TOOLSET/mkjambase0" + BOOST_JAM_OPT_JAM="-o bootstrap.$BOOST_JAM_TOOLSET/jam0" + BOOST_JAM_OPT_MKJAMBASE="-o bootstrap.$BOOST_JAM_TOOLSET/mkjambase0" ;; vacpp) BOOST_JAM_CC=xlc - BOOST_JAM_OPT_JAM="-qstrict -O3 -o bootstrap.$BOOST_JAM_TOOLSET/jam0" - BOOST_JAM_OPT_MKJAMBASE="-qstrict -O3 -o bootstrap.$BOOST_JAM_TOOLSET/mkjambase0" + BOOST_JAM_OPT_JAM="-qstrict -o bootstrap.$BOOST_JAM_TOOLSET/jam0" + BOOST_JAM_OPT_MKJAMBASE="-qstrict -o bootstrap.$BOOST_JAM_TOOLSET/mkjambase0" + ;; + + como) + BOOST_JAM_CC=como + BOOST_JAM_OPT_JAM="-o bootstrap.$BOOST_JAM_TOOLSET/jam0" + BOOST_JAM_OPT_MKJAMBASE="-o bootstrap.$BOOST_JAM_TOOLSET/mkjambase0" + ;; + + kcc) + BOOST_JAM_CC=KCC + BOOST_JAM_OPT_JAM="-o bootstrap.$BOOST_JAM_TOOLSET/jam0" + BOOST_JAM_OPT_MKJAMBASE="-o bootstrap.$BOOST_JAM_TOOLSET/mkjambase0" ;; *) @@ -104,16 +123,24 @@ BJAM_SOURCES="\ echo_run rm -rf bootstrap.$BOOST_JAM_TOOLSET echo_run mkdir bootstrap.$BOOST_JAM_TOOLSET -if [[ ! -a jamgram.y || ! -a jamgramtab.h ]] ; then - echo_run ./yyacc jamgram.y jamgramtab.h jamgram.yy +if test ! -e jamgram.y -o ! -e jamgramtab.h ; then + echo_run /bin/sh ./yyacc jamgram.y jamgramtab.h jamgram.yy fi -if [[ ! -a jambase.c ]] ; then +if test ! -e jamgram.c -o ! -e jamgram.h ; then + if test_path yacc ; then YACC="yacc -d" + elif test_path bison ; then YACC="bison -y -d --yacc" + fi + echo_run $YACC jamgram.y + mv -f y.tab.c jamgram.c + mv -f y.tab.h jamgram.h +fi +if test ! -e jambase.c ; then echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_MKJAMBASE} ${MKJAMBASE_SOURCES} - if test -e "./bootstrap.$BOOST_JAM_TOOLSET/mkjambase0" ; then + if test -x "./bootstrap.$BOOST_JAM_TOOLSET/mkjambase0" ; then echo_run ./bootstrap.$BOOST_JAM_TOOLSET/mkjambase0 jambase.c Jambase fi fi echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_JAM} ${BJAM_SOURCES} -if [[ -e "./bootstrap.$BOOST_JAM_TOOLSET/jam0" ]] ; then - echo_run ./bootstrap.$BOOST_JAM_TOOLSET/jam0 -f build.jam -sBOOST_JAM_TOOLSET=$BOOST_JAM_TOOLSET +if test -x "./bootstrap.$BOOST_JAM_TOOLSET/jam0" ; then + echo_run ./bootstrap.$BOOST_JAM_TOOLSET/jam0 -f build.jam --toolset=$BOOST_JAM_TOOLSET "$@" fi