| 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 | # TODO: Make Clang into a wedge?
|
| 23 |
|
| 24 | if false; then
|
| 25 | # This version if 7.6 GB, ugh
|
| 26 | LLVM_VERSION=18.1.8
|
| 27 | CLANG_URL='https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/clang+llvm-18.1.8-x86_64-linux-gnu-ubuntu-18.04.tar.xz'
|
| 28 | else
|
| 29 | # This version was 4.7 GB
|
| 30 | LLVM_VERSION=14.0.0
|
| 31 | CLANG_URL='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'
|
| 32 | fi
|
| 33 |
|
| 34 | download-clang() {
|
| 35 |
|
| 36 | # download into $DEPS_DIR and not _cache because Dockerfile.clang stores the
|
| 37 | # compressed version
|
| 38 |
|
| 39 | wget --no-clobber --directory _cache $CLANG_URL
|
| 40 | }
|
| 41 |
|
| 42 | extract-clang() {
|
| 43 | ### For developers
|
| 44 |
|
| 45 | # TODO: retire ../oil_DEPS dir in favor of wedge
|
| 46 | mkdir -p $DEPS_DIR
|
| 47 | pushd $DEPS_DIR
|
| 48 | time tar -x --xz < ../oil/_cache/clang+llvm-$LLVM_VERSION*.tar.xz
|
| 49 | popd
|
| 50 | }
|
| 51 |
|
| 52 | extract-clang-in-container() {
|
| 53 | ### For Dockerfile.clang
|
| 54 |
|
| 55 | pushd $DEPS_DIR
|
| 56 | time tar -x --xz < clang+llvm-$LLVM_VERSION*.tar.xz
|
| 57 | popd
|
| 58 | }
|
| 59 |
|
| 60 | test-clang() {
|
| 61 | $CLANGXX --version
|
| 62 | }
|
| 63 |
|
| 64 | "$@"
|