From 9313cb28513c3fa86d7961e95d632997952a8faf Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 4 Nov 2002 06:31:01 +0000 Subject: [PATCH] New scripts for easier building of bjam executable. build.bat: Windows NT BATCH bootstrap script. build.sh: Unix shell bootstrap script. build.jam: b/jam standalone Jamfile for building and distribution creation. boost-jam.spec: modifications to conform to RedHat names/versioning and using new ./build.sh. [SVN r16085] --- historic/jam/src/boost-jam.spec | 20 +- historic/jam/src/build.bat | 104 +++++++++ historic/jam/src/build.jam | 393 ++++++++++++++++++++++++++++++++ historic/jam/src/build.sh | 119 ++++++++++ jam_src/boost-jam.spec | 20 +- jam_src/build.bat | 104 +++++++++ jam_src/build.jam | 393 ++++++++++++++++++++++++++++++++ jam_src/build.sh | 119 ++++++++++ 8 files changed, 1252 insertions(+), 20 deletions(-) create mode 100644 historic/jam/src/build.bat create mode 100644 historic/jam/src/build.jam create mode 100644 historic/jam/src/build.sh create mode 100644 jam_src/build.bat create mode 100644 jam_src/build.jam create mode 100644 jam_src/build.sh diff --git a/historic/jam/src/boost-jam.spec b/historic/jam/src/boost-jam.spec index f722f60be..1b094aff0 100644 --- a/historic/jam/src/boost-jam.spec +++ b/historic/jam/src/boost-jam.spec @@ -2,13 +2,13 @@ Name: boost-jam Version: 3.1.3 Summary: Build tool Release: 1 -Source: boost-jam-%{version}.tar.bz2 +Source: %{name}-%{version}.tgz License: GPL Group: Development/Tools URL: http://www.boost.org Packager: Vladimir Prus -BuildRoot: /var/tmp/boost-jam-%{version}.root +BuildRoot: /var/tmp/%{name}-%{version}.root %description Boost Jam is a build tool based on FTJam, which in turn is based on @@ -22,26 +22,26 @@ Authors: Boost Jam : David Abrahams %prep -%setup -n boost-jam-%{version} +%setup -n %{name}-%{version} %build -YACC="" LOCATE_TARGET=bin make +YACC="" 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 -install -m 755 bin/jam $RPM_BUILD_ROOT%{_bindir}/jam -ln -sf jam $RPM_BUILD_ROOT%{_bindir}/bjam -install -m 644 Jam.html Jambase.html Jamfile.html README RELNOTES INSTALL \ - $RPM_BUILD_ROOT%{_docdir}/boost-jam +mkdir -p $RPM_BUILD_ROOT%{_docdir}/boost-jam-%{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} 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 +%doc %{_docdir}/boost-jam-%{version} %clean diff --git a/historic/jam/src/build.bat b/historic/jam/src/build.bat new file mode 100644 index 000000000..a187b5858 --- /dev/null +++ b/historic/jam/src/build.bat @@ -0,0 +1,104 @@ +@ECHO OFF +REM Copyrigt (C) 2002 Rene Rivera. +REM Permission to copy, use, modify, sell and distribute this software +REM is granted provided this copyright notice appears in all copies. +REM This software is provided "as is" without express or implied +REM warranty, and with no claim as to its suitability for any purpose. + +REM Reset the toolset. +set BOOST_JAM_TOOLSET= + +REM The one option we support in the invocation +REM is the name of the toolset to force building +REM with. +if "x%1x" == "xx" goto Guess_Toolset +if "%1" == "metrowerks" goto Set_Metrowerks +if "%1" == "msvc" goto Set_MSVC_Defaut +if "%1" == "vc7" goto Set_MSVC7_Defaut +if "%1" == "borland" goto Set_Borland +ECHO "###" +ECHO "### Unknown toolset:" %1 +ECHO "###" +ECHO "### You can specify the toolset as the argument, i.e.:" +ECHO "### .\build.bat msvc" +ECHO "###" +goto Finish + +REM Try and guess the toolset to bootstrap the build with... +:Guess_Toolset +if NOT "x%CWFolder%x" == "xx" goto Set_Metrowerks +if NOT "x%MSVCDir%x" == "xx" goto Set_MSVC +if EXIST "C:\Program Files\Microsoft Visual C++\VC98\bin\VCVARS32.BAT" goto Set_MSVC_Defaut +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 + +:Set_Metrowerks +set BOOST_JAM_TOOLSET=metrowerks +set BOOST_JAM_CC=mwcc -runtime staticsingle -O -DNT +set BOOST_JAM_OPT_JAM=-o bootstrap.%JAM_TOOLSET%\jam0.exe +set BOOST_JAM_OPT_MKJAMBASE=-o bootstrap.%JAM_TOOLSET%\mkjambase0.exe +goto Build + +:Set_MSVC +if EXIST "%MSVCDir%\VC7\bin" (set BOOST_JAM_TOOLSET=vc7) else (set BOOST_JAM_TOOLSET=msvc) +set BOOST_JAM_CC=cl /nologo /GZ /Zi /MLd -DNT -DYYDEBUG %MSVCDIR%\lib\kernel32.lib +set BOOST_JAM_OPT_JAM=/Febootstrap.%JAM_TOOLSET%\jam0 +set BOOST_JAM_OPT_MKJAMBASE=/Febootstrap.%JAM_TOOLSET%\mkjambase0 +goto Build + +:Set_MSVC_Default +call "C:\Program Files\Microsoft Visual C++\VC98\bin\VCVARS32.BAT" +goto Set_MSVC + +:Set_MSVS_Default +call "C:\Program Files\Microsoft Visual Studio\VC98\bin\VCVARS32.BAT" +goto Set_MSVC + +:Set_MSVC7_Default +call "C:\Program Files\Microsoft Visual Studio .NET\VC7\bin\VCVARS32.BAT" +goto Set_MSVC + +:Set_Borland +set BOOST_JAM_TOOLSET=borland +set PATH=%PATH%;C:\Borland\BCC55\Bin +set BOOST_JAM_CC=bcc32 -WC -w- -q -IC:\Borland\BCC55\Include -LC:\Borland\BCC55\Lib -O2 /DNT -nbootstrap.%BOOST_JAM_TOOLSET% +set BOOST_JAM_OPT_JAM=-ejam0 +set BOOST_JAM_OPT_MKJAMBASE=-emkjambasejam0 +goto Build + +:Build +ECHO "###" +ECHO "### Using '%BOOST_JAM_TOOLSET%' toolset." +ECHO "###" + +set MKJAMBASE_SOURCES=mkjambase.c +set BJAM_SOURCES= +set BJAM_SOURCES=%BJAM_SOURCES% command.c compile.c execnt.c execunix.c execvms.c expand.c +set BJAM_SOURCES=%BJAM_SOURCES% filent.c fileos2.c fileunix.c filevms.c glob.c hash.c +set BJAM_SOURCES=%BJAM_SOURCES% hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c +set BJAM_SOURCES=%BJAM_SOURCES% newstr.c option.c parse.c pathunix.c pathvms.c regexp.c +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. +@ECHO ON +rd /S /Q bootstrap.%BOOST_JAM_TOOLSET% +md bootstrap.%BOOST_JAM_TOOLSET% +@if EXIST jambase.c goto Build_BJAM +%JAM_CC% %BOOST_JAM_MKJAMBASE_OPT% +@if NOT EXIST ".\bootstrap.%BOOST_JAM_TOOLSET%\mkjambase0.exe" goto Finish +".\bootstrap.%BOOST_JAM_TOOLSET%\mkjambase0.exe" jambase.c Jambase +:Build_BJAM +%BOOST_JAM_CC% %BOOST_JAM_OPT% %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% + +:Finish diff --git a/historic/jam/src/build.jam b/historic/jam/src/build.jam new file mode 100644 index 000000000..156d333cb --- /dev/null +++ b/historic/jam/src/build.jam @@ -0,0 +1,393 @@ +# Copyrigt (C) 2002 Rene Rivera. +# Permission to copy, use, modify, sell and distribute this software +# is granted provided this copyright notice appears in all copies. +# This software is provided "as is" without express or implied +# warranty, and with no claim as to its suitability for any purpose. + +# Info about what we are building. +NAME = boost-jam ; +VERSION = 3.1.3 ; +RELEASE = 1 ; + +# 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 * ) +{ + tool.$(name).cc ?= $(command) ; + tool.$(name).opt.out ?= $(opt.out) ; + tool.$(name).opt.define ?= $(opt.define) ; + tool.$(name).flags ?= $(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 ; +## Comeau C/C++ 4.x +toolset como como : "-o " : -D ; +## MacOSX Darwin, using GCC 2.9.x, 3.x +toolset darwin cc : "-o " : -D : -s -O3 ; +## GCC 2.x, 3.x +toolset gcc gcc : "-o " : -D : -s -O3 ; +## GCC 2.x, 3.x on CYGWIN but without cygwin1.dll +toolset gcc-nocygwin gcc : "-o " : -D : -s -O3 -mno-cygwin ; +## Intel C/C++ for Linux +toolset intel-linux icc : "-o " : -D : -Xlinker -s -O3 ; +## Intel C/C++ for Win32 +toolset intel-win32 icl : /Fe : -D : /nologo /GZ /Zi /MLd ; +## KCC ? +toolset kcc KCC : "-o " : -D : -s +K2 ; +## Borland Kylix +toolset kylix bc++ : -o : -D : -tC -q -O2 ; +## Metrowerks CodeWarrior 8.x +{ local mwcc = ; if $(NT) { mwcc = mwcc ; } else { mwcc = mwc$(OSPLAT:L) ; } + toolset metrowerks $(mwcc) : "-o " : -D : -runtime staticsingle -O ; } +## MINGW GCC +toolset mingw gcc : "-o " : -D : -s -O3 -DMINGW ; +## MIPS Pro +toolset mipspro cc : "-o " : -D : -s -O3 -g0 ; +## Microsoft Visual Studio C++ 6.x +toolset msvc cl : /Fe : -D : /nologo /GZ /Zi /MLd : $(MSVCDir)\\lib\\kernel32.lib ; +## Sun Workshop 6 C++ +toolset sunpro CC : "-o " : -D : -s -fast -O4 ; +## Compaq Alpha CXX +toolset tru64cxx cc : "-o " : -D : -s -O5 ; +## IBM VisualAge C++ +toolset vacpp xlc : "-o " : -D : -s -O3 -qstrict ; +## Microsoft Visual C++ .NET 7.x +toolset vc7 cl : /Fe : -D : /nologo /GZ /Zi /MLd : $(MSVCDir)\\lib\\kernel32.lib ; + +# First set the build commands and options according to the +# preset toolset. +toolset = $(BOOST_JAM_TOOLSET) ; +if ! $(toolset) in $(toolsets) +{ + EXIT "Unknown toolset '$(toolset)'." ; +} +--cc = $(tool.$(toolset).cc) ; +if $(tool.$(toolset).opt.out[2]) +{ + --bin = $(tool.$(toolset).opt.out[1]) ; + --dir = $(tool.$(toolset).opt.out[2]) ; +} +else +{ + --out = $(tool.$(toolset).opt.out) ; +} +--def = $(tool.$(toolset).opt.define) ; +--flags = $(tool.$(toolset).flags) ; +--defs = $(tool.$(toolset).defines) ; +--libs = $(tool.$(toolset).linklibs) ; + +# Put executables in platform-specific subdirectory. +locate-target = $(LOCATE_TARGET) ; +if $(VMS) +{ + locate-target ?= [.binvms] ; + platform = vms ; +} +else if $(MAC) +{ + locate-target ?= :bin.$(OS:L)$(OSPLAT:L) ; + platform = $(OS:L)$(OSPLAT:L) ; +} +else +{ + locate-target ?= bin.$(OS:L)$(OSPLAT:L) ; + platform = $(OS:L)$(OSPLAT:L) ; +} + +# We have some different files for UNIX, VMS, and NT. +jam.source = + command.c compile.c expand.c glob.c + hash.c hcache.c headers.c hdrmacro.c + jam.c jambase.c jamgram.c + lists.c make.c make1.c newstr.c + option.c parse.c regexp.c rules.c + scan.c search.c subst.c + timestamp.c variable.c modules.c strings.c filesys.c + builtins.c pwd.c + ; +if $(NT) +{ + jam.source += execnt.c filent.c pathunix.c ; +} +else if $(OS2) +{ + jam.source += execunix.c fileos2.c pathunix.c ; +} +else if $(VMS) +{ + jam.source += execvms.c filevms.c pathvms.c ; +} +else if $(MAC) +{ + jam.source += execmac.c filemac.c pathmac.c ; +} +else +{ + jam.source += execunix.c fileunix.c pathunix.c ; +} + +# Enable some optional features. +--defs += OPT_HEADER_CACHE_EXT ; +--defs += OPT_GRAPH_DEBUG_EXT ; + +# Bug fixes +--defs += OPT_FIX_TARGET_VARIABLES_EXT ; + +# Improvements +--defs += OPT_IMPROVED_PATIENCE_EXT ; + +if ( $(OS) = NT || $(NT) ) && ! NT in $(--defs) +{ + --defs += NT ; +} +--defs += YYSTACKSIZE=5000 ; + +# The basic symbolic targets... +NOTFILE all clean dist ; +ALWAYS clean ; + +# Utility rules and actions... +rule .clean +{ + .rm clean : $(<) ; +} +if $(NT) { actions piecemeal together existing .rm { del /F /Q $(>) } } +if $(UNIX) { actions piecemeal together existing .rm { rm -f $(>) } } + +rule .mkdir +{ + NOUPDATE $(<) ; + if $(<:P) { DEPENDS $(<) : $(<:P) ; .mkdir $(<:P) ; } + if ! $(md<$(<)>) { .md $(<) ; md<$(<)> = - ; } +} +actions .md { mkdir $(<) } + +rule .exe +{ + local exe = $(<) ; + if $(NT) { exe = $(exe:S=.exe) ; } + LOCATE on $(exe) = $(locate-target) ; + DEPENDS $(exe) : $(>) ; + DEPENDS $(exe) : $(locate-target) ; + .mkdir $(locate-target) ; + .cc $(exe) : $(>) ; + .clean $(exe) ; + return $(exe) ; +} +actions .cc { $(--cc) $(--bin)$(<:D=) $(--dir)$(<:D) $(--out)$(<) $(--def)$(--defs) $(--flags) $(--libs) $(>) } + +rule .link +{ + DEPENDS $(<) : $(>) ; + .clean $(<) ; +} +if $(NT) { actions .link { copy $(>) $(<) } } +if $(UNIX) { actions .link { ln -f $(>) $(<) } } + +rule .yyacc +{ + DEPENDS $(<) : $(>) ; + .clean $(<) ; +} +actions .yyacc { ./yyacc $(<) $(>) } + +yacc ?= [ GLOB $(PATH) : bison bison.exe ] ; +yacc ?= [ GLOB $(PATH) : yacc yacc.exe ] ; +yacc = $(yacc[1]) ; +switch $(yacc:D=:S=) +{ + case bison : yacc += -y -d --yacc ; # -t -l -v ; + case yacc : yacc += -d ; +} +rule .yacc +{ + DEPENDS $(<) : $(>) ; + .clean $(<) ; +} +if $(NT) { actions .yacc +{ $(yacc) $(>) + rename y.tab.c $(<:S=.c) + rename y.tab.h $(<:S=.h) } } +if $(UNIX) { actions .yacc +{ $(yacc) $(>) + mv -f y.tab.c $(<:S=.c) + mv -f y.tab.h $(<:S=.h) } } + +# How to build the grammar. +if $(yacc) +{ + .yyacc jamgram.y jamgramtab.h : jamgram.yy ; + .yacc jamgram.c : jamgram.y ; +} + +# How to build the compiled in jambase. +rule exe.mkjambase +{ + local exe = [ .exe mkjambase : mkjambase.c ] ; + DEPENDS $(<) : $(exe) $(>) ; + LEAVES $(<) ; + if $(NT) { chmod on $(<) = "attrib -r " ; } + if $(UNIX) { chmod on $(<) = "chmod +w " ; } + mkjambase.exe on $(<) = $(exe:R=$(locate-target)) ; + .clean $(<) ; +} +actions exe.mkjambase +{ $(chmod)$(<) + $(mkjambase.exe) $(<) $(>) } +exe.mkjambase jambase.c : Jambase ; + +# How to build Jam. +rule exe.jam +{ + $(>).exe = [ .exe $(>) : $(jam.source) ] ; + $(<).exe = $(<:S=$($(>).exe:S)) ; + LOCATE on $($(<).exe) = $(locate-target) ; + .link $($(<).exe) : $($(>).exe) ; + + DEPENDS all : $($(>).exe) $($(<).exe) ; +} +exe.jam bjam : jam ; + +# Distribution making from here on out. +dist.docs = + Porting README RELNOTES + Jam.html Jambase.html Jamfile.html + ; +dist.source = + [ GLOB . : *.c *.h ] + ; +dist.source = $(dist.source:D=) + $(dist.docs) + build.jam build.bat build.sh + Jambase Jamfile + yyacc jamgram.y jamgram.yy + debian/changelog debian/control debian/copyright debian/jam.man.sgml debian/rules + boost-jam.spec + ; +dist.bin = + bjam jam mkjambase + ; +dist.bin = + $(dist.bin:S=$(bjam.exe:S):R=$(locate-target)) + ; + +if $(NT) +{ +if [ GLOB "C:\\Program Files\\7-ZIP" : "7zn.exe" ] +{ + actions .pack { "C:\Program Files\7-ZIP\7zn.exe" a -r -tzip "$(<)" "$(>)" } + actions .zip { "C:\Program Files\7-ZIP\7zn.exe" a -r -tzip "$(<)" "$(>)" } +} +else +{ + actions .pack { zip -9r "$(<)" "$(>)" } + actions .zip { zip -9r "$(<)" "$(>)" } +} + actions .cp { cp -a "$(>)" "$(<)" } +} +if $(UNIX) +{ + actions .pack { tar zcf "$(<)" "$(>)" } + actions .zip { gzip -c9 "$(>)" > "$(<)" } + actions .cp { cp -af "$(>)" "$(<)" } +} + +# The single binary, compressed. +rule .binary +{ + local zip = ; + if $(NT) { zip = $($(<).exe:S=.zip) ; } + if $(UNIX) { zip = $($(<).exe:S=.gz) ; } + DEPENDS $(zip) : $($(<).exe) ; + DEPENDS dist : $(zip) ; + LOCATE on $(zip) = $(locate-target) ; + .zip $(zip) : $($(<).exe) ; + .clean $(zip) ; +} + +# Package some file. +rule .package ( dst-dir : src-files + ) +{ + local src-dirs = ; + for local s in $(src-files:D) { if ! $(s) in $(src-dirs) && ! $(s) = "" { src-dirs += $(s) ; } } + local dst-files = $(src-files:R=$(dst-dir)) ; + local dst-dirs = $(src-dirs:R=$(dst-dir)) ; + + local pack = ; + if $(NT) { pack = $(dst-dir).zip ; } + if $(UNIX) { pack = $(dst-dir).tgz ; } + + DEPENDS dist : $(pack) ; + DEPENDS $(pack) : $(dst-files) ; + + for local src-file in $(src-files) + { + local dst-file = $(src-file:R=$(dst-dir)) ; + DEPENDS $(dst-file) : $(src-file) $(dst-file:D) ; + .mkdir $(dst-file:D) ; + .cp $(dst-file) : $(src-file) ; + .clean $(dst-file) ; + } + + .pack $(pack) : $(dst-files) ; + .clean $(pack) ; +} + +# RPM distro file. +rpm-tool = [ GLOB $(PATH) : "rpm" ] ; +rule .rpm ( name : source ) +{ + local rpm-arch = ; + switch $(OSPLAT) + { + case X86 : rpm-arch ?= i386 ; + case PPC : rpm-arch ?= ppc ; + case AXP : rpm-arch ?= alpha ; + # no guaranty for these: + case IA64 : rpm-arch ?= ia64 ; + case ARM : rpm-arch ?= arm ; + case SPARC : rpm-arch ?= sparc ; + case * : rpm-arch ?= other ; + } + local target = $(name)-rpm ; + NOTFILE $(target) ; + DEPENDS dist : $(target) ; + DEPENDS $(target) : $(name).$(rpm-arch).rpm $(name).src.rpm ; + DEPENDS $(name).$(rpm-arch).rpm : $(source) ; + DEPENDS $(name).src.rpm : $(name).$(rpm-arch).rpm ; + docs on $(target) = $(dist.docs:J=" ") ; + arch on $(target) = $(rpm-arch) ; + .rpm-build $(target) : $(source) ; + .clean $(name).$(rpm-arch).rpm $(name).src.rpm ; +} +actions .rpm-build +{ export BOOST_JAM_DOCS="$(docs)" + rpm -ta --target $(arch) $(>) | tee rpm.out + cp `grep -e '^Wrote:' rpm.out | sed 's/^Wrote: //'` . + rm -f rpm.out } + +# The distribution targets. +.binary bjam ; +.package $(NAME)-$(VERSION) : $(dist.source) ; +.package $(NAME)-$(VERSION)-$(RELEASE)-$(platform) : $(dist.bin) ; +if $(rpm-tool) +{ + .rpm $(NAME)-$(VERSION)-$(RELEASE) : $(NAME)-$(VERSION).tgz ; +} + + +# Update any targets in the specified commandline. +local e-- = ; +for local e in $(ARGV[2-]) +{ + if ! [ MATCH "^(-).*" : $(e) ] && $(e--) != "-f" + { + # This is not an option, so it is a target name. + UPDATE $(e) ; + } + e-- = $(e) ; +} diff --git a/historic/jam/src/build.sh b/historic/jam/src/build.sh new file mode 100644 index 000000000..9a516df92 --- /dev/null +++ b/historic/jam/src/build.sh @@ -0,0 +1,119 @@ +#!/bin/sh +# Copyrigt (C) 2002 Rene Rivera. +# Permission to copy, use, modify, sell and distribute this software +# is granted provided this copyright notice appears in all copies. +# This software is provided "as is" without express or implied +# warranty, and with no claim as to its suitability for any purpose. + +# Reset the toolset. +BOOST_JAM_TOOLSET= + +function echo_run () +{ + echo "$@" + "$@" + r=$? + if test $r -ne 0 ; then + exit $r + fi +} +function error_exit() +{ + echo "###" + echo "###" "$@" + echo "###" + echo "### You can specify the toolset as the argument, i.e.:" + echo "### ./build.sh gcc" + echo "###" + exit 1 +} +function test_run () +{ + q=`$* 2>/dev/null` +} +function test_uname () +{ + if test_run uname; then + test `uname` = $* + fi +} +# Try and guess the toolset to bootstrap the build with... +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 + fi + if test "$BOOST_JAM_TOOLSET" = "" ; then + error_exit "Could not find a suitable toolset." + fi +} + +# 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 $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" + ;; + + 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" + ;; + + intel-linux) + echo_run /opt/intel/compiler50/ia32/bin/iccvars.sh + 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" + ;; + + 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" + ;; + + *) + error_exit "Unknown toolset: $BOOST_JAM_TOOLSET" + ;; +esac + +echo "###" +echo "### Using '$BOOST_JAM_TOOLSET' toolset." +echo "###" + +MKJAMBASE_SOURCES="mkjambase.c" +BJAM_SOURCES="\ + command.c compile.c execnt.c execunix.c execvms.c expand.c\ + filent.c fileos2.c fileunix.c filevms.c glob.c hash.c\ + hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c\ + newstr.c option.c parse.c pathunix.c pathvms.c regexp.c\ + rules.c scan.c search.c subst.c timestamp.c variable.c modules.c\ + strings.c filesys.c builtins.c pwd.c" + +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 +fi +if [[ ! -a jambase.c ]] ; then + echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_MKJAMBASE} ${MKJAMBASE_SOURCES} + if test -e "./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 +fi diff --git a/jam_src/boost-jam.spec b/jam_src/boost-jam.spec index f722f60be..1b094aff0 100644 --- a/jam_src/boost-jam.spec +++ b/jam_src/boost-jam.spec @@ -2,13 +2,13 @@ Name: boost-jam Version: 3.1.3 Summary: Build tool Release: 1 -Source: boost-jam-%{version}.tar.bz2 +Source: %{name}-%{version}.tgz License: GPL Group: Development/Tools URL: http://www.boost.org Packager: Vladimir Prus -BuildRoot: /var/tmp/boost-jam-%{version}.root +BuildRoot: /var/tmp/%{name}-%{version}.root %description Boost Jam is a build tool based on FTJam, which in turn is based on @@ -22,26 +22,26 @@ Authors: Boost Jam : David Abrahams %prep -%setup -n boost-jam-%{version} +%setup -n %{name}-%{version} %build -YACC="" LOCATE_TARGET=bin make +YACC="" 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 -install -m 755 bin/jam $RPM_BUILD_ROOT%{_bindir}/jam -ln -sf jam $RPM_BUILD_ROOT%{_bindir}/bjam -install -m 644 Jam.html Jambase.html Jamfile.html README RELNOTES INSTALL \ - $RPM_BUILD_ROOT%{_docdir}/boost-jam +mkdir -p $RPM_BUILD_ROOT%{_docdir}/boost-jam-%{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} 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 +%doc %{_docdir}/boost-jam-%{version} %clean diff --git a/jam_src/build.bat b/jam_src/build.bat new file mode 100644 index 000000000..a187b5858 --- /dev/null +++ b/jam_src/build.bat @@ -0,0 +1,104 @@ +@ECHO OFF +REM Copyrigt (C) 2002 Rene Rivera. +REM Permission to copy, use, modify, sell and distribute this software +REM is granted provided this copyright notice appears in all copies. +REM This software is provided "as is" without express or implied +REM warranty, and with no claim as to its suitability for any purpose. + +REM Reset the toolset. +set BOOST_JAM_TOOLSET= + +REM The one option we support in the invocation +REM is the name of the toolset to force building +REM with. +if "x%1x" == "xx" goto Guess_Toolset +if "%1" == "metrowerks" goto Set_Metrowerks +if "%1" == "msvc" goto Set_MSVC_Defaut +if "%1" == "vc7" goto Set_MSVC7_Defaut +if "%1" == "borland" goto Set_Borland +ECHO "###" +ECHO "### Unknown toolset:" %1 +ECHO "###" +ECHO "### You can specify the toolset as the argument, i.e.:" +ECHO "### .\build.bat msvc" +ECHO "###" +goto Finish + +REM Try and guess the toolset to bootstrap the build with... +:Guess_Toolset +if NOT "x%CWFolder%x" == "xx" goto Set_Metrowerks +if NOT "x%MSVCDir%x" == "xx" goto Set_MSVC +if EXIST "C:\Program Files\Microsoft Visual C++\VC98\bin\VCVARS32.BAT" goto Set_MSVC_Defaut +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 + +:Set_Metrowerks +set BOOST_JAM_TOOLSET=metrowerks +set BOOST_JAM_CC=mwcc -runtime staticsingle -O -DNT +set BOOST_JAM_OPT_JAM=-o bootstrap.%JAM_TOOLSET%\jam0.exe +set BOOST_JAM_OPT_MKJAMBASE=-o bootstrap.%JAM_TOOLSET%\mkjambase0.exe +goto Build + +:Set_MSVC +if EXIST "%MSVCDir%\VC7\bin" (set BOOST_JAM_TOOLSET=vc7) else (set BOOST_JAM_TOOLSET=msvc) +set BOOST_JAM_CC=cl /nologo /GZ /Zi /MLd -DNT -DYYDEBUG %MSVCDIR%\lib\kernel32.lib +set BOOST_JAM_OPT_JAM=/Febootstrap.%JAM_TOOLSET%\jam0 +set BOOST_JAM_OPT_MKJAMBASE=/Febootstrap.%JAM_TOOLSET%\mkjambase0 +goto Build + +:Set_MSVC_Default +call "C:\Program Files\Microsoft Visual C++\VC98\bin\VCVARS32.BAT" +goto Set_MSVC + +:Set_MSVS_Default +call "C:\Program Files\Microsoft Visual Studio\VC98\bin\VCVARS32.BAT" +goto Set_MSVC + +:Set_MSVC7_Default +call "C:\Program Files\Microsoft Visual Studio .NET\VC7\bin\VCVARS32.BAT" +goto Set_MSVC + +:Set_Borland +set BOOST_JAM_TOOLSET=borland +set PATH=%PATH%;C:\Borland\BCC55\Bin +set BOOST_JAM_CC=bcc32 -WC -w- -q -IC:\Borland\BCC55\Include -LC:\Borland\BCC55\Lib -O2 /DNT -nbootstrap.%BOOST_JAM_TOOLSET% +set BOOST_JAM_OPT_JAM=-ejam0 +set BOOST_JAM_OPT_MKJAMBASE=-emkjambasejam0 +goto Build + +:Build +ECHO "###" +ECHO "### Using '%BOOST_JAM_TOOLSET%' toolset." +ECHO "###" + +set MKJAMBASE_SOURCES=mkjambase.c +set BJAM_SOURCES= +set BJAM_SOURCES=%BJAM_SOURCES% command.c compile.c execnt.c execunix.c execvms.c expand.c +set BJAM_SOURCES=%BJAM_SOURCES% filent.c fileos2.c fileunix.c filevms.c glob.c hash.c +set BJAM_SOURCES=%BJAM_SOURCES% hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c +set BJAM_SOURCES=%BJAM_SOURCES% newstr.c option.c parse.c pathunix.c pathvms.c regexp.c +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. +@ECHO ON +rd /S /Q bootstrap.%BOOST_JAM_TOOLSET% +md bootstrap.%BOOST_JAM_TOOLSET% +@if EXIST jambase.c goto Build_BJAM +%JAM_CC% %BOOST_JAM_MKJAMBASE_OPT% +@if NOT EXIST ".\bootstrap.%BOOST_JAM_TOOLSET%\mkjambase0.exe" goto Finish +".\bootstrap.%BOOST_JAM_TOOLSET%\mkjambase0.exe" jambase.c Jambase +:Build_BJAM +%BOOST_JAM_CC% %BOOST_JAM_OPT% %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% + +:Finish diff --git a/jam_src/build.jam b/jam_src/build.jam new file mode 100644 index 000000000..156d333cb --- /dev/null +++ b/jam_src/build.jam @@ -0,0 +1,393 @@ +# Copyrigt (C) 2002 Rene Rivera. +# Permission to copy, use, modify, sell and distribute this software +# is granted provided this copyright notice appears in all copies. +# This software is provided "as is" without express or implied +# warranty, and with no claim as to its suitability for any purpose. + +# Info about what we are building. +NAME = boost-jam ; +VERSION = 3.1.3 ; +RELEASE = 1 ; + +# 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 * ) +{ + tool.$(name).cc ?= $(command) ; + tool.$(name).opt.out ?= $(opt.out) ; + tool.$(name).opt.define ?= $(opt.define) ; + tool.$(name).flags ?= $(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 ; +## Comeau C/C++ 4.x +toolset como como : "-o " : -D ; +## MacOSX Darwin, using GCC 2.9.x, 3.x +toolset darwin cc : "-o " : -D : -s -O3 ; +## GCC 2.x, 3.x +toolset gcc gcc : "-o " : -D : -s -O3 ; +## GCC 2.x, 3.x on CYGWIN but without cygwin1.dll +toolset gcc-nocygwin gcc : "-o " : -D : -s -O3 -mno-cygwin ; +## Intel C/C++ for Linux +toolset intel-linux icc : "-o " : -D : -Xlinker -s -O3 ; +## Intel C/C++ for Win32 +toolset intel-win32 icl : /Fe : -D : /nologo /GZ /Zi /MLd ; +## KCC ? +toolset kcc KCC : "-o " : -D : -s +K2 ; +## Borland Kylix +toolset kylix bc++ : -o : -D : -tC -q -O2 ; +## Metrowerks CodeWarrior 8.x +{ local mwcc = ; if $(NT) { mwcc = mwcc ; } else { mwcc = mwc$(OSPLAT:L) ; } + toolset metrowerks $(mwcc) : "-o " : -D : -runtime staticsingle -O ; } +## MINGW GCC +toolset mingw gcc : "-o " : -D : -s -O3 -DMINGW ; +## MIPS Pro +toolset mipspro cc : "-o " : -D : -s -O3 -g0 ; +## Microsoft Visual Studio C++ 6.x +toolset msvc cl : /Fe : -D : /nologo /GZ /Zi /MLd : $(MSVCDir)\\lib\\kernel32.lib ; +## Sun Workshop 6 C++ +toolset sunpro CC : "-o " : -D : -s -fast -O4 ; +## Compaq Alpha CXX +toolset tru64cxx cc : "-o " : -D : -s -O5 ; +## IBM VisualAge C++ +toolset vacpp xlc : "-o " : -D : -s -O3 -qstrict ; +## Microsoft Visual C++ .NET 7.x +toolset vc7 cl : /Fe : -D : /nologo /GZ /Zi /MLd : $(MSVCDir)\\lib\\kernel32.lib ; + +# First set the build commands and options according to the +# preset toolset. +toolset = $(BOOST_JAM_TOOLSET) ; +if ! $(toolset) in $(toolsets) +{ + EXIT "Unknown toolset '$(toolset)'." ; +} +--cc = $(tool.$(toolset).cc) ; +if $(tool.$(toolset).opt.out[2]) +{ + --bin = $(tool.$(toolset).opt.out[1]) ; + --dir = $(tool.$(toolset).opt.out[2]) ; +} +else +{ + --out = $(tool.$(toolset).opt.out) ; +} +--def = $(tool.$(toolset).opt.define) ; +--flags = $(tool.$(toolset).flags) ; +--defs = $(tool.$(toolset).defines) ; +--libs = $(tool.$(toolset).linklibs) ; + +# Put executables in platform-specific subdirectory. +locate-target = $(LOCATE_TARGET) ; +if $(VMS) +{ + locate-target ?= [.binvms] ; + platform = vms ; +} +else if $(MAC) +{ + locate-target ?= :bin.$(OS:L)$(OSPLAT:L) ; + platform = $(OS:L)$(OSPLAT:L) ; +} +else +{ + locate-target ?= bin.$(OS:L)$(OSPLAT:L) ; + platform = $(OS:L)$(OSPLAT:L) ; +} + +# We have some different files for UNIX, VMS, and NT. +jam.source = + command.c compile.c expand.c glob.c + hash.c hcache.c headers.c hdrmacro.c + jam.c jambase.c jamgram.c + lists.c make.c make1.c newstr.c + option.c parse.c regexp.c rules.c + scan.c search.c subst.c + timestamp.c variable.c modules.c strings.c filesys.c + builtins.c pwd.c + ; +if $(NT) +{ + jam.source += execnt.c filent.c pathunix.c ; +} +else if $(OS2) +{ + jam.source += execunix.c fileos2.c pathunix.c ; +} +else if $(VMS) +{ + jam.source += execvms.c filevms.c pathvms.c ; +} +else if $(MAC) +{ + jam.source += execmac.c filemac.c pathmac.c ; +} +else +{ + jam.source += execunix.c fileunix.c pathunix.c ; +} + +# Enable some optional features. +--defs += OPT_HEADER_CACHE_EXT ; +--defs += OPT_GRAPH_DEBUG_EXT ; + +# Bug fixes +--defs += OPT_FIX_TARGET_VARIABLES_EXT ; + +# Improvements +--defs += OPT_IMPROVED_PATIENCE_EXT ; + +if ( $(OS) = NT || $(NT) ) && ! NT in $(--defs) +{ + --defs += NT ; +} +--defs += YYSTACKSIZE=5000 ; + +# The basic symbolic targets... +NOTFILE all clean dist ; +ALWAYS clean ; + +# Utility rules and actions... +rule .clean +{ + .rm clean : $(<) ; +} +if $(NT) { actions piecemeal together existing .rm { del /F /Q $(>) } } +if $(UNIX) { actions piecemeal together existing .rm { rm -f $(>) } } + +rule .mkdir +{ + NOUPDATE $(<) ; + if $(<:P) { DEPENDS $(<) : $(<:P) ; .mkdir $(<:P) ; } + if ! $(md<$(<)>) { .md $(<) ; md<$(<)> = - ; } +} +actions .md { mkdir $(<) } + +rule .exe +{ + local exe = $(<) ; + if $(NT) { exe = $(exe:S=.exe) ; } + LOCATE on $(exe) = $(locate-target) ; + DEPENDS $(exe) : $(>) ; + DEPENDS $(exe) : $(locate-target) ; + .mkdir $(locate-target) ; + .cc $(exe) : $(>) ; + .clean $(exe) ; + return $(exe) ; +} +actions .cc { $(--cc) $(--bin)$(<:D=) $(--dir)$(<:D) $(--out)$(<) $(--def)$(--defs) $(--flags) $(--libs) $(>) } + +rule .link +{ + DEPENDS $(<) : $(>) ; + .clean $(<) ; +} +if $(NT) { actions .link { copy $(>) $(<) } } +if $(UNIX) { actions .link { ln -f $(>) $(<) } } + +rule .yyacc +{ + DEPENDS $(<) : $(>) ; + .clean $(<) ; +} +actions .yyacc { ./yyacc $(<) $(>) } + +yacc ?= [ GLOB $(PATH) : bison bison.exe ] ; +yacc ?= [ GLOB $(PATH) : yacc yacc.exe ] ; +yacc = $(yacc[1]) ; +switch $(yacc:D=:S=) +{ + case bison : yacc += -y -d --yacc ; # -t -l -v ; + case yacc : yacc += -d ; +} +rule .yacc +{ + DEPENDS $(<) : $(>) ; + .clean $(<) ; +} +if $(NT) { actions .yacc +{ $(yacc) $(>) + rename y.tab.c $(<:S=.c) + rename y.tab.h $(<:S=.h) } } +if $(UNIX) { actions .yacc +{ $(yacc) $(>) + mv -f y.tab.c $(<:S=.c) + mv -f y.tab.h $(<:S=.h) } } + +# How to build the grammar. +if $(yacc) +{ + .yyacc jamgram.y jamgramtab.h : jamgram.yy ; + .yacc jamgram.c : jamgram.y ; +} + +# How to build the compiled in jambase. +rule exe.mkjambase +{ + local exe = [ .exe mkjambase : mkjambase.c ] ; + DEPENDS $(<) : $(exe) $(>) ; + LEAVES $(<) ; + if $(NT) { chmod on $(<) = "attrib -r " ; } + if $(UNIX) { chmod on $(<) = "chmod +w " ; } + mkjambase.exe on $(<) = $(exe:R=$(locate-target)) ; + .clean $(<) ; +} +actions exe.mkjambase +{ $(chmod)$(<) + $(mkjambase.exe) $(<) $(>) } +exe.mkjambase jambase.c : Jambase ; + +# How to build Jam. +rule exe.jam +{ + $(>).exe = [ .exe $(>) : $(jam.source) ] ; + $(<).exe = $(<:S=$($(>).exe:S)) ; + LOCATE on $($(<).exe) = $(locate-target) ; + .link $($(<).exe) : $($(>).exe) ; + + DEPENDS all : $($(>).exe) $($(<).exe) ; +} +exe.jam bjam : jam ; + +# Distribution making from here on out. +dist.docs = + Porting README RELNOTES + Jam.html Jambase.html Jamfile.html + ; +dist.source = + [ GLOB . : *.c *.h ] + ; +dist.source = $(dist.source:D=) + $(dist.docs) + build.jam build.bat build.sh + Jambase Jamfile + yyacc jamgram.y jamgram.yy + debian/changelog debian/control debian/copyright debian/jam.man.sgml debian/rules + boost-jam.spec + ; +dist.bin = + bjam jam mkjambase + ; +dist.bin = + $(dist.bin:S=$(bjam.exe:S):R=$(locate-target)) + ; + +if $(NT) +{ +if [ GLOB "C:\\Program Files\\7-ZIP" : "7zn.exe" ] +{ + actions .pack { "C:\Program Files\7-ZIP\7zn.exe" a -r -tzip "$(<)" "$(>)" } + actions .zip { "C:\Program Files\7-ZIP\7zn.exe" a -r -tzip "$(<)" "$(>)" } +} +else +{ + actions .pack { zip -9r "$(<)" "$(>)" } + actions .zip { zip -9r "$(<)" "$(>)" } +} + actions .cp { cp -a "$(>)" "$(<)" } +} +if $(UNIX) +{ + actions .pack { tar zcf "$(<)" "$(>)" } + actions .zip { gzip -c9 "$(>)" > "$(<)" } + actions .cp { cp -af "$(>)" "$(<)" } +} + +# The single binary, compressed. +rule .binary +{ + local zip = ; + if $(NT) { zip = $($(<).exe:S=.zip) ; } + if $(UNIX) { zip = $($(<).exe:S=.gz) ; } + DEPENDS $(zip) : $($(<).exe) ; + DEPENDS dist : $(zip) ; + LOCATE on $(zip) = $(locate-target) ; + .zip $(zip) : $($(<).exe) ; + .clean $(zip) ; +} + +# Package some file. +rule .package ( dst-dir : src-files + ) +{ + local src-dirs = ; + for local s in $(src-files:D) { if ! $(s) in $(src-dirs) && ! $(s) = "" { src-dirs += $(s) ; } } + local dst-files = $(src-files:R=$(dst-dir)) ; + local dst-dirs = $(src-dirs:R=$(dst-dir)) ; + + local pack = ; + if $(NT) { pack = $(dst-dir).zip ; } + if $(UNIX) { pack = $(dst-dir).tgz ; } + + DEPENDS dist : $(pack) ; + DEPENDS $(pack) : $(dst-files) ; + + for local src-file in $(src-files) + { + local dst-file = $(src-file:R=$(dst-dir)) ; + DEPENDS $(dst-file) : $(src-file) $(dst-file:D) ; + .mkdir $(dst-file:D) ; + .cp $(dst-file) : $(src-file) ; + .clean $(dst-file) ; + } + + .pack $(pack) : $(dst-files) ; + .clean $(pack) ; +} + +# RPM distro file. +rpm-tool = [ GLOB $(PATH) : "rpm" ] ; +rule .rpm ( name : source ) +{ + local rpm-arch = ; + switch $(OSPLAT) + { + case X86 : rpm-arch ?= i386 ; + case PPC : rpm-arch ?= ppc ; + case AXP : rpm-arch ?= alpha ; + # no guaranty for these: + case IA64 : rpm-arch ?= ia64 ; + case ARM : rpm-arch ?= arm ; + case SPARC : rpm-arch ?= sparc ; + case * : rpm-arch ?= other ; + } + local target = $(name)-rpm ; + NOTFILE $(target) ; + DEPENDS dist : $(target) ; + DEPENDS $(target) : $(name).$(rpm-arch).rpm $(name).src.rpm ; + DEPENDS $(name).$(rpm-arch).rpm : $(source) ; + DEPENDS $(name).src.rpm : $(name).$(rpm-arch).rpm ; + docs on $(target) = $(dist.docs:J=" ") ; + arch on $(target) = $(rpm-arch) ; + .rpm-build $(target) : $(source) ; + .clean $(name).$(rpm-arch).rpm $(name).src.rpm ; +} +actions .rpm-build +{ export BOOST_JAM_DOCS="$(docs)" + rpm -ta --target $(arch) $(>) | tee rpm.out + cp `grep -e '^Wrote:' rpm.out | sed 's/^Wrote: //'` . + rm -f rpm.out } + +# The distribution targets. +.binary bjam ; +.package $(NAME)-$(VERSION) : $(dist.source) ; +.package $(NAME)-$(VERSION)-$(RELEASE)-$(platform) : $(dist.bin) ; +if $(rpm-tool) +{ + .rpm $(NAME)-$(VERSION)-$(RELEASE) : $(NAME)-$(VERSION).tgz ; +} + + +# Update any targets in the specified commandline. +local e-- = ; +for local e in $(ARGV[2-]) +{ + if ! [ MATCH "^(-).*" : $(e) ] && $(e--) != "-f" + { + # This is not an option, so it is a target name. + UPDATE $(e) ; + } + e-- = $(e) ; +} diff --git a/jam_src/build.sh b/jam_src/build.sh new file mode 100644 index 000000000..9a516df92 --- /dev/null +++ b/jam_src/build.sh @@ -0,0 +1,119 @@ +#!/bin/sh +# Copyrigt (C) 2002 Rene Rivera. +# Permission to copy, use, modify, sell and distribute this software +# is granted provided this copyright notice appears in all copies. +# This software is provided "as is" without express or implied +# warranty, and with no claim as to its suitability for any purpose. + +# Reset the toolset. +BOOST_JAM_TOOLSET= + +function echo_run () +{ + echo "$@" + "$@" + r=$? + if test $r -ne 0 ; then + exit $r + fi +} +function error_exit() +{ + echo "###" + echo "###" "$@" + echo "###" + echo "### You can specify the toolset as the argument, i.e.:" + echo "### ./build.sh gcc" + echo "###" + exit 1 +} +function test_run () +{ + q=`$* 2>/dev/null` +} +function test_uname () +{ + if test_run uname; then + test `uname` = $* + fi +} +# Try and guess the toolset to bootstrap the build with... +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 + fi + if test "$BOOST_JAM_TOOLSET" = "" ; then + error_exit "Could not find a suitable toolset." + fi +} + +# 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 $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" + ;; + + 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" + ;; + + intel-linux) + echo_run /opt/intel/compiler50/ia32/bin/iccvars.sh + 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" + ;; + + 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" + ;; + + *) + error_exit "Unknown toolset: $BOOST_JAM_TOOLSET" + ;; +esac + +echo "###" +echo "### Using '$BOOST_JAM_TOOLSET' toolset." +echo "###" + +MKJAMBASE_SOURCES="mkjambase.c" +BJAM_SOURCES="\ + command.c compile.c execnt.c execunix.c execvms.c expand.c\ + filent.c fileos2.c fileunix.c filevms.c glob.c hash.c\ + hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c\ + newstr.c option.c parse.c pathunix.c pathvms.c regexp.c\ + rules.c scan.c search.c subst.c timestamp.c variable.c modules.c\ + strings.c filesys.c builtins.c pwd.c" + +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 +fi +if [[ ! -a jambase.c ]] ; then + echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_MKJAMBASE} ${MKJAMBASE_SOURCES} + if test -e "./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 +fi