mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05:00
Devcontainer: Split ladybird feature into install scripts per distro
We'll add more distros in a future commit.
This commit is contained in:
parent
2a16c58114
commit
6e2785ad73
Notes:
github-actions[bot]
2024-12-31 20:43:49 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/6e2785ad73e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3086
3 changed files with 65 additions and 46 deletions
|
@ -4,6 +4,17 @@
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"description": "Enable development of Ladybird libraries and applications",
|
"description": "Enable development of Ladybird libraries and applications",
|
||||||
"options": {
|
"options": {
|
||||||
|
"distro": {
|
||||||
|
"type": "string",
|
||||||
|
"proposals": [
|
||||||
|
"ubuntu",
|
||||||
|
"fedora",
|
||||||
|
"arch",
|
||||||
|
"alpine"
|
||||||
|
],
|
||||||
|
"default": "ubuntu",
|
||||||
|
"description": "Select the base distribution for the container"
|
||||||
|
},
|
||||||
"llvm_version": {
|
"llvm_version": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"proposals": [
|
"proposals": [
|
||||||
|
|
48
.devcontainer/features/ladybird/install-ubuntu.sh
Normal file
48
.devcontainer/features/ladybird/install-ubuntu.sh
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
### Check distro
|
||||||
|
if [ ! -f /etc/lsb-release ]; then
|
||||||
|
echo "SCRIPT ERROR: Not an Ubuntu container"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
. /etc/lsb-release
|
||||||
|
|
||||||
|
### Declare helper functions
|
||||||
|
|
||||||
|
install_llvm_key() {
|
||||||
|
wget -O /usr/share/keyrings/llvm-snapshot.gpg.key https://apt.llvm.org/llvm-snapshot.gpg.key
|
||||||
|
echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg.key] http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME} main" | tee -a /etc/apt/sources.list.d/llvm.list
|
||||||
|
if [ ! "${LLVM_VERSION}" = "trunk" ]; then
|
||||||
|
echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg.key] http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-${LLVM_VERSION} main" | tee -a /etc/apt/sources.list.d/llvm.list
|
||||||
|
fi
|
||||||
|
apt update -y
|
||||||
|
}
|
||||||
|
|
||||||
|
### Install packages
|
||||||
|
|
||||||
|
apt update -y
|
||||||
|
apt install -y lsb-release git python3 autoconf autoconf-archive automake build-essential cmake libgl1-mesa-dev nasm ninja-build pkg-config qt6-base-dev qt6-tools-dev-tools qt6-multimedia-dev qt6-wayland ccache fonts-liberation2 zip unzip curl tar
|
||||||
|
### Ensure new enough host compiler is available
|
||||||
|
|
||||||
|
VERSION="0.0.0"
|
||||||
|
if command -v clang >/dev/null 2>&1; then
|
||||||
|
VERSION="$(clang -dumpversion)"
|
||||||
|
fi
|
||||||
|
MAJOR_VERSION="${VERSION%%.*}"
|
||||||
|
|
||||||
|
if [ "${LLVM_VERSION}" = "trunk" ]; then
|
||||||
|
install_llvm_key
|
||||||
|
|
||||||
|
apt install -y llvm clang clangd clang-tools lld lldb clang-tidy clang-format
|
||||||
|
elif [ "${MAJOR_VERSION}" -lt "${LLVM_VERSION}" ]; then
|
||||||
|
FAILED_INSTALL=0
|
||||||
|
apt install -y "llvm-${LLVM_VERSION}" "clang-${LLVM_VERSION}" "clangd-${LLVM_VERSION}" "clang-tools-${LLVM_VERSION}" "lld-${LLVM_VERSION}" "lldb-${LLVM_VERSION}" "clang-tidy-${LLVM_VERSION}" "clang-format-${LLVM_VERSION}" || FAILED_INSTALL=1
|
||||||
|
|
||||||
|
if [ "${FAILED_INSTALL}" -ne 0 ]; then
|
||||||
|
install_llvm_key
|
||||||
|
apt install -y "llvm-${LLVM_VERSION}" "clang-${LLVM_VERSION}" "clangd-${LLVM_VERSION}" "clang-tools-${LLVM_VERSION}" "lld-${LLVM_VERSION}" "lldb-${LLVM_VERSION}" "clang-tidy-${LLVM_VERSION}" "clang-format-${LLVM_VERSION}"
|
||||||
|
fi
|
||||||
|
fi
|
|
@ -1,52 +1,12 @@
|
||||||
#!/bin/sh
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Feature options
|
# Feature options
|
||||||
|
export LLVM_VERSION=${LLVM_VERSION:-19}
|
||||||
|
DISTRO=${DISTRO:-ubuntu}
|
||||||
|
|
||||||
LLVM_VERSION=${LLVM_VERSION:-19}
|
# call distro-specific script that lives in this directory
|
||||||
### Check distro
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
if [ ! -f /etc/lsb-release ]; then
|
|
||||||
echo "Not an Ubuntu container, add logic for your distro to the serenity feature or use Ubuntu"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
. /etc/lsb-release
|
. "${DIR}/install-${DISTRO}.sh"
|
||||||
|
|
||||||
### Declare helper functions
|
|
||||||
|
|
||||||
install_llvm_key() {
|
|
||||||
wget -O /usr/share/keyrings/llvm-snapshot.gpg.key https://apt.llvm.org/llvm-snapshot.gpg.key
|
|
||||||
echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg.key] http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME} main" | tee -a /etc/apt/sources.list.d/llvm.list
|
|
||||||
if [ ! "${LLVM_VERSION}" = "trunk" ]; then
|
|
||||||
echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg.key] http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-${LLVM_VERSION} main" | tee -a /etc/apt/sources.list.d/llvm.list
|
|
||||||
fi
|
|
||||||
apt update -y
|
|
||||||
}
|
|
||||||
|
|
||||||
### Install packages
|
|
||||||
|
|
||||||
apt update -y
|
|
||||||
apt install -y lsb-release git python3 autoconf autoconf-archive automake build-essential cmake libgl1-mesa-dev nasm ninja-build pkg-config qt6-base-dev qt6-tools-dev-tools qt6-multimedia-dev qt6-wayland ccache fonts-liberation2 zip unzip curl tar
|
|
||||||
### Ensure new enough host compiler is available
|
|
||||||
|
|
||||||
VERSION="0.0.0"
|
|
||||||
if command -v clang >/dev/null 2>&1; then
|
|
||||||
VERSION="$(clang -dumpversion)"
|
|
||||||
fi
|
|
||||||
MAJOR_VERSION="${VERSION%%.*}"
|
|
||||||
|
|
||||||
if [ "${LLVM_VERSION}" = "trunk" ]; then
|
|
||||||
install_llvm_key
|
|
||||||
|
|
||||||
apt install -y llvm clang clangd clang-tools lld lldb clang-tidy clang-format
|
|
||||||
elif [ "${MAJOR_VERSION}" -lt "${LLVM_VERSION}" ]; then
|
|
||||||
FAILED_INSTALL=0
|
|
||||||
apt install -y "llvm-${LLVM_VERSION}" "clang-${LLVM_VERSION}" "clangd-${LLVM_VERSION}" "clang-tools-${LLVM_VERSION}" "lld-${LLVM_VERSION}" "lldb-${LLVM_VERSION}" "clang-tidy-${LLVM_VERSION}" "clang-format-${LLVM_VERSION}" || FAILED_INSTALL=1
|
|
||||||
|
|
||||||
if [ "${FAILED_INSTALL}" -ne 0 ]; then
|
|
||||||
install_llvm_key
|
|
||||||
apt install -y "llvm-${LLVM_VERSION}" "clang-${LLVM_VERSION}" "clangd-${LLVM_VERSION}" "clang-tools-${LLVM_VERSION}" "lld-${LLVM_VERSION}" "lldb-${LLVM_VERSION}" "clang-tidy-${LLVM_VERSION}" "clang-format-${LLVM_VERSION}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
Loading…
Reference in a new issue