|
2 | 2 |
|
3 | 3 | set -ex
|
4 | 4 |
|
| 5 | +DESTDIR="$1" |
| 6 | +mkdir -p "$DESTDIR" |
| 7 | + |
5 | 8 | if [[ "$(cat /etc/system-release)" == *"Amazon Linux release 2"* ]]; then
|
6 | 9 | sudo yum -y install \
|
7 | 10 | clang \
|
@@ -37,73 +40,46 @@ if [[ "$(cat /etc/system-release)" == *"Amazon Linux release 2"* ]]; then
|
37 | 40 | sudo ln -s /usr/bin/ninja-build /usr/local/bin/ninja
|
38 | 41 | fi
|
39 | 42 | else
|
40 |
| - sudo apt update |
41 |
| - |
42 |
| - if [ $(grep RELEASE /etc/lsb-release) == "DISTRIB_RELEASE=18.04" ]; then |
43 |
| - sudo apt install -y \ |
44 |
| - git ninja-build clang-10 python python-six \ |
45 |
| - uuid-dev libicu-dev icu-devtools libbsd-dev \ |
46 |
| - libedit-dev libxml2-dev libsqlite3-dev swig \ |
47 |
| - libpython-dev libncurses5 libncurses5-dev pkg-config \ |
48 |
| - libblocksruntime-dev libcurl4-openssl-dev \ |
49 |
| - make systemtap-sdt-dev tzdata rsync wget llvm-10 zip unzip |
50 |
| - sudo ln -s -f /usr/bin/clang-10 /usr/bin/clang |
51 |
| - sudo ln -s -f /usr/bin/clang++-10 /usr/bin/clang++ |
52 |
| - elif [ $(grep RELEASE /etc/lsb-release) == "DISTRIB_RELEASE=20.04" ]; then |
53 |
| - sudo apt install -y \ |
54 |
| - git ninja-build clang python python-six \ |
55 |
| - uuid-dev libicu-dev icu-devtools libbsd-dev \ |
56 |
| - libedit-dev libxml2-dev libsqlite3-dev swig \ |
57 |
| - libpython2-dev libncurses5 libncurses5-dev pkg-config \ |
58 |
| - libblocksruntime-dev libcurl4-openssl-dev \ |
59 |
| - make systemtap-sdt-dev tzdata rsync wget llvm zip unzip |
60 |
| - elif [ $(grep RELEASE /etc/lsb-release) == "DISTRIB_RELEASE=22.04" ]; then |
61 |
| - sudo apt install -y \ |
62 |
| - git ninja-build clang python3 python-six \ |
63 |
| - uuid-dev libicu-dev icu-devtools libbsd-dev \ |
64 |
| - libedit-dev libxml2-dev libsqlite3-dev swig \ |
65 |
| - libpython2-dev libncurses5 libncurses5-dev pkg-config \ |
66 |
| - libblocksruntime-dev libcurl4-openssl-dev \ |
67 |
| - make systemtap-sdt-dev tzdata rsync wget llvm zip unzip |
68 |
| - else |
69 |
| - echo "Unknown Ubuntu version" |
70 |
| - exit 1 |
71 |
| - fi |
72 |
| - sudo apt clean |
| 43 | + echo "skip" |
73 | 44 | fi
|
74 | 45 |
|
75 | 46 | SOURCE_PATH="$( cd "$(dirname $0)/../../../.." && pwd )"
|
76 | 47 | SWIFT_PATH=$SOURCE_PATH/swift
|
77 |
| -cd $SWIFT_PATH |
78 | 48 |
|
79 |
| -./utils/update-checkout --clone --scheme wasm --skip-repository swift |
| 49 | +mkdir -p "$DESTDIR/bin" |
80 | 50 |
|
81 | 51 | # Install wasmer
|
82 | 52 | # FIXME: Wasmer doesn't support linux-aarch64, consider using a different WASI-compatible runtime.
|
83 | 53 | if [ "$(uname -m)" != "aarch64" ]; then
|
84 |
| - if [ ! -e ~/.wasmer/bin/wasmer ]; then |
| 54 | + export WASMER_DIR="${WASMER_DIR:-$HOME/.wasmer}" |
| 55 | + if [ ! -e "$WASMER_DIR" ]; then |
85 | 56 | curl https://get.wasmer.io -sSfL | sh -s "2.1.1"
|
| 57 | + ln -sf "$WASMER_DIR/bin/wasmer" "$DESTDIR/bin/wasmer" |
86 | 58 | fi
|
87 | 59 | fi
|
88 | 60 |
|
89 |
| -cd $SOURCE_PATH |
| 61 | +install_cmake() { |
| 62 | + local workdir="$(mktemp -d)" |
| 63 | + curl -L -o "$workdir/install_cmake.sh" "https://github.com/Kitware/CMake/releases/download/v3.22.1/cmake-3.22.1-linux-$(uname -m).sh" |
| 64 | + chmod +x "$workdir/install_cmake.sh" |
| 65 | + mkdir -p "$DESTDIR/cmake" |
| 66 | + "$workdir/install_cmake.sh" --skip-license --prefix="$DESTDIR/cmake" |
| 67 | + ln -sf "$DESTDIR/cmake/bin"/* "$DESTDIR/bin" |
| 68 | +} |
90 | 69 |
|
91 |
| -if [ -z $(which cmake) ]; then |
92 |
| - wget -O install_cmake.sh "https://github.com/Kitware/CMake/releases/download/v3.22.1/cmake-3.22.1-linux-$(uname -m).sh" |
93 |
| - chmod +x install_cmake.sh |
94 |
| - sudo mkdir -p /opt/cmake |
95 |
| - sudo ./install_cmake.sh --skip-license --prefix=/opt/cmake |
96 |
| - sudo ln -sf /opt/cmake/bin/* /usr/local/bin |
| 70 | +if [ ! -e "$DESTDIR/cmake/bin/cmake" ]; then |
| 71 | + install_cmake |
97 | 72 | fi
|
98 | 73 |
|
99 |
| -cmake --version |
100 |
| - |
101 | 74 | # Install sccache
|
102 | 75 |
|
103 | 76 | if [ -z $(which sccache) ]; then
|
104 |
| - sudo mkdir /opt/sccache && cd /opt/sccache |
105 |
| - wget -O - "https://github.com/mozilla/sccache/releases/download/v0.3.0/sccache-v0.3.0-$(uname -m)-unknown-linux-musl.tar.gz" | \ |
106 |
| - sudo tar xz --strip-components 1 |
107 |
| - sudo chmod +x /opt/sccache/sccache |
108 |
| - sudo ln -sf /opt/sccache/sccache /usr/local/bin |
| 77 | + mkdir "$DESTDIR/sccache" && cd "$DESTDIR/sccache" |
| 78 | + curl -L "https://github.com/mozilla/sccache/releases/download/v0.3.0/sccache-v0.3.0-$(uname -m)-unknown-linux-musl.tar.gz" | \ |
| 79 | + tar xz --strip-components 1 |
| 80 | + chmod +x "$DESTDIR/sccache/sccache" |
| 81 | + ln -sf "$DESTDIR/sccache/sccache" "$DESTDIR/bin/sccache" |
109 | 82 | fi
|
| 83 | + |
| 84 | +cd $SWIFT_PATH |
| 85 | +./utils/update-checkout --clone --scheme wasm --skip-repository swift |
0 commit comments