diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-10-28 10:15:25 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-11-02 17:52:36 +0300 |
commit | 5caacdf286eaaa95bf11d272d83ba808d9c44b69 (patch) | |
tree | 05f9c7c14f07a58c4df4212583ed4aa5476f3372 | |
parent | e3bc899f83d6b85412dafeb390ee9f76c3791234 (diff) |
Install exact package versions and make bpkg and bdep optional in build scripts
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | build-clang.bat.in (renamed from build-clang.bat) | 99 | ||||
-rw-r--r-- | build-mingw.bat.in (renamed from build-mingw.bat) | 113 | ||||
-rw-r--r-- | build-msvc.bat.in (renamed from build-msvc.bat) | 99 | ||||
-rw-r--r--[-rwxr-xr-x] | build.sh.in (renamed from build.sh) | 143 | ||||
-rw-r--r-- | buildfile | 57 |
6 files changed, 411 insertions, 106 deletions
@@ -2,3 +2,9 @@ INSTALL UPGRADE BOOTSTRAP-* !BOOTSTRAP-*.cli + +# Building output. +# +*.d +build.sh +build-*.bat diff --git a/build-clang.bat b/build-clang.bat.in index 172c81c..1a69072 100644 --- a/build-clang.bat +++ b/build-clang.bat.in @@ -1,6 +1,6 @@ @echo off -rem file : build-clang.bat +rem file : build-clang.bat.in rem license : MIT; see accompanying LICENSE file setlocal EnableDelayedExpansion @@ -11,6 +11,8 @@ echo. echo Usage: %0 [/?] [^<options^>] [^<clang++-compiler^>] echo Options: echo --local Don't build from packages, only from local source. +echo --no-bpkg Don't install bpkg nor bdep (requires --local). +echo --no-bdep Don't install bdep. echo --install-dir ^<dir^> Alternative installation directory. echo --repo ^<loc^> Alternative package repository location. echo --trust ^<fp^> Repository certificate fingerprint to trust. @@ -43,19 +45,25 @@ set "owd=%CD%" rem Package repository URL (or path). rem if "_%BUILD2_REPO%_" == "__" ( - set "BUILD2_REPO=https://stage.build2.org/1" -rem set "BUILD2_REPO=https://pkg.cppget.org/1/queue/alpha" -rem set "BUILD2_REPO=https://pkg.cppget.org/1/alpha" + set "BUILD2_REPO=@BUILD2_REPO@" ) +rem Package versions. +rem +set "build2_ver=@BUILD2_VERSION@" +set "bpkg_ver=@BPKG_VERSION@" +set "bdep_ver=@BDEP_VERSION@" + rem The bpkg configuration directory. rem -set "cver=0.14-a.0" +set "cver=@CONFIG_VER@" set "cdir=build2-toolchain-%cver%" rem Parse options. rem set "local=" +set "bpkg=true" +set "bdep=true" set "idir=C:\build2" set "trust=" set "timeout=" @@ -73,6 +81,18 @@ if "_%~1_" == "_--local_" ( goto options ) +if "_%~1_" == "_--no-bpkg_" ( + set "bpkg=" + shift + goto options +) + +if "_%~1_" == "_--no-bdep_" ( + set "bdep=" + shift + goto options +) + if "_%~1_" == "_--install-dir_" ( if "_%~2_" == "__" ( echo error: installation directory expected after --install-dir @@ -152,6 +172,21 @@ if "_%1_" == "__" ( set "cxx=%1" ) +rem If --no-bpkg is specified, then we require --local to also be specified +rem since it won't be possible to build things from packages without bpkg. +rem Also imply --no-bdep in this case, since bdep is pretty much useless +rem without bpkg. +rem +if "_%bpkg%_" == "__" ( + if "_%local%_" == "__" ( + echo error: --no-bpkg can only be used for local installation + echo info: additionally specify --local + goto error + ) + + set "bdep=" +) + rem Convert a relative path to an absolute. rem for /F "delims=|" %%D in ("%idir%") do set "idir=%%~dpnxD" @@ -264,27 +299,45 @@ build2\build2\b-boot %verbose% configure^ config.install.root=%idir% @if errorlevel 1 goto error -build2\build2\b-boot %verbose% install: build2\ bpkg\ bdep\ +@set "projects=build2/" + +@if "_%bpkg%_" == "_true_" ( + set "projects=%projects% bpkg/" +) + +@if "_%bdep%_" == "_true_" ( + set "projects=%projects% bdep/" +) + +build2\build2\b-boot %verbose% install: %projects% @if errorlevel 1 goto error where b @if errorlevel 1 goto error -where bpkg +b --version @if errorlevel 1 goto error -where bdep -@if errorlevel 1 goto error +@if "_%bpkg%_" == "__" goto bpkg_vle -b --version +where bpkg @if errorlevel 1 goto error bpkg --version @if errorlevel 1 goto error +:bpkg_vle + +@if "_%bdep%_" == "__" goto bdep_vle + +where bdep +@if errorlevel 1 goto error + bdep --version @if errorlevel 1 goto error +:bdep_vle + @echo off echo. @@ -313,10 +366,10 @@ build2\build2\b-boot %verbose% install: build2\ bpkg\ where b-stage @if errorlevel 1 goto error -where bpkg-stage +b-stage --version @if errorlevel 1 goto error -b-stage --version +where bpkg-stage @if errorlevel 1 goto error bpkg-stage --version @@ -349,30 +402,40 @@ bpkg-stage %verbose% add %BUILD2_REPO% bpkg-stage %verbose% %timeout% %trust% fetch @if errorlevel 1 goto error -bpkg-stage %verbose% %timeout% build --for install --yes --plan= build2 bpkg bdep +@set "packages=build2/%build2_ver% bpkg/%bpkg_ver%" + +@if "_%bdep%_" == "_true_" ( + set "packages=%packages% bdep/%bdep_ver%" +) + +bpkg-stage %verbose% %timeout% build --for install --yes --plan= %packages% @if errorlevel 1 goto error -bpkg-stage %verbose% install build2 bpkg bdep +bpkg-stage %verbose% install --all @if errorlevel 1 goto error where b @if errorlevel 1 goto error -where bpkg +b --version @if errorlevel 1 goto error -where bdep +where bpkg @if errorlevel 1 goto error -b --version +bpkg --version @if errorlevel 1 goto error -bpkg --version +@if "_%bdep%_" == "__" goto bdep_vpe + +where bdep @if errorlevel 1 goto error bdep --version @if errorlevel 1 goto error +:bdep_vpe + @rem Clean up stage. @rem cd %owd% diff --git a/build-mingw.bat b/build-mingw.bat.in index 067d517..caf3a51 100644 --- a/build-mingw.bat +++ b/build-mingw.bat.in @@ -1,6 +1,6 @@ @echo off -rem file : build-mingw.bat +rem file : build-mingw.bat.in rem license : MIT; see accompanying LICENSE file setlocal EnableDelayedExpansion @@ -11,6 +11,8 @@ echo. echo Usage: %0 [/?] [^<options^>] ^<c++-compiler^> echo Options: echo --local Don't build from packages, only from local source. +echo --no-bpkg Don't install bpkg nor bdep (requires --local). +echo --no-bdep Don't install bdep. echo --install-dir ^<dir^> Alternative installation directory. echo --repo ^<loc^> Alternative package repository location. echo --trust ^<fp^> Repository certificate fingerprint to trust. @@ -42,19 +44,25 @@ set "owd=%CD%" rem Package repository URL (or path). rem if "_%BUILD2_REPO%_" == "__" ( - set "BUILD2_REPO=https://stage.build2.org/1" -rem set "BUILD2_REPO=https://pkg.cppget.org/1/queue/alpha" -rem set "BUILD2_REPO=https://pkg.cppget.org/1/alpha" + set "BUILD2_REPO=@BUILD2_REPO@" ) +rem Package versions. +rem +set "build2_ver=@BUILD2_VERSION@" +set "bpkg_ver=@BPKG_VERSION@" +set "bdep_ver=@BDEP_VERSION@" + rem The bpkg configuration directory. rem -set "cver=0.14-a.0" +set "cver=@CONFIG_VER@" set "cdir=build2-toolchain-%cver%" rem Parse options. rem set "local=" +set "bpkg=true" +set "bdep=true" set "idir=C:\build2" set "trust=" set "timeout=" @@ -72,6 +80,18 @@ if "_%~1_" == "_--local_" ( goto options ) +if "_%~1_" == "_--no-bpkg_" ( + set "bpkg=" + shift + goto options +) + +if "_%~1_" == "_--no-bdep_" ( + set "bdep=" + shift + goto options +) + if "_%~1_" == "_--install-dir_" ( if "_%~2_" == "__" ( echo error: installation directory expected after --install-dir @@ -161,6 +181,21 @@ if not "_%3_" == "__" ( set "trust=%3" ) +rem If --no-bpkg is specified, then we require --local to also be specified +rem since it won't be possible to build things from packages without bpkg. +rem Also imply --no-bdep in this case, since bdep is pretty much useless +rem without bpkg. +rem +if "_%bpkg%_" == "__" ( + if "_%local%_" == "__" ( + echo error: --no-bpkg can only be used for local installation + echo info: additionally specify --local + goto error + ) + + set "bdep=" +) + rem Convert a relative path to an absolute. rem for /F "delims=|" %%D in ("%idir%") do set "idir=%%~dpnxD" @@ -273,27 +308,47 @@ build2\build2\b-boot %verbose% configure^ config.install.root=%idir% @if errorlevel 1 goto error -build2\build2\b-boot %verbose% install: build2\ bpkg\ bdep\ -@if errorlevel 1 goto error +@set "projects=build2/" -where b -@if errorlevel 1 goto error +@if "_%bpkg%_" == "_true_" ( + set "projects=%projects% bpkg/" +) -where bpkg -@if errorlevel 1 goto error +@if "_%bdep%_" == "_true_" ( + set "projects=%projects% bdep/" +) -where bdep +build2\build2\b-boot %verbose% install: %projects% @if errorlevel 1 goto error +@rem The where command is not available on XP without the resource kit. +@rem +where b +rem @if errorlevel 1 goto error + b --version @if errorlevel 1 goto error +@if "_%bpkg%_" == "__" goto bpkg_vle + +where bpkg +rem @if errorlevel 1 goto error + bpkg --version @if errorlevel 1 goto error +:bpkg_vle + +@if "_%bdep%_" == "__" goto bdep_vle + +where bdep +rem @if errorlevel 1 goto error + bdep --version @if errorlevel 1 goto error +:bdep_vle + @echo off echo. @@ -318,17 +373,15 @@ build2\build2\b-boot %verbose% configure^ build2\build2\b-boot %verbose% install: build2\ bpkg\ @if errorlevel 1 goto error -@rem The where command is not available on XP without the resource kit. -@rem where b-stage @rem @if errorlevel 1 goto error -where bpkg-stage -@rem @if errorlevel 1 goto error - b-stage --version @if errorlevel 1 goto error +where bpkg-stage +@rem @if errorlevel 1 goto error + bpkg-stage --version @if errorlevel 1 goto error @@ -359,30 +412,40 @@ bpkg-stage %verbose% add %BUILD2_REPO% bpkg-stage %verbose% %timeout% %trust% fetch @if errorlevel 1 goto error -bpkg-stage %verbose% %timeout% build --for install --yes --plan= build2 bpkg bdep +@set "packages=build2/%build2_ver% bpkg/%bpkg_ver%" + +@if "_%bdep%_" == "_true_" ( + set "packages=%packages% bdep/%bdep_ver%" +) + +bpkg-stage %verbose% %timeout% build --for install --yes --plan= %packages% @if errorlevel 1 goto error -bpkg-stage %verbose% install build2 bpkg bdep +bpkg-stage %verbose% install --all @if errorlevel 1 goto error where b @rem @if errorlevel 1 goto error -where bpkg -@rem @if errorlevel 1 goto error - -where bdep -@rem @if errorlevel 1 goto error - b --version @if errorlevel 1 goto error +where bpkg +@rem @if errorlevel 1 goto error + bpkg --version @if errorlevel 1 goto error +@if "_%bdep%_" == "__" goto bdep_vpe + +where bdep +@rem @if errorlevel 1 goto error + bdep --version @if errorlevel 1 goto error +:bdep_vpe + @rem Clean up stage. @rem cd %owd% diff --git a/build-msvc.bat b/build-msvc.bat.in index 1060e25..f94e2c2 100644 --- a/build-msvc.bat +++ b/build-msvc.bat.in @@ -1,6 +1,6 @@ @echo off -rem file : build-msvc.bat +rem file : build-msvc.bat.in rem license : MIT; see accompanying LICENSE file setlocal EnableDelayedExpansion @@ -12,6 +12,8 @@ rem echo Usage: %0 [/?] [^<options^>] [^<cl-compiler^>] echo Usage: %0 [/?] [^<options^>] echo Options: echo --local Don't build from packages, only from local source. +echo --no-bpkg Don't install bpkg nor bdep (requires --local). +echo --no-bdep Don't install bdep. echo --install-dir ^<dir^> Alternative installation directory. echo --repo ^<loc^> Alternative package repository location. echo --trust ^<fp^> Repository certificate fingerprint to trust. @@ -36,19 +38,25 @@ set "owd=%CD%" rem Package repository URL (or path). rem if "_%BUILD2_REPO%_" == "__" ( - set "BUILD2_REPO=https://stage.build2.org/1" -rem set "BUILD2_REPO=https://pkg.cppget.org/1/queue/alpha" -rem set "BUILD2_REPO=https://pkg.cppget.org/1/alpha" + set "BUILD2_REPO=@BUILD2_REPO@" ) +rem Package versions. +rem +set "build2_ver=@BUILD2_VERSION@" +set "bpkg_ver=@BPKG_VERSION@" +set "bdep_ver=@BDEP_VERSION@" + rem The bpkg configuration directory. rem -set "cver=0.14-a.0" +set "cver=@CONFIG_VER@" set "cdir=build2-toolchain-%cver%" rem Parse options. rem set "local=" +set "bpkg=true" +set "bdep=true" set "idir=C:\build2" set "trust=" set "timeout=" @@ -65,6 +73,18 @@ if "_%~1_" == "_--local_" ( goto options ) +if "_%~1_" == "_--no-bpkg_" ( + set "bpkg=" + shift + goto options +) + +if "_%~1_" == "_--no-bdep_" ( + set "bdep=" + shift + goto options +) + if "_%~1_" == "_--install-dir_" ( if "_%~2_" == "__" ( echo error: installation directory expected after --install-dir @@ -141,6 +161,21 @@ rem ) else ( rem set "cxx=%1" rem ) +rem If --no-bpkg is specified, then we require --local to also be specified +rem since it won't be possible to build things from packages without bpkg. +rem Also imply --no-bdep in this case, since bdep is pretty much useless +rem without bpkg. +rem +if "_%bpkg%_" == "__" ( + if "_%local%_" == "__" ( + echo error: --no-bpkg can only be used for local installation + echo info: additionally specify --local + goto error + ) + + set "bdep=" +) + rem Convert a relative path to an absolute. rem for /F "delims=|" %%D in ("%idir%") do set "idir=%%~dpnxD" @@ -239,27 +274,45 @@ build2\build2\b-boot %verbose% configure^ config.install.root=%idir% @if errorlevel 1 goto error -build2\build2\b-boot %verbose% install: build2\ bpkg\ bdep\ +@set "projects=build2/" + +@if "_%bpkg%_" == "_true_" ( + set "projects=%projects% bpkg/" +) + +@if "_%bdep%_" == "_true_" ( + set "projects=%projects% bdep/" +) + +build2\build2\b-boot %verbose% install: %projects% @if errorlevel 1 goto error where b @if errorlevel 1 goto error -where bpkg +b --version @if errorlevel 1 goto error -where bdep -@if errorlevel 1 goto error +@if "_%bpkg%_" == "__" goto bpkg_vle -b --version +where bpkg @if errorlevel 1 goto error bpkg --version @if errorlevel 1 goto error +:bpkg_vle + +@if "_%bdep%_" == "__" goto bdep_vle + +where bdep +@if errorlevel 1 goto error + bdep --version @if errorlevel 1 goto error +:bdep_vle + @echo off echo. @@ -287,10 +340,10 @@ build2\build2\b-boot %verbose% install: build2\ bpkg\ where b-stage @if errorlevel 1 goto error -where bpkg-stage +b-stage --version @if errorlevel 1 goto error -b-stage --version +where bpkg-stage @if errorlevel 1 goto error bpkg-stage --version @@ -323,30 +376,40 @@ bpkg-stage %verbose% add %BUILD2_REPO% bpkg-stage %verbose% %timeout% %trust% fetch @if errorlevel 1 goto error -bpkg-stage %verbose% %timeout% build --for install --yes --plan= build2 bpkg bdep +@set "packages=build2/%build2_ver% bpkg/%bpkg_ver%" + +@if "_%bdep%_" == "_true_" ( + set "packages=%packages% bdep/%bdep_ver%" +) + +bpkg-stage %verbose% %timeout% build --for install --yes --plan= %packages% @if errorlevel 1 goto error -bpkg-stage %verbose% install build2 bpkg bdep +bpkg-stage %verbose% install --all @if errorlevel 1 goto error where b @if errorlevel 1 goto error -where bpkg +b --version @if errorlevel 1 goto error -where bdep +where bpkg @if errorlevel 1 goto error -b --version +bpkg --version @if errorlevel 1 goto error -bpkg --version +@if "_%bdep%_" == "__" goto bdep_vpe + +where bdep @if errorlevel 1 goto error bdep --version @if errorlevel 1 goto error +:bdep_vpe + @rem Clean up stage. @rem cd %owd% diff --git a/build.sh b/build.sh.in index 58d944a..d72b59b 100755..100644 --- a/build.sh +++ b/build.sh.in @@ -1,6 +1,6 @@ #!/bin/sh -# file : build.sh +# file : build.sh.in # license : MIT; see accompanying LICENSE file usage="Usage: $0 [-h|--help] [<options>] <c++-compiler> [<compile-options>]" @@ -8,14 +8,18 @@ usage="Usage: $0 [-h|--help] [<options>] <c++-compiler> [<compile-options>]" # Package repository URL (or path). # if test -z "$BUILD2_REPO"; then - BUILD2_REPO="https://stage.build2.org/1" -# BUILD2_REPO="https://pkg.cppget.org/1/queue/alpha" -# BUILD2_REPO="https://pkg.cppget.org/1/alpha" + BUILD2_REPO="@BUILD2_REPO@" fi +# Package versions. +# +build2_ver="@BUILD2_VERSION@" +bpkg_ver="@BPKG_VERSION@" +bdep_ver="@BDEP_VERSION@" + # The bpkg configuration directory. # -cver="0.14-a.0" +cver="@CONFIG_VER@" cdir="build2-toolchain-$cver" diag () @@ -38,6 +42,8 @@ run () owd="$(pwd)" local= +bpkg=true +bdep=true private= idir= jobs= @@ -57,6 +63,8 @@ while test $# -ne 0; do diag "$usage" diag "Options:" diag " --local Don't build from packages, only from local source." + diag " --no-bpkg Don't install bpkg nor bdep (requires --local)." + diag " --no-bdep Don't install bdep." diag " --install-dir <dir> Alternative installation directory." diag " --sudo <prog> Optional sudo program to use (pass false to disable)." diag " --private Install shared libraries into private subdirectory." @@ -105,6 +113,14 @@ while test $# -ne 0; do local=true shift ;; + --no-bpkg) + bpkg= + shift + ;; + --no-bdep) + bdep= + shift + ;; --private) private=config.install.private=build2 shift @@ -112,9 +128,9 @@ while test $# -ne 0; do --install-dir) shift if test $# -eq 0; then - diag "error: installation directory expected after --install-dir" - diag "$usage" - exit 1 + diag "error: installation directory expected after --install-dir" + diag "$usage" + exit 1 fi idir="$1" shift @@ -122,9 +138,9 @@ while test $# -ne 0; do -j|--jobs) shift if test $# -eq 0; then - diag "error: number of jobs expected after --jobs|-j" - diag "$usage" - exit 1 + diag "error: number of jobs expected after --jobs|-j" + diag "$usage" + exit 1 fi jobs="-j $1" shift @@ -132,9 +148,9 @@ while test $# -ne 0; do --sudo) shift if test $# -eq 0; then - diag "error: sudo program expected after --sudo" - diag "$usage" - exit 1 + diag "error: sudo program expected after --sudo" + diag "$usage" + exit 1 fi sudo="$1" shift @@ -142,9 +158,9 @@ while test $# -ne 0; do --repo) shift if test $# -eq 0; then - diag "error: repository location expected after --repo" - diag "$usage" - exit 1 + diag "error: repository location expected after --repo" + diag "$usage" + exit 1 fi BUILD2_REPO="$1" shift @@ -152,9 +168,9 @@ while test $# -ne 0; do --trust) shift if test $# -eq 0; then - diag "error: certificate fingerprint expected after --trust" - diag "$usage" - exit 1 + diag "error: certificate fingerprint expected after --trust" + diag "$usage" + exit 1 fi trust="$1" shift @@ -162,9 +178,9 @@ while test $# -ne 0; do --timeout) shift if test $# -eq 0; then - diag "error: value in seconds expected after --timeout" - diag "$usage" - exit 1 + diag "error: value in seconds expected after --timeout" + diag "$usage" + exit 1 fi timeout="$1" shift @@ -172,23 +188,23 @@ while test $# -ne 0; do --make) shift if test $# -eq 0; then - diag "error: argument expected after --make" - diag "$usage" - exit 1 + diag "error: argument expected after --make" + diag "$usage" + exit 1 fi if test -z "$make"; then make="$1" else - make_options="$make_options $1" + make_options="$make_options $1" fi shift ;; --verbose) shift if test $# -eq 0; then - diag "error: diagnostics level between 0 and 6 expected after --verbose" - diag "$usage" - exit 1 + diag "error: diagnostics level between 0 and 6 expected after --verbose" + diag "$usage" + exit 1 fi verbose="$1" shift @@ -225,6 +241,21 @@ if test -n "$make"; then fi fi +# If --no-bpkg is specified, then we require --local to also be specified +# since it won't be possible to build things from packages without bpkg. Also +# imply --no-bdep in this case, since bdep is pretty much useless without +# bpkg. +# +if test -z "$bpkg"; then + if test -z "$local"; then + diag "error: --no-bpkg can only be used for local installation" + diag " info: additionally specify --local" + exit 1 + fi + + bdep= +fi + # If the installation directory is unspecified, then assume it is /usr/local. # Otherwise, if it is a relative path, then convert it to an absolute path, # unless the realpath program is not present on the system or doesn't @@ -368,15 +399,30 @@ config.install.root="$idir" \ config.install.sudo="$conf_sudo" \ $private - run build2/build2/b-boot $verbose $jobs install: build2/ bpkg/ bdep/ + projects="build2/" - run command -v b - run command -v bpkg - run command -v bdep + if test "$bpkg" = true; then + projects="$projects bpkg/" + fi + if test "$bdep" = true; then + projects="$projects bdep/" + fi + + run build2/build2/b-boot $verbose $jobs install: $projects + + run command -v b run b --version - run bpkg --version - run bdep --version + + if test "$bpkg" = true; then + run command -v bpkg + run bpkg --version + fi + + if test "$bdep" = true; then + run command -v bdep + run bdep --version + fi diag diag "Toolchain installation: $idir/bin" @@ -400,9 +446,9 @@ config.install.sudo="$conf_sudo" run build2/build2/b-boot $verbose $jobs install: build2/ bpkg/ run command -v b-stage -run command -v bpkg-stage - run b-stage --version + +run command -v bpkg-stage run bpkg-stage --version # Build the entire toolchain from packages. @@ -422,18 +468,27 @@ config.install.root="$idir" \ config.install.sudo="$conf_sudo" \ $private +packages="build2/$build2_ver bpkg/$bpkg_ver" + +if test "$bdep" = true; then + packages="$packages bdep/$bdep_ver" +fi + run bpkg-stage $verbose add "$BUILD2_REPO" run bpkg-stage $verbose $bpkg_fetch_ops fetch -run bpkg-stage $verbose $jobs $bpkg_build_ops build --for install --yes --plan= build2 bpkg bdep -run bpkg-stage $verbose $jobs install build2 bpkg bdep +run bpkg-stage $verbose $jobs $bpkg_build_ops build --for install --yes --plan= $packages +run bpkg-stage $verbose $jobs install --all run command -v b -run command -v bpkg -run command -v bdep - run b --version + +run command -v bpkg run bpkg --version -run bdep --version + +if test "$bdep" = true; then + run command -v bdep + run bdep --version +fi # Clean up stage. # @@ -1,6 +1,12 @@ # file : buildfile # license : MIT; see accompanying LICENSE file +# Package repository URL (or path). +# +build2_repo="https://stage.build2.org/1" +# build2_repo="https://pkg.cppget.org/1/queue/alpha" +# build2_repo="https://pkg.cppget.org/1/alpha" + # Note that the project directories order is important (prerequisites go # first). # @@ -21,9 +27,58 @@ BOOTSTRAP-WINDOWS-MINGW doc{$i README} \ legal{LICENSE AUTHORS} \ cli{$i} \ - file{build.sh build-*} \ manifest +# Obtain the build2, bpkg, bdep, and toolchain versions. +# +bp = $recall($build.path) +pt = '^version: (.+)$' + +ver = $process.run_regex($bp 'info:' $src_root/, "$pt", '\1') +build2_ver = $process.run_regex($bp 'info:' $src_root/build2/, "$pt", '\1') +bpkg_ver = $process.run_regex($bp 'info:' $src_root/bpkg/, "$pt", '\1') +bdep_ver = $process.run_regex($bp 'info:' $src_root/bdep/, "$pt", '\1') + +# Generate install scripts from templates and include them into the +# distribution. +# +# @@ Redo as ad hoc rule. +# +for s: exe{build.sh} file{build-msvc.bat build-clang.bat build-mingw.bat} +{ + ./: $s: file{$name($s).$extension($s).in} + { + dist = true + } + {{ + diag sed $< + + t = $path($>) + p = $path($<) + + # Note: the same code as in the etc/version script. + # + sed -e 's/([^.]+)\..*/\1/' <<<"$ver" | set mj + sed -e 's/[^.]+\.([^.]+)\..*/\1/' <<<"$ver" | set mn + sed -n -e 's/[^.]+\.[^.]+\.[^.-]+-([ab]).*/\1/p' <<<"$ver" | set ab + sed -n -e 's/[^.]+\.[^.]+\.[^.-]+-[ab]\.([^.+]+).*/\1/p' <<<"$ver" | set pr + + # Version for configuration directory. + # + cver = "$mj.$mn" + + if ("$ab" != '') + cver = "$cver-$ab.$pr" + end + + sed -e 's%@BUILD2_REPO@%'$build2_repo'%' $p >$t + sed -e 's/@CONFIG_VER@/'$cver'/' -i $t + sed -e 's/@BUILD2_VERSION@/'$build2_ver'/' -i $t + sed -e 's/@BPKG_VERSION@/'$bpkg_ver'/' -i $t + sed -e 's/@BDEP_VERSION@/'$bdep_ver'/' -i $t + }} +} + # Don't install the BOOTSTRAP/INSTALL files. But UPGRADE could be useful. # doc{INSTALL}@./: install = false |