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

72 lines, 39 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
24ARCHITECTURE="$(uname -m)"
25if false; then
26 # This version if 7.6 GB, ugh
27 LLVM_VERSION=18.1.8
28 if test "$ARCHITECTURE" = "aarch64"; then
29 CLANG_URL='https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/clang+llvm-18.1.8-aarch64-linux-gnu.tar.xz'
30 else
31 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'
32 fi
33else
34 # This version was 4.7 GB
35 LLVM_VERSION=14.0.0
36 if test "$ARCHITECTURE" = "aarch64"; then
37 CLANG_URL='https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-aarch64-linux-gnu.tar.xz'
38 else
39 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'
40 fi
41fi
42
43download-clang() {
44
45 # download into $DEPS_DIR and not _cache because Dockerfile.clang stores the
46 # compressed version
47
48 wget --no-clobber --directory-prefix _cache $CLANG_URL
49}
50
51extract-clang() {
52 ### For developers
53
54 mkdir -p $DEPS_DIR
55 pushd $DEPS_DIR
56 time tar -x --xz < ../oils/_cache/clang+llvm-$LLVM_VERSION*.tar.xz
57 popd
58}
59
60extract-clang-in-container() {
61 ### For Dockerfile.clang
62
63 pushd $DEPS_DIR
64 time tar -x --xz < clang+llvm-$LLVM_VERSION*.tar.xz
65 popd
66}
67
68test-clang() {
69 $CLANGXX --version
70}
71
72"$@"