| 1 | #!/usr/bin/env bash
 | 
| 2 | #
 | 
| 3 | # For things we don't want to compile.
 | 
| 4 | #
 | 
| 5 | # Usage:
 | 
| 6 | #   deps/from-binary.sh <function name>
 | 
| 7 | #
 | 
| 8 | # Example:
 | 
| 9 | #   deps/from-binary.sh download-clang
 | 
| 10 | #   deps/from-binary.sh extract-clang
 | 
| 11 | 
 | 
| 12 | set -o nounset
 | 
| 13 | set -o pipefail
 | 
| 14 | set -o errexit
 | 
| 15 | 
 | 
| 16 | REPO_ROOT=$(cd "$(dirname $0)/.."; pwd)
 | 
| 17 | 
 | 
| 18 | source build/common.sh
 | 
| 19 | 
 | 
| 20 | readonly DEPS_DIR=$REPO_ROOT/../oil_DEPS
 | 
| 21 | 
 | 
| 22 | download-clang() {
 | 
| 23 | 
 | 
| 24 |   # download into $DEPS_DIR and not _cache because Dockerfile.clang stores the
 | 
| 25 |   # compressed version
 | 
| 26 | 
 | 
| 27 |   wget --no-clobber --directory _cache \
 | 
| 28 |     https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
 | 
| 29 | }
 | 
| 30 | 
 | 
| 31 | extract-clang() {
 | 
| 32 |   ### For developers
 | 
| 33 | 
 | 
| 34 |   # TODO: retire ../oil_DEPS dir in favor of wedge
 | 
| 35 |   mkdir -p $DEPS_DIR
 | 
| 36 |   pushd $DEPS_DIR
 | 
| 37 |   time tar -x --xz < ../oil/_cache/clang+llvm-14.0.0*.tar.xz
 | 
| 38 |   popd
 | 
| 39 | }
 | 
| 40 | 
 | 
| 41 | extract-clang-in-container() {
 | 
| 42 |   ### For Dockerfile.clang
 | 
| 43 | 
 | 
| 44 |   pushd $DEPS_DIR
 | 
| 45 |   time tar -x --xz < clang+llvm-14.0.0*.tar.xz
 | 
| 46 |   popd
 | 
| 47 | }
 | 
| 48 | 
 | 
| 49 | test-clang() {
 | 
| 50 |   $CLANGXX --version
 | 
| 51 | }
 | 
| 52 | 
 | 
| 53 | "$@"
 |