[MIParser] Set RegClassOrRegBank during instruction parsing
[llvm-complete.git] / utils / docker / scripts / build_install_llvm.sh
blob3a52e41fa655e40e148a13952e1a268835de712d
1 #!/usr/bin/env bash
2 #===- llvm/utils/docker/scripts/build_install_llvm.sh ---------------------===//
4 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 # See https://llvm.org/LICENSE.txt for license information.
6 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 #===-----------------------------------------------------------------------===//
10 set -e
12 function show_usage() {
13 cat << EOF
14 Usage: build_install_llvm.sh [options] -- [cmake-args]
16 Run cmake with the specified arguments. Used inside docker container.
17 Passes additional -DCMAKE_INSTALL_PREFIX and puts the build results into
18 the directory specified by --to option.
20 Available options:
21 -h|--help show this help message
22 -i|--install-target name of a cmake install target to build and include in
23 the resulting archive. Can be specified multiple times.
24 --to destination directory where to install the targets.
25 Required options: --to, at least one --install-target.
27 All options after '--' are passed to CMake invocation.
28 EOF
31 CMAKE_ARGS=""
32 CMAKE_INSTALL_TARGETS=""
33 CLANG_INSTALL_DIR=""
35 while [[ $# -gt 0 ]]; do
36 case "$1" in
37 -i|--install-target)
38 shift
39 CMAKE_INSTALL_TARGETS="$CMAKE_INSTALL_TARGETS $1"
40 shift
42 --to)
43 shift
44 CLANG_INSTALL_DIR="$1"
45 shift
47 --)
48 shift
49 CMAKE_ARGS="$*"
50 shift $#
52 -h|--help)
53 show_usage
54 exit 0
57 echo "Unknown option: $1"
58 exit 1
59 esac
60 done
62 if [ "$CMAKE_INSTALL_TARGETS" == "" ]; then
63 echo "No install targets. Please pass one or more --install-target."
64 exit 1
67 if [ "$CLANG_INSTALL_DIR" == "" ]; then
68 echo "No install directory. Please specify the --to argument."
69 exit 1
72 CLANG_BUILD_DIR=/tmp/clang-build
74 mkdir -p "$CLANG_INSTALL_DIR"
76 mkdir -p "$CLANG_BUILD_DIR/build"
77 pushd "$CLANG_BUILD_DIR/build"
79 # Run the build as specified in the build arguments.
80 echo "Running build"
81 cmake -GNinja \
82 -DCMAKE_INSTALL_PREFIX="$CLANG_INSTALL_DIR" \
83 $CMAKE_ARGS \
84 "$CLANG_BUILD_DIR/src/llvm"
85 ninja $CMAKE_INSTALL_TARGETS
87 popd
89 # Cleanup.
90 rm -rf "$CLANG_BUILD_DIR/build"
92 echo "Done"