From f4fee4d6c062b6ab4aa46bf2d942a4bff3481e05 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 15 Apr 2021 23:08:05 +0300 Subject: Make build scripts to create hermetic configurations --- BOOTSTRAP-UNIX.cli | 11 ++++++++++- BOOTSTRAP-WINDOWS-CLANG.cli | 13 +++++++++++-- BOOTSTRAP-WINDOWS-MINGW.cli | 13 +++++++++++-- BOOTSTRAP-WINDOWS-MSVC.cli | 13 +++++++++++-- UPGRADE.cli | 5 +++++ build-clang.bat.in | 2 ++ build-mingw.bat.in | 2 ++ build-msvc.bat.in | 2 ++ build.sh.in | 2 ++ 9 files changed, 56 insertions(+), 7 deletions(-) diff --git a/BOOTSTRAP-UNIX.cli b/BOOTSTRAP-UNIX.cli index 5ffa6b2..70e9a08 100644 --- a/BOOTSTRAP-UNIX.cli +++ b/BOOTSTRAP-UNIX.cli @@ -223,10 +223,11 @@ a local installation and skip the rest of the steps. To perform a local installation you will need to change the \c{configure} and \c{install} command lines above along these lines (see also notes on the following step about only building shared libraries, private installation -subdirectory, and toolchain executables prefix/suffix): +subdirectory, toolchain executables prefix/suffix, etc): \ $ build2/build2/b-boot configure \ + config.config.hermetic=true \ config.cxx=g++ \ config.cc.coptions=-O3 \ config.bin.lib=shared \ @@ -276,6 +277,7 @@ $ cd build2-toolchain-X.Y $ bpkg-stage create \ cc \ + config.config.hermetic=true \ config.cxx=g++ \ config.cc.coptions=-O3 \ config.bin.lib=shared \ @@ -300,6 +302,13 @@ then you can remove \c{config.install.private=build2}.| \N|To add a custom prefix/suffix to the toolchain executables names, add \c{config.bin.exe.prefix=...} and/or \c{config.bin.exe.suffix=...}.| +\N|The \c{config.config.hermetic=true} configuration variable in the above +command makes sure the embedded \c{~host} and \c{~build2} configurations +include the current environment. This is especially important for \c{~build2} +which is used to dynamically build and load ad hoc recipes and build system +modules and must therefore match the environment that was used to build the +build system itself.| + Next, we add the package repository, build, and install: \ diff --git a/BOOTSTRAP-WINDOWS-CLANG.cli b/BOOTSTRAP-WINDOWS-CLANG.cli index 35b0c57..c837d87 100644 --- a/BOOTSTRAP-WINDOWS-CLANG.cli +++ b/BOOTSTRAP-WINDOWS-CLANG.cli @@ -154,11 +154,12 @@ pass the \c{--local} option.| To perform a local installation you will need to change the \c{configure} and \c{install} command lines above along these lines (see also a note on the -following step about only building shared libraries and toolchain executables -prefix/suffix): +following step about only building shared libraries, toolchain executables +prefix/suffix, etc): \ > build2\build2\b-boot configure ^ + config.config.hermetic=true ^ config.cxx=clang++ ^ \"config.cc.coptions=-m64 -O2\" ^ config.bin.lib=shared ^ @@ -204,6 +205,7 @@ previous step and you may want/need to make similar adjustments. > bpkg-stage create ^ cc ^ + config.config.hermetic=true ^ config.cxx=clang++ ^ \"config.cc.coptions=-m64 -O2\" ^ config.bin.lib=shared ^ @@ -216,6 +218,13 @@ to build both shared and static, remove \c{config.bin.lib=shared}.| \N|To add a custom prefix/suffix to the toolchain executables names, add \c{config.bin.exe.prefix=...} and/or \c{config.bin.exe.suffix=...}.| +\N|The \c{config.config.hermetic=true} configuration variable in the above +command makes sure the embedded \c{~host} and \c{~build2} configurations +include the current environment. This is especially important for \c{~build2} +which is used to dynamically build and load ad hoc recipes and build system +modules and must therefore match the environment that was used to build the +build system itself.| + Next, we add the package repository, build, and install: \ diff --git a/BOOTSTRAP-WINDOWS-MINGW.cli b/BOOTSTRAP-WINDOWS-MINGW.cli index 825c36e..20a975b 100644 --- a/BOOTSTRAP-WINDOWS-MINGW.cli +++ b/BOOTSTRAP-WINDOWS-MINGW.cli @@ -156,11 +156,12 @@ pass the \c{--local} option.| To perform a local installation you will need to change the \c{configure} and \c{install} command lines above along these lines (see also a note on the -following step about only building shared libraries and toolchain executables -prefix/suffix): +following step about only building shared libraries, toolchain executables +prefix/suffix, etc): \ > build2\build2\b-boot configure ^ + config.config.hermetic=true ^ config.cxx=g++ ^ config.cc.coptions=-O3 ^ config.bin.lib=shared ^ @@ -206,6 +207,7 @@ previous step and you may want/need to make similar adjustments. > bpkg-stage create ^ cc ^ + config.config.hermetic=true ^ config.cxx=g++ ^ config.cc.coptions=-O3 ^ config.bin.lib=shared ^ @@ -218,6 +220,13 @@ to build both shared and static, remove \c{config.bin.lib=shared}.| \N|To add a custom prefix/suffix to the toolchain executables names, add \c{config.bin.exe.prefix=...} and/or \c{config.bin.exe.suffix=...}.| +\N|The \c{config.config.hermetic=true} configuration variable in the above +command makes sure the embedded \c{~host} and \c{~build2} configurations +include the current environment. This is especially important for \c{~build2} +which is used to dynamically build and load ad hoc recipes and build system +modules and must therefore match the environment that was used to build the +build system itself.| + Next, we add the package repository, build, and install: \ diff --git a/BOOTSTRAP-WINDOWS-MSVC.cli b/BOOTSTRAP-WINDOWS-MSVC.cli index 6ac26f0..2a066f8 100644 --- a/BOOTSTRAP-WINDOWS-MSVC.cli +++ b/BOOTSTRAP-WINDOWS-MSVC.cli @@ -128,11 +128,12 @@ pass the \c{--local} option.| To perform a local installation you will need to change the \c{configure} and \c{install} command lines above along these lines (see also a note on the -following step about only building shared libraries and toolchain executables -prefix/suffix): +following step about only building shared libraries, toolchain executables +prefix/suffix, etc): \ > build2\build2\b-boot configure ^ + config.config.hermetic=true ^ config.cxx=cl ^ config.cc.coptions=/O2 ^ config.bin.lib=shared ^ @@ -178,6 +179,7 @@ previous step and you may want/need to make similar adjustments. > bpkg-stage create ^ cc ^ + config.config.hermetic=true ^ config.cxx=cl ^ config.cc.coptions=/O2 ^ config.bin.lib=shared ^ @@ -190,6 +192,13 @@ to build both shared and static, remove \c{config.bin.lib=shared}.| \N|To add a custom prefix/suffix to the toolchain executables names, add \c{config.bin.exe.prefix=...} and/or \c{config.bin.exe.suffix=...}.| +\N|The \c{config.config.hermetic=true} configuration variable in the above +command makes sure the embedded \c{~host} and \c{~build2} configurations +include the current environment. This is especially important for \c{~build2} +which is used to dynamically build and load ad hoc recipes and build system +modules and must therefore match the environment that was used to build the +build system itself.| + Next, we add the package repository, build, and install: \ diff --git a/UPGRADE.cli b/UPGRADE.cli index b51f538..202a2a6 100644 --- a/UPGRADE.cli +++ b/UPGRADE.cli @@ -199,11 +199,13 @@ For UNIX-like operating systems (GNU/Linux, Mac OS X, FreeBSD, etc): \ $ bpkg-stage create \ cc \ +config.config.hermetic=true \ config.cxx=g++ \ config.cc.coptions=-O3 \ config.bin.lib=shared \ config.bin.rpath=/usr/local/lib \ config.install.root=/usr/local \ +config.install.private=build2 \ config.install.sudo=sudo \ @@ -213,6 +215,7 @@ Prompt\"): \ > bpkg-stage create ^ cc ^ + config.config.hermetic=true ^ config.cxx=cl ^ config.cc.coptions=/O2 ^ config.bin.lib=shared ^ @@ -225,6 +228,7 @@ For Windows with Clang (from a suitable command prompt, see \ > bpkg-stage create ^ cc ^ + config.config.hermetic=true ^ config.cxx=clang++ ^ \"config.cc.coptions=-m64 -O2\" ^ config.bin.lib=shared ^ @@ -236,6 +240,7 @@ For Windows with MinGW (from the command prompt): \ > bpkg-stage create ^ cc ^ + config.config.hermetic=true ^ config.cxx=g++ ^ config.cc.coptions=-O3 ^ config.bin.lib=shared ^ diff --git a/build-clang.bat.in b/build-clang.bat.in index 5df2af7..02fb49f 100644 --- a/build-clang.bat.in +++ b/build-clang.bat.in @@ -451,6 +451,7 @@ cd .. @if "_%local%_" == "__" goto stage build2\build2\b-boot %verbose% configure^ + config.config.hermetic=true^ config.cxx=%cxx%^ "config.cc.coptions=-m64 -O2"^ config.bin.lib=shared^ @@ -571,6 +572,7 @@ cd %cdir% %bpkg_stage% %verbose% create^ cc^ + config.config.hermetic=true^ config.cxx=%cxx%^ "config.cc.coptions=-m64 -O2"^ config.bin.lib=shared^ diff --git a/build-mingw.bat.in b/build-mingw.bat.in index af2276f..6bb4841 100644 --- a/build-mingw.bat.in +++ b/build-mingw.bat.in @@ -460,6 +460,7 @@ cd .. @if "_%local%_" == "__" goto stage build2\build2\b-boot %verbose% configure^ + config.config.hermetic=true^ config.cxx=%cxx%^ config.cc.coptions=-O2^ config.bin.lib=shared^ @@ -581,6 +582,7 @@ cd %cdir% %bpkg_stage% %verbose% create^ cc^ + config.config.hermetic=true^ config.cxx=%cxx%^ config.cc.coptions=-O2^ config.bin.lib=shared^ diff --git a/build-msvc.bat.in b/build-msvc.bat.in index 6fcad79..b920fd2 100644 --- a/build-msvc.bat.in +++ b/build-msvc.bat.in @@ -416,6 +416,7 @@ cd .. @if "_%local%_" == "__" goto stage build2\build2\b-boot %verbose% configure^ + config.config.hermetic=true^ config.cxx=%cxx%^ config.cc.coptions=/O2^ config.bin.lib=shared^ @@ -535,6 +536,7 @@ cd %cdir% %bpkg_stage% %verbose% create^ cc^ + config.config.hermetic=true^ config.cxx=%cxx%^ config.cc.coptions=/O2^ config.bin.lib=shared^ diff --git a/build.sh.in b/build.sh.in index fd8a724..8bd0d3a 100644 --- a/build.sh.in +++ b/build.sh.in @@ -514,6 +514,7 @@ run cd .. if test "$local" = true; then run build2/build2/b-boot $verbose configure \ +config.config.hermetic=true \ config.cxx="$cxx" \ config.cc.coptions="$*" \ config.bin.lib=shared \ @@ -601,6 +602,7 @@ cdir="$(pwd)" # Save full path for later. run "$bpkg_stage" $verbose create \ cc \ +config.config.hermetic=true \ config.cxx="$cxx" \ config.cc.coptions="$*" \ config.bin.lib=shared \ -- cgit v1.1