From dd6448e10bd8ef241efcdc28718f0b5fb14767a8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 7 May 2024 08:20:59 +0200 Subject: Rework --system option in build.sh.in to match previous changes --- build.sh.in | 88 ++++++++++++++++++++++++------------------------------------- 1 file changed, 35 insertions(+), 53 deletions(-) (limited to 'build.sh.in') diff --git a/build.sh.in b/build.sh.in index 43c648a..f3e5aa5 100644 --- a/build.sh.in +++ b/build.sh.in @@ -124,10 +124,12 @@ while test $# -ne 0; do diag "$0 g++ -g" diag diag "Use --system to specify a comma-separated list of dependencies" - diag "to use from the system rather than building them from source, for" - diag "example:" + diag "to use from the system rather than building them from source. Currently," + diag "only libsqlite3 and libpkgconf can be specified with this option and" + diag "using either from the system will likely result in limited functionality." + diag "For example:" diag - diag "$0 --system libsqlite3,libpkg-config g++" + diag "$0 --system libsqlite3,libpkgconf g++" diag diag "The script by default installs the following standard build system" diag "modules:" @@ -383,14 +385,9 @@ done # system_list="$(echo "$system" | sed 's/,/ /g')" -# If any dependencies are specified to be used from the system, then specify -# the respective config.import.*= variables for the bootstrap stage 2 command -# and for the local or staged build configurations. If the installation is not -# local, then also specify these dependencies as system for the bpkg-build -# commands. -# -# As a special case, recognize the libpkgconf dependency as a request to force -# build2 to use that instead of libpkg-config. +# If any dependencies are specified to be used from the system, then translate +# them to the correspinding config.* variables. To keep things simple, we will +# only support system dependencies for local installations. # # Note that the build2 driver bootstrapped at stage 1 doesn't read .pc # files. Thus, for the bootstrap stage 2 command it is assumed that the @@ -400,49 +397,35 @@ system_list="$(echo "$system" | sed 's/,/ /g')" # also specify its headers location via, for example, the CPATH environment # variable: # -# $ CPATH=/usr/local/include/pkgconf ./build.sh --local --system libpkgconf g++ +# $ CPATH=/usr/include/pkgconf ./build.sh --local --system libpkgconf g++ # -bootstrap_system_imports= -system_imports= -system_packages= +bootstrap_system_config= +system_config= for d in $system_list; do - v="$(echo "$d" | sed 's/[.+-]/_/g')" # Convert to variable name. - - if test "$d" != "libpkgconf"; then - si="config.import.$v=" - else - if test -z "$local"; then - diag "error: '--system libpkgconf' can only be used for local installation" - diag " info: additionally specify --local" - exit 1 - fi - - si="config.build2.libpkgconf=true" - fi - # For now these are the only third-party libraries that are used by the - # build system. - # - if test "$d" = "libpkg-config" -o "$d" = "libpkgconf"; then - bootstrap_system_imports="$si" + if test -z "$local"; then + diag "error: '--system $d' can only be used for local installation" + diag " info: additionally specify --local" + exit 1 fi - # Suppress the 'dropping no longer used variable' warnings. + # Note: prefix system_config variables with project directories to avoid the + # 'dropping no longer used ...' warnings. # - if test -z "$system_imports"; then - system_imports="config.config.persist='config.*'@unused=drop" - fi - - system_imports="$system_imports $si" - - if test -z "$local"; then - if test -n "$system_packages"; then - system_packages="$system_packages ?sys:$d" - else - system_packages="?sys:$d" - fi - fi + case "$d" in + libsqlite3) + system_config="$system_config libbutl/config.libbutl.system_libsqlite3=true" + ;; + libpkgconf) + bootstrap_system_config="config.build2.libpkgconf=true" + system_config="$system_config build2/config.build2.libpkgconf=true" + ;; + *) + diag "error: unknown system dependency '$d'" + exit 1 + ;; + esac done # If the installation directory is unspecified, then assume it is /usr/local. @@ -614,7 +597,7 @@ run build2/b-boot --version # Bootstrap, stage 2. # -run build2/b-boot $verbose $jobs config.cxx="$cxx" config.bin.lib=static $bootstrap_system_imports build2/exe{b} +run build2/b-boot $verbose $jobs config.cxx="$cxx" config.bin.lib=static $bootstrap_system_config build2/exe{b} mv build2/b build2/b-boot run build2/b-boot --version @@ -635,7 +618,7 @@ config.install.root="$idir" \ config.install.sudo="$conf_sudo" \ $conf_exe_affixes \ $private \ -$system_imports +$system_config # Install toolchain. # @@ -696,8 +679,7 @@ config.bin.suffix="$stage_suffix" \ config.bin.rpath="$conf_rpath_stage" \ config.install.root="$idir" \ config.install.data_root=root/stage \ -config.install.sudo="$conf_sudo" \ -$system_imports +config.install.sudo="$conf_sudo" run build2/build2/b-boot $verbose $jobs install: build2/ bpkg/ @@ -735,7 +717,7 @@ 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= $packages $system_packages +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" @@ -760,7 +742,7 @@ for m in $module_list; do done if test -n "$packages"; then - run "$bpkg" $verbose $jobs $bpkg_build_ops build --for install $packages $system_packages + run "$bpkg" $verbose $jobs $bpkg_build_ops build --for install $packages run "$bpkg" $verbose $jobs install '!config.install.scope=project' --all-pattern=libbuild2-* fi -- cgit v1.1