|
| 1 | +#!/bin/bash |
| 2 | +##===----------------------------------------------------------------------===## |
| 3 | +## |
| 4 | +## This source file is part of the Swift open source project |
| 5 | +## |
| 6 | +## Copyright (c) 2025 Apple Inc. and the Swift project authors |
| 7 | +## Licensed under Apache License v2.0 with Runtime Library Exception |
| 8 | +## |
| 9 | +## See http://swift.org/LICENSE.txt for license information |
| 10 | +## See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| 11 | +## |
| 12 | +##===----------------------------------------------------------------------===## |
| 13 | + |
| 14 | +set -e |
| 15 | + |
| 16 | +if [[ $(uname) == Darwin ]] ; then |
| 17 | + if [[ "$INSTALL_CMAKE" == "1" ]] ; then |
| 18 | + mkdir -p "$RUNNER_TOOL_CACHE" |
| 19 | + if ! command -v cmake >/dev/null 2>&1 ; then |
| 20 | + curl -fsSLO https://github.com/Kitware/CMake/releases/download/v4.1.2/cmake-4.1.2-macos-universal.tar.gz |
| 21 | + echo '3be85f5b999e327b1ac7d804cbc9acd767059e9f603c42ec2765f6ab68fbd367 cmake-4.1.2-macos-universal.tar.gz' > cmake-4.1.2-macos-universal.tar.gz.sha256 |
| 22 | + sha256sum -c cmake-4.1.2-macos-universal.tar.gz.sha256 |
| 23 | + tar -xf cmake-4.1.2-macos-universal.tar.gz |
| 24 | + ln -s "$PWD/cmake-4.1.2-macos-universal/CMake.app/Contents/bin/cmake" "$RUNNER_TOOL_CACHE/cmake" |
| 25 | + fi |
| 26 | + if ! command -v ninja >/dev/null 2>&1 ; then |
| 27 | + curl -fsSLO https://github.com/ninja-build/ninja/releases/download/v1.13.1/ninja-mac.zip |
| 28 | + echo 'da7797794153629aca5570ef7c813342d0be214ba84632af886856e8f0063dd9 ninja-mac.zip' > ninja-mac.zip.sha256 |
| 29 | + sha256sum -c ninja-mac.zip.sha256 |
| 30 | + unzip ninja-mac.zip |
| 31 | + rm -f ninja-mac.zip |
| 32 | + mv ninja "$RUNNER_TOOL_CACHE/ninja" |
| 33 | + fi |
| 34 | + fi |
| 35 | +elif command -v apt-get >/dev/null 2>&1 ; then # bookworm, noble, jammy |
| 36 | + export DEBIAN_FRONTEND=noninteractive |
| 37 | + |
| 38 | + apt-get update -y |
| 39 | + |
| 40 | + # Build dependencies |
| 41 | + apt-get install -y libsqlite3-dev libncurses-dev |
| 42 | + |
| 43 | + # Debug symbols |
| 44 | + apt-get install -y libc6-dbg |
| 45 | + |
| 46 | + if [[ "$INSTALL_CMAKE" == "1" ]] ; then |
| 47 | + apt-get install -y cmake ninja-build |
| 48 | + fi |
| 49 | + |
| 50 | + # Android NDK |
| 51 | + dpkg_architecture="$(dpkg --print-architecture)" |
| 52 | + if [[ "$SKIP_ANDROID" != "1" ]] && [[ "$dpkg_architecture" == amd64 ]] ; then |
| 53 | + eval "$(cat /etc/os-release)" |
| 54 | + case "$VERSION_CODENAME" in |
| 55 | + bookworm|jammy) |
| 56 | + : # Not available |
| 57 | + ;; |
| 58 | + noble) |
| 59 | + apt-get install -y google-android-ndk-r26c-installer |
| 60 | + ;; |
| 61 | + *) |
| 62 | + echo "Unable to fetch Android NDK for unknown Linux distribution: $VERSION_CODENAME" >&2 |
| 63 | + exit 1 |
| 64 | + esac |
| 65 | + else |
| 66 | + echo "Skipping Android NDK installation on $dpkg_architecture" >&2 |
| 67 | + fi |
| 68 | +elif command -v dnf >/dev/null 2>&1 ; then # rhel-ubi9 |
| 69 | + dnf update -y |
| 70 | + |
| 71 | + # Build dependencies |
| 72 | + dnf install -y sqlite-devel ncurses-devel |
| 73 | + |
| 74 | + # Debug symbols |
| 75 | + dnf debuginfo-install -y glibc |
| 76 | +elif command -v yum >/dev/null 2>&1 ; then # amazonlinux2 |
| 77 | + yum update -y |
| 78 | + |
| 79 | + # Build dependencies |
| 80 | + yum install -y sqlite-devel ncurses-devel |
| 81 | + |
| 82 | + # Debug symbols |
| 83 | + yum install -y yum-utils |
| 84 | + debuginfo-install -y glibc |
| 85 | +fi |
0 commit comments