diff options
author | Geir Storli <geirst@oath.com> | 2018-09-14 14:53:10 +0000 |
---|---|---|
committer | Geir Storli <geirst@oath.com> | 2018-09-14 14:55:44 +0000 |
commit | 67ecb882ec22420dab988f7a58e55aece081dbd3 (patch) | |
tree | ffb83ac12752f2e694cedaafe4a25eed4a7c588f /bootstrap-cpp.sh | |
parent | 3f98f9c03a2f15df9a80a09959b15a5bd03436db (diff) |
Add option to setup unprivileged compilation of Vespa.
Diffstat (limited to 'bootstrap-cpp.sh')
-rwxr-xr-x | bootstrap-cpp.sh | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/bootstrap-cpp.sh b/bootstrap-cpp.sh index e6b4c816065..bc4c6466596 100755 --- a/bootstrap-cpp.sh +++ b/bootstrap-cpp.sh @@ -2,16 +2,31 @@ # Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. usage() { - echo "Usage: $0 <source-dir> <build-dir>" >&2 + echo "Usage: $0 [-u] <source-dir> <build-dir>" >&2 } +UNPRIVILEGED="" +while getopts "uh" opt; do + case "${opt}" in + u) + UNPRIVILEGED="-u" + ;; + h) + usage + exit 0 + ;; + *) + usage + exit 1 + ;; + esac +done +shift $((OPTIND-1)) + # Parse arguments if [ $# -eq 2 ]; then SOURCE_DIR="$1" BUILD_DIR="$2" -elif [[ $# -eq 1 && ( "$1" = "-h" || "$1" = "--help" )]]; then - usage - exit 0 else echo "Wrong number of arguments: expected 2, was $#" >&2 usage @@ -37,4 +52,4 @@ source /opt/rh/devtoolset-7/enable || true cd "${SOURCE_DIR}" bash ./bootstrap.sh full cd "${BUILD_DIR}" -bash ${SOURCE_DIR}/bootstrap-cmake.sh "${SOURCE_DIR}" +bash ${SOURCE_DIR}/bootstrap-cmake.sh ${UNPRIVILEGED} "${SOURCE_DIR}" |