OILS / deps / from-binary.sh View on Github | oils.pub

71 lines, 38 significant
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
12set -o nounset
13set -o pipefail
14set -o errexit
15
16REPO_ROOT=$(cd "$(dirname $0)/.."; pwd)
17
18source build/common.sh
19
20readonly DEPS_DIR=$REPO_ROOT/../oil_DEPS
21
22# TODO: Make Clang into a wedge?
23
24if false; then
25 # This version if 7.6 GB, ugh
26 LLVM_VERSION=18.1.8
27 if test "$(uname -m)" = "aarch64"; then
28 CLANG_URL='https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/clang+llvm-18.1.8-aarch64-linux-gnu.tar.xz'
29 else
30 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'
31 fi
32else
33 # This version was 4.7 GB
34 LLVM_VERSION=14.0.0
35 if test "$(uname -m)" = "aarch64"; then
36 CLANG_URL='https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-aarch64-linux-gnu.tar.xz'
37 else
38 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'
39 fi
40fi
41
42download-clang() {
43
44 # download into $DEPS_DIR and not _cache because Dockerfile.clang stores the
45 # compressed version
46
47 wget --no-clobber --directory-prefix _cache $CLANG_URL
48}
49
50extract-clang() {
51 ### For developers
52
53 mkdir -p $DEPS_DIR
54 pushd $DEPS_DIR
55 time tar -x --xz < ../oils/_cache/clang+llvm-$LLVM_VERSION*.tar.xz
56 popd
57}
58
59extract-clang-in-container() {
60 ### For Dockerfile.clang
61
62 pushd $DEPS_DIR
63 time tar -x --xz < clang+llvm-$LLVM_VERSION*.tar.xz
64 popd
65}
66
67test-clang() {
68 $CLANGXX --version
69}
70
71"$@"