From 1ed5dfc938c9b204f4f09976443f48cee9fa94a3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 6 Jul 2020 13:51:58 +0200 Subject: Redo private installation subdirectory logic in build.sh Now it is enabled if installing into the default location or if requested explicitly with an option. --- build.sh | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/build.sh b/build.sh index 7ab3b67..eab4cbd 100755 --- a/build.sh +++ b/build.sh @@ -38,6 +38,7 @@ run () owd="$(pwd)" local= +private= idir= jobs= sudo= @@ -58,6 +59,7 @@ while test $# -ne 0; do diag " --local Don't build from packages, only from local source." diag " --install-dir Alternative installation directory." diag " --sudo Optional sudo program to use (pass false to disable)." + diag " --private Install shared libraries into private subdirectory." diag " --jobs|-j Number of jobs to perform in parallel." diag " --repo Alternative package repository location." diag " --trust Repository certificate fingerprint to trust." @@ -65,9 +67,10 @@ while test $# -ne 0; do diag " --make Bootstrap using GNU make instead of script." diag " --verbose Diagnostics verbosity level between 0 and 6." diag - diag "By default the script will install into /usr/local using sudo(1)." - diag "To use sudo for a custom installation directory you need to specify" - diag "the sudo program explicitly, for example:" + diag "By default the script will install into /usr/local with private" + diag "library subdirectories and using sudo(1). To enable private" + diag "subdirectories and/or use sudo for a custom installation location," + diag "you need to specify --private and/or --sudo explicitly, for example:" diag diag "$0 --install-dir /opt/build2 --sudo sudo g++" diag @@ -102,6 +105,10 @@ while test $# -ne 0; do local=true shift ;; + --private) + private=config.install.private=build2 + shift + ;; --install-dir) shift if test $# -eq 0; then @@ -218,12 +225,13 @@ if test -n "$make"; then fi fi -# Only use default sudo for the default installation directory and only if -# it wasn't specified by the user. -# if test -z "$idir"; then - idir="/usr/local" + idir=/usr/local + private=config.install.private=build2 + # Only use default sudo for the default installation directory and only if + # it wasn't specified by the user. + # if test -z "$sudo"; then sudo="sudo" fi @@ -257,7 +265,12 @@ case "$sys" in conf_sudo="[null]" ;; *) - conf_rpath="$idir/lib/build2" + if test -n "$private"; then + conf_rpath="$idir/lib/build2" + else + conf_rpath="$idir/lib" + fi + conf_rpath_stage="$idir/lib" if test -n "$sudo"; then @@ -320,8 +333,8 @@ config.cc.coptions="$*" \ config.bin.lib=shared \ config.bin.rpath="$conf_rpath" \ config.install.root="$idir" \ -config.install.private=build2 \ -config.install.sudo="$conf_sudo" +config.install.sudo="$conf_sudo" \ +$private run build2/build2/b-boot $verbose $jobs install: build2/ bpkg/ bdep/ @@ -374,8 +387,8 @@ config.cc.coptions="$*" \ config.bin.lib=shared \ config.bin.rpath="$conf_rpath" \ config.install.root="$idir" \ -config.install.private=build2 \ -config.install.sudo="$conf_sudo" +config.install.sudo="$conf_sudo" \ +$private run bpkg-stage $verbose add "$BUILD2_REPO" run bpkg-stage $verbose $bpkg_fetch_ops fetch -- cgit v1.1