• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -eux
2# Copyright 2021 Google LLC
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16################################################################################
17
18
19SWIFT_PACKAGES="wget \
20          binutils \
21          git \
22          gnupg2 \
23          libc6-dev \
24          libcurl4 \
25          libedit2 \
26          libgcc-9-dev \
27          libpython2.7 \
28          libsqlite3-0 \
29          libstdc++-9-dev \
30          libxml2 \
31          libz3-dev \
32          pkg-config \
33          tzdata \
34          zlib1g-dev"
35SWIFT_SYMBOLIZER_PACKAGES="build-essential make cmake ninja-build git python3 g++-multilib binutils-dev zlib1g-dev"
36apt-get update && apt install -y $SWIFT_PACKAGES && \
37  apt install -y $SWIFT_SYMBOLIZER_PACKAGES --no-install-recommends
38
39
40wget https://swift.org/builds/swift-5.4.2-release/ubuntu2004/swift-5.4.2-RELEASE/swift-5.4.2-RELEASE-ubuntu20.04.tar.gz
41tar xzf swift-5.4.2-RELEASE-ubuntu20.04.tar.gz
42cp -r swift-5.4.2-RELEASE-ubuntu20.04/usr/* /usr/
43rm -rf swift-5.4.2-RELEASE-ubuntu20.04.tar.gz
44# TODO: Move to a seperate work dir
45git clone --depth 1 https://github.com/llvm/llvm-project.git
46cd llvm-project
47git apply ../llvmsymbol.diff --verbose
48cmake -G "Ninja" \
49    -DLIBCXX_ENABLE_SHARED=OFF \
50    -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
51    -DLIBCXXABI_ENABLE_SHARED=OFF \
52    -DCMAKE_BUILD_TYPE=Release \
53    -DLLVM_TARGETS_TO_BUILD=X86 \
54    -DCMAKE_C_COMPILER=clang \
55    -DCMAKE_CXX_COMPILER=clang++ \
56    -DLLVM_BUILD_TESTS=OFF \
57    -DLLVM_INCLUDE_TESTS=OFF llvm
58ninja -j$(nproc) llvm-symbolizer
59cp bin/llvm-symbolizer /usr/local/bin/llvm-symbolizer-swift
60
61cd $SRC
62rm -rf llvm-project llvmsymbol.diff
63
64# TODO: Cleanup packages
65apt-get remove --purge -y wget zlib1g-dev
66apt-get autoremove -y
67